template<std::size_t n>
okapi::AverageFilter class

A filter which returns the average of a list of values.

Template parameters
n number of taps in the filter

Base classes

class Filter

Constructors, destructors, conversion operators

AverageFilter() defaulted
Averaging filter.

Public functions

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

Protected variables

std::array<double, n> data
std::size_t index
double output

Function documentation

template<std::size_t n>
double okapi::AverageFilter<n>::filter(const double ireading) override

Filters a value, like a sensor reading.

Parameters
ireading new measurement
Returns filtered result

template<std::size_t n>
double okapi::AverageFilter<n>::getOutput() const override

Returns the previous output from filter.

Returns the previous output from filter