Simple Lowpass Filter
The SimpleLowpassFilter class provides an implementation of a simple moving average filter with a configurable time constant.
API Reference
Header File
Classes
-
class SimpleLowpassFilter
Simple lowpass filter using a time constant and a stored value.
Public Functions
-
SimpleLowpassFilter() = default
Construct a new SimpleLowpassFilter object.
-
explicit SimpleLowpassFilter(const Config &config)
Initialize the lowpass filter based on the config.
- Parameters
config – Configuration struct.
-
void set_time_constant(const float time_constant)
Set the time constant of the filter.
- Parameters
time_constant – Time constant of the filter.
-
float get_time_constant() const
Get the time constant of the filter.
- Returns
Time constant of the filter.
-
float update(const float input)
Filter the signal sampled by input, updating internal state, and returning the filtered output.
- Parameters
input – New sample of the input data.
- Returns
Filtered output based on input, time, and history.
-
float operator()(float input)
Filter the signal sampled by input, updating internal state, and returning the filtered output.
- Parameters
input – New sample of the input data.
- Returns
Filtered output based on input, time, and history.
-
void reset()
Reset the filter to its initial state.
-
SimpleLowpassFilter() = default