|
My Project
|
A generic implementation of an Extended Kalman Filter (EKF). More...
#include <ekf.hpp>
A generic implementation of an Extended Kalman Filter (EKF).
This class provides the core EKF functionality, including state prediction and update steps for nonlinear systems. It supports dynamic system models and allows for numerical differentiation of Jacobians for both state transition and measurement functions.
You must provide several key functions and data to ensure the filter works properly:
f): A function that models the evolution of the state vector over time, used for the prediction step.h): A function that models the measurement process, mapping the state vector to the measurement space.X and P): The user must initialize the state vector X and the state covariance matrix P with reasonable values for the system.U): If the system involves control inputs, the user must provide them during the prediction step.Z and R): During the update step, the user must provide the measurement vector Z and the measurement noise covariance R.The EKF will then handle the state prediction, measurement update, and state covariance estimation.
The filter supports multiple types of sensors, with each sensor having its own measurement function and Jacobian. The number of sensor types (z_num) can be customized, allowing for flexibility in handling various measurements within the same filter.
The class also supports numerical differentiation for computing Jacobians if analytical expressions are not available, making it versatile for different models.
| x_dim | The dimension of the state vector. |
| u_dim | The dimension of the control input vector. |
| c_dim | The dimension of the system parameters (default is 1). |
| z_num | The number of measurement types (default is 1). |
| T | The data type used for calculations (default is float). |