26 #ifndef __EXTKALMAN_HH__
27 #define __EXTKALMAN_HH__
29 #include <Base/Debug/Debug.hh>
30 #include <Base/Math/Matrix.hh>
31 #include <Base/Math/Vector.hh>
32 #include <MathAlgo/SVD.hh>
60 { state = priorState_; }
66 { state = posterioState_; }
73 { cov = covariance_; }
93 priorState_ = initialState;
94 covariance_ = initialCov;
95 systemStateDim_ = initialState.
size();
111 H_ = derivedMeasurement; HT_ = derivedMeasurement.
Transpose();
112 V_ = derivedMeasurementError; VT_ = derivedMeasurementError.
Transpose();
120 {R_ = measureNoiseCov;}
127 {Q_ = processNoiseCov;}
142 A_ = derivedStateTrans; AT_ = derivedStateTrans.
Transpose();
143 W_ = derivedStateTransError; WT_ = derivedStateTransError.
Transpose();
209 #endif // __EXTKALMAN_HH__
SVD svd_
needed for matrix inversion
int systemStateDim_
dimensions of system space and measurement space
Matrix< double > Q_
system noise cov.
computes and holds the singular value decomposition of a rectangular (not necessarily quadratic) Matr...
Matrix< double > R_
measurement noise cov.
Matrix< T > Transpose() const
transpose function, storing data destination matrix
void SetStateDerive(const Matrix< double > &derivedStateTrans, const Matrix< double > &derivedStateTransError)
Set the differentiation-matrices for the EKF (see [1] for details).
virtual ~ExtendedKalman()
Vector< double > lastKalmanUpdate_
maybe needed for iterated update
Matrix< double > K_
and finally the Kalman gain
void GetCovariance(Matrix< double > &cov) const
Returns the system state covariance.
void SetProcessCov(const Matrix< double > &processNoiseCov)
Set the process noise covariance – Q in [1] (may be updated for every timestep)! Process noise is ass...
Vector< double > posterioState_
Contains the corrected (a posteriori) system estimate.
Vector< double > priorState_
Contains the prediction (a priori/initial) system estimate.
Matrix< double > Identity_
identity matrix
void GetStatePosteriori(Vector< double > &state) const
Returns the corrected system state, which is the update-corrected state.
void SetMeasureCov(const Matrix< double > &measureNoiseCov)
Set measurement noise covariance – R in [1] (may be updated for every timestep)! Measurement noise is...
void SetMeasureDerive(const Matrix< double > &derivedMeasurement, const Matrix< double > &derivedMeasurementError)
Same as above for measurement function! The DerivedMeasurement matrix (H in [1]) contains the partial...
Classical ExtendedKalman-filter (EKF).
void SetInitial(const Vector< double > &initialState, const Matrix< double > &initialCov)
Use this function to set the initial state and system-covariance (x(0) and P(0) in [1])! ...
void GetState(Vector< double > &state) const
Returns the predicted system state.
Matrix< double > covariance_
The covariance matrix corresponding to State_.