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
8
#include "
okapi/api/control/controllerInput.hpp
"
9
#include "
okapi/api/filter/filter.hpp
"
10
#include <memory>
11
12
namespace
okapi
{
19
template
<
typename
InputType,
typename
FilterType>
20
class
FilteredControllerInput
:
public
ControllerInput
<double> {
21
public
:
29
FilteredControllerInput
(std::unique_ptr<
ControllerInput<InputType>
> iinput,
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
okapi::ControllerInput
Definition
controllerInput.hpp:9
okapi::FilteredControllerInput
A ControllerInput with a filter built in.
Definition
filteredControllerInput.hpp:20
okapi::FilteredControllerInput::input
std::unique_ptr< ControllerInput< InputType > > input
Definition
filteredControllerInput.hpp:45
okapi::FilteredControllerInput::FilteredControllerInput
FilteredControllerInput(std::unique_ptr< ControllerInput< InputType > > iinput, std::unique_ptr< FilterType > ifilter)
A filtered controller input.
Definition
filteredControllerInput.hpp:29
okapi::FilteredControllerInput::controllerGet
double controllerGet() override
Gets the sensor value for use in a control loop.
Definition
filteredControllerInput.hpp:40
okapi::FilteredControllerInput::filter
std::unique_ptr< FilterType > filter
Definition
filteredControllerInput.hpp:46
controllerInput.hpp
filter.hpp
okapi
Definition
chassisController.hpp:16
std
STL namespace.
include
okapi
api
filter
filteredControllerInput.hpp
Generated by
1.9.8