|
| KalmanFilter (LinearSystem< STATES, INPUTS, OUTPUTS > &plant, const StateVector &state_stddevs, const OutputVector &measurement_stddevs) |
|
| KalmanFilter (const StateMatrix &A, const InputMatrix &B, const EMat< OUTPUTS, STATES > &C, const EMat< OUTPUTS, INPUTS > &D, const StateVector &state_stddevs, const OutputVector &measurement_stddevs) |
|
StateMatrix | P () const |
|
void | set_P (const StateMatrix &P) |
|
const StateVector & | xhat () const |
|
double | xhat (int i) const |
|
void | set_xhat (const StateVector &xhat) |
|
void | set_xhat (int i, double value) |
|
void | reset () |
|
void | predict (const InputVector &u, const double &dt) |
|
void | correct (const OutputVector &y, const InputVector &u) |
|
void | correct (const OutputVector &y, const InputVector &u, const EMat< OUTPUTS, OUTPUTS > &R) |
|
template<int ROWS> |
void | correct (const EVec< ROWS > &y, const InputVector &u, const EMat< ROWS, STATES > &C, const EMat< ROWS, INPUTS > &D, const EMat< ROWS, ROWS > &R) |
|
template<int STATES, int INPUTS, int OUTPUTS>
class KalmanFilter< STATES, INPUTS, OUTPUTS >
Kalman filters combine predictions from a model and measurements to estimate a system's true state.
Each call of predict moves the state forward in time according to the matrix A, and the covariance has white noise Q added.
Each call of correct applies a measurement which moves the state more toward the true state, and it reduces the state covariance.
To read more about Kalman filters read: https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python
- Template Parameters
-
STATES | Dimension of the state vector. |
INPUTS | Dimension of the control input vector. |
OUTPUTS | Dimension of the measurement vector. |
template<int STATES, int INPUTS, int OUTPUTS>
template<int ROWS>
void KalmanFilter< STATES, INPUTS, OUTPUTS >::correct |
( |
const EVec< ROWS > & | y, |
|
|
const InputVector & | u, |
|
|
const EMat< ROWS, STATES > & | C, |
|
|
const EMat< ROWS, INPUTS > & | D, |
|
|
const EMat< ROWS, ROWS > & | R ) |
|
inline |
Correct the state estimate using the measurements in y, custom measurement and feedthrough matrices, and custom measurement measurement noise. This is useful for when a different set of measurements are being applied than what the plant defines.
- Parameters
-
y | The vector of measurements. |
u | The control input used in the last predict step. |
C | The measurement matrix to use for this step. |
D | The feedthrough matrix to use for this step. |
R | The measurement noise matrix to use for this step. |