|
arduino-audio-tools
|
Simple 1D Kalman Filter for smoothing measurements. More...
#include <KalmanFilter.h>
Public Member Functions | |
| KalmanFilter (float process_noise=0.01f, float measurement_noise=1.0f) | |
| Construct a new Kalman Filter object. | |
| void | addMeasurement (float measurement) |
| Updates the filter with a new measurement and returns the filtered value. | |
| bool | begin () |
| Reset the filter state to zero, keeping the current noise parameters. | |
| bool | begin (float process_noise, float measurement_noise) |
| reset the filter with new parameters | |
| float | calculate () |
| Returns the current estimated value. | |
| void | end () |
| End or clear the filter (sets the estimate to zero). | |
Protected Attributes | |
| float | K |
| Kalman gain (K) | |
| float | P |
| Estimation error covariance (P) | |
| float | Q |
| Process noise covariance (Q) | |
| float | R |
| Measurement noise covariance (R) | |
| float | X |
| Estimated state (X) | |
Simple 1D Kalman Filter for smoothing measurements.
This class implements a basic one-dimensional Kalman filter for smoothing noisy measurements. It is useful for sensor data fusion and signal processing applications where noise reduction is required.
The Kalman filter uses two main parameters:
Lower values for Q make the filter trust the model more (less responsive to changes), while higher values for R make the filter trust the measurements less (more smoothing).
|
inline |
Construct a new Kalman Filter object.
| process_noise | The process noise covariance (Q). Default is 0.01. |
| measurement_noise | The measurement noise covariance (R). Default is 1.0. |
Updates the filter with a new measurement and returns the filtered value.
| measurement | The new measurement to be filtered |
|
inline |
Reset the filter state to zero, keeping the current noise parameters.
reset the filter with new parameters
| process_noise | The process noise covariance (Q). Default is 0.01. |
| measurement_noise | The measurement noise covariance (R). Default is 1.0. |
Initialize or reset the filter with new parameters.
| process_noise | The process noise covariance (Q). Default is 0.01. |
| measurement_noise | The measurement noise covariance (R). Default is 1.0. |
|
inline |
Returns the current estimated value.
|
inline |
End or clear the filter (sets the estimate to zero).
|
protected |
Kalman gain (K)
|
protected |
Estimation error covariance (P)
|
protected |
Process noise covariance (Q)
|
protected |
Measurement noise covariance (R)
|
protected |
Estimated state (X)