SoftFilters
0.1.0
Arduino framework and library of software data filters.
|
A filter that updates the output based on a weighted average between its previous output and the current input. More...
#include <SoftFilters.h>
Public Member Functions | |
WeightedUpdateFilter (double w) | |
virtual bool | update (void const *const input) override |
Internally update the filter output based on the given input. More... | |
![]() | |
bool | push (void const *const input, void *const output) |
Push a new data through the filter. More... | |
Protected Attributes | |
INTERNAL_T | internal_result |
representing the result in internal type in case the output type does not have the required precision | |
![]() | |
OUT_T | out_val |
Internally managed storage of the output value. | |
Private Attributes | |
INTERNAL_T | sensitivity |
INTERNAL_T | innertia |
bool | seen_first |
Additional Inherited Members | |
![]() | |
virtual void const *const | get_output_val_ptr () final |
Push a new data through the filter. More... | |
virtual void | copy_to_client (void *const output) final |
Copy the output to client memory. | |
A filter that updates the output based on a weighted average between its previous output and the current input.
Mathematically, let \(w\) be the sensitivity (weight of the input), \(1-w\) be the innertia (weight of the previous output), \(u_i\) be the \(i\)-th input, and \(v_i\) be the \(i\)-th output. Then
\begin{aligned} v_0 &= u_0 \\ v_i &= w \, u_i + (1 - w) \, v_{i-1} \;\;\;\;\text{for}\; i>0, w\in[0,1] \end{aligned}
|
inlineoverridevirtual |
Internally update the filter output based on the given input.
This method behaves similarly to the public Filter::push method, but without copying the output to the client memory. This method is for internal workings of the filter framework.
Implements Filter.