LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
demaFilter.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#include <ratio>
10
11namespace okapi {
12class DemaFilter : public Filter {
13 public:
20 DemaFilter(double ialpha, double ibeta);
21
28 double filter(double ireading) override;
29
35 double getOutput() const override;
36
43 virtual void setGains(double ialpha, double ibeta);
44
45 protected:
46 double alpha, beta;
47 double outputS = 0;
48 double lastOutputS = 0;
49 double outputB = 0;
50 double lastOutputB = 0;
51};
52} // namespace okapi
double filter(double ireading) override
Filters a value, like a sensor reading.
double getOutput() const override
Returns the previous output from filter.
virtual void setGains(double ialpha, double ibeta)
Set filter gains.
DemaFilter(double ialpha, double ibeta)
Double exponential moving average filter.