The filters
component contains various types of filters that can be used for
various signal processing and state estimation tasks.
Table of Contents
The BiquadFilter
class provides an implementation of a Digital Biequad
Filter with
implementations for both the Direct Form 1
and Direct Form 2
.
The ButterworthFilter
class provides an implementation of a Digital
Butterworth Filter,
implemented as biquad sections (second order sections).
The ComplementaryFilter
provides a simple implementation of a filter
specifically designed to combine the outputs of a gyroscope and an accelerometer
to produce a more accurate estimate of the orientation of an object. This filter
is provided for completeness and simplicity, but the KalmanFilter
or
MadgwickFilter
are generally preferred for this purpose.
The KalmanFilter
class implements a Kalman filter for linear systems. The
filter can be used to estimate the state of a linear system given noisy
measurements. The filter can be configured for an arbitrary number of states
and measurements. You can also specify the process noise and measurement noise
covariances.
To use the filter, you must first create an instance of the KalmanFilter
class, then call the predict
and update
methods to estimate the state of
the system. To get the current state estimate, call the get_state
method.
The LowpassFilter
class provides an implementation of a digial lowpass
infinite impulse response (IIR) filter, which leverages the hardware
acceleration provided by esp-dsp and
which leverages the vector instructions on the espressif processors.
The MadgwickFilter
implements the Madgwick algorithm for orientation
estimation using an IMU. The algorithm is based on the paper An efficient orientation filter for inertial and inertial/magnetic sensor arrays
_ by
Sebastian Madgwick. It supports state / orientation estimation for both 6-axis
IMUs as well as for 9-axis IMUs.
The SimpleLowpassFilter
class provides an implementation of a simple moving
average filter with a configurable time constant.
The SosFilter
class provides an implementation of a Second Order Sections
(SoS) filter. For more information please see series second-order
sections
as well as Digital Biquad
Filter.
The TransferFunction
struct provides a simple container for storing the A and
B coefficients for an N-th order transfer function.
This example shows how to use a LowpassFilter
,
ButterworthFilter
, and SimpleLowpassFilter
from the filters
component to
filter signals. This example simply operates on random perturbations of
auto-generated data.
idf.py add-dependency "espp/filters^0.22.0"