LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
filteredControllerInput.hpp
Go to the documentation of this file.
1/*
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 */
6#pragma once
7
10#include <memory>
11
12namespace okapi {
19template <typename InputType, typename FilterType>
21 public:
30 std::unique_ptr<FilterType> ifilter)
31 : input(std::move(iinput)), filter(std::move(ifilter)) {
32 }
33
40 double controllerGet() override {
41 return filter->filter(input->controllerGet());
42 }
43
44 protected:
45 std::unique_ptr<ControllerInput<InputType>> input;
46 std::unique_ptr<FilterType> filter;
47};
48} // namespace okapi
A ControllerInput with a filter built in.
std::unique_ptr< ControllerInput< InputType > > input
FilteredControllerInput(std::unique_ptr< ControllerInput< InputType > > iinput, std::unique_ptr< FilterType > ifilter)
A filtered controller input.
double controllerGet() override
Gets the sensor value for use in a control loop.
std::unique_ptr< FilterType > filter
STL namespace.