LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
emaFilter.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
9
10namespace okapi {
11class EmaFilter : public Filter {
12 public:
18 explicit EmaFilter(double ialpha);
19
26 double filter(double ireading) override;
27
33 double getOutput() const override;
34
40 virtual void setGains(double ialpha);
41
42 protected:
43 double alpha;
44 double output = 0;
45 double lastOutput = 0;
46};
47} // namespace okapi
EmaFilter(double ialpha)
Exponential moving average filter.
double getOutput() const override
Returns the previous output from filter.
double filter(double ireading) override
Filters a value, like a sensor reading.
virtual void setGains(double ialpha)
Set filter gains.