|
Complementary Filter 1.0
Complementary Filter for Real-Time Application
|
This library provides a generic implementation of a first-order complementary filter for sensor fusion.
A complementary filter combines measurements from different sensors by exploiting their complementary frequency characteristics. A low-frequency measurement from one sensor can be combined with a high-frequency measurement from another sensor to obtain a more stable estimate.
The library provides a templated estimators::cf::CF class that supports different numeric types such as float and double.
The complementary filter library provides:
A complementary filter can be created and initialized using a cutoff frequency and sampling time:
The filter can be configured using the following parameters:
fc : Cutoff frequency of the filter.tau : Time constant of the filter.dt : Sampling time or control-loop period.alpha: Complementary filter coefficient.The parameters can be configured during initialization or individually using the corresponding setter functions.
The filter can be initialized using:
Alternatively, individual parameters can be configured using:
New sensor measurements are provided to the filter using the estimators::cf::CF::update function:
The two input measurements are combined according to the configured complementary filter parameters, and the filtered output is returned.
The internal filter state can be reset using:
The current filter parameters can be obtained using:
The main class provided by this library is:
The complementary filter implementation is contained in:
Detailed documentation for the complementary filter class and its member functions is available through the estimators::cf::CF class reference.