okapi::EmaFilter class

Base classes

class Filter

Constructors, destructors, conversion operators

EmaFilter(double ialpha) explicit
Exponential moving average filter.

Public functions

auto filter(double ireading) -> double override
Filters a value, like a sensor reading.
auto getOutput() const -> double override
Returns the previous output from filter.
void setGains(double ialpha) virtual
Set filter gains.

Protected variables

double alpha
double output
double lastOutput

Function documentation

okapi::EmaFilter::EmaFilter(double ialpha) explicit

Exponential moving average filter.

Parameters
ialpha alpha gain

double okapi::EmaFilter::filter(double ireading) override

Filters a value, like a sensor reading.

Returns filtered result

double okapi::EmaFilter::getOutput() const override

Returns the previous output from filter.

Returns the previous output from filter

void okapi::EmaFilter::setGains(double ialpha) virtual

Set filter gains.

Parameters
ialpha alpha gain