|
wbc
|
#include <filter.hpp>
Public Member Functions | |
| LowPassFilter (double cutoff_freq, double sample_time) | |
| const Eigen::VectorXd & | apply (const Eigen::VectorXd &new_value) |
| void | reset () |
Protected Attributes | |
| double | alpha_ |
| bool | initialized_ |
| Eigen::VectorXd | y_ |
First order (exponential) low-pass filter for vector-valued signals:
\[ y_k = \alpha x_k + (1 - \alpha) y_{k-1}, \qquad \alpha = \frac{\Delta t}{\Delta t + \frac{1}{2\pi f_c}} \]
The filter state is initialized with the first input sample, so there is no transient from zero.
| wbc::LowPassFilter::LowPassFilter | ( | double | cutoff_freq, |
| double | sample_time ) |
| cutoff_freq | Cutoff frequency \(f_c\) in Hz. Has to be > 0. |
| sample_time | Time \(\Delta t\) in seconds between two consecutive calls of apply(). Has to be > 0. |
| const Eigen::VectorXd & wbc::LowPassFilter::apply | ( | const Eigen::VectorXd & | new_value | ) |
Add a new sample and return the filtered signal
|
inline |
Re-initialize the filter state with the next input sample
|
protected |
|
protected |
|
protected |