Implementation of unscented kalman filter (UKF) for filtering non-linear processes. More...
#include <UnscentedKalman.h>
Public Member Functions | |
CvMat * | getState () |
Returns the process state vector. More... | |
CvMat * | getStateCovariance () |
Returns the process state covariance matrix. More... | |
void | initialize () |
(Re-)initialize UKF internal state. More... | |
void | predict (UnscentedProcess *process_model) |
Updated the state by predicting. More... | |
UnscentedKalman (int state_n, int obs_n, int state_k=0, double alpha=0.001, double beta=2.0) | |
Initializes Unscented Kalman filter. More... | |
void | update (UnscentedObservation *observation) |
Updates the state by an observation. More... | |
~UnscentedKalman () | |
Private Attributes | |
CvMat * | invPredObsCovariance |
CvMat * | kalmanGain |
CvMat * | kalmanTmp |
double | lambda |
double | lambda2 |
int | obs_n |
CvMat * | predObs |
CvMat * | predObsCovariance |
CvMat * | predObsDiff |
int | sigma_n |
CvMat ** | sigma_predObs |
CvMat ** | sigma_state |
bool | sigmasUpdated |
CvMat * | sqrtStateCovariance |
CvMat * | state |
int | state_k |
int | state_n |
CvMat * | stateCovariance |
CvMat * | stateD |
CvMat * | stateDiff |
CvMat * | statePredObsCrossCorrelation |
CvMat * | stateTmp |
CvMat * | stateU |
CvMat * | stateV |
Implementation of unscented kalman filter (UKF) for filtering non-linear processes.
See http://www.cs.unc.edu/~welch/kalman/media/pdf/Julier1997_SPIE_KF.pdf for more details about UKF.
The UKF estimates a process state (represented by a vector) using observations of the process. Observations are some derivate of the process state as usually the process state cannot be directly observed.
UnscentedProcess models the process by predicting the next filter state based on the current filter state.
UnscentedObservation models the observation by predicting observation results based on the current filter state.
UnscentedKalman holds the estimated process state vector and its covariance matrix. The new process state can be estimated using predict and update methods.
The current implementation does not separate process noise elements from the process state vector. It is therefore the responsibility of the user to include noise terms into process state and state covariance.
Definition at line 96 of file UnscentedKalman.h.
alvar::UnscentedKalman::UnscentedKalman | ( | int | state_n, |
int | obs_n, | ||
int | state_k = 0 , |
||
double | alpha = 0.001 , |
||
double | beta = 2.0 |
||
) |
Initializes Unscented Kalman filter.
Initializes Unscented Kalman filter. The state vector returned by getState and state covariance matrix returned by getStateCovariance should be initialized before using the filter.
Separate state noise vector is currently unsupported. The user should include noise terms in the state vector directly. Set the noise mean into state vector and noise variance into state covariance matrix.
state_n | The number of elements in process state vector. |
obs_n | The number of elements in observation vector. |
state_k | The number of noise elements used in the process model. TODO: This is currently unsupported. |
alpha | Spread of sigma points. |
beta | Prior knowlegde about the distribution (2 for Gaussian). |
Definition at line 30 of file UnscentedKalman.cpp.
alvar::UnscentedKalman::~UnscentedKalman | ( | ) |
Definition at line 71 of file UnscentedKalman.cpp.
|
inline |
Returns the process state vector.
The returned state vector contains the current state of the process. The returned vector may be modified if the current process state is known, for example in initialization phase. If the vector is modified, initialize method must be called before calling either predict or update methods.
Definition at line 173 of file UnscentedKalman.h.
|
inline |
Returns the process state covariance matrix.
The returned matrix contains the current state covariance. The matrix may be modified if the covariance is known, for example in initialization phase. If the matrix is modified, initialize method must be called before calling either predict of update methods.
Definition at line 184 of file UnscentedKalman.h.
void alvar::UnscentedKalman::initialize | ( | ) |
(Re-)initialize UKF internal state.
Must be called before predict/update when ever state or state co-variance are changed.
Definition at line 97 of file UnscentedKalman.cpp.
void alvar::UnscentedKalman::predict | ( | UnscentedProcess * | process_model | ) |
Updated the state by predicting.
Updates the process state by predicting new state from the current state. Normally each predict call is followed with a call to update method.
process_model | The model implementation that is used to predict the next state. |
Definition at line 158 of file UnscentedKalman.cpp.
void alvar::UnscentedKalman::update | ( | UnscentedObservation * | observation | ) |
Updates the state by an observation.
Updates the process state by a measurement that indirectly observed the correct process state. The observation implementation needs to hold the current measurement data and implement a transformation from process state into measurement (the UnscentedObservation::h method).
observation | The observation implementation the is used to update the current state. |
Definition at line 218 of file UnscentedKalman.cpp.
|
private |
Definition at line 116 of file UnscentedKalman.h.
|
private |
Definition at line 120 of file UnscentedKalman.h.
|
private |
Definition at line 121 of file UnscentedKalman.h.
|
private |
Definition at line 103 of file UnscentedKalman.h.
|
private |
Definition at line 103 of file UnscentedKalman.h.
|
private |
Definition at line 100 of file UnscentedKalman.h.
|
private |
Definition at line 114 of file UnscentedKalman.h.
|
private |
Definition at line 115 of file UnscentedKalman.h.
|
private |
Definition at line 117 of file UnscentedKalman.h.
|
private |
Definition at line 101 of file UnscentedKalman.h.
|
private |
Definition at line 124 of file UnscentedKalman.h.
|
private |
Definition at line 123 of file UnscentedKalman.h.
|
private |
Definition at line 102 of file UnscentedKalman.h.
|
private |
Definition at line 107 of file UnscentedKalman.h.
|
private |
Definition at line 105 of file UnscentedKalman.h.
|
private |
Definition at line 99 of file UnscentedKalman.h.
|
private |
Definition at line 98 of file UnscentedKalman.h.
|
private |
Definition at line 106 of file UnscentedKalman.h.
|
private |
Definition at line 108 of file UnscentedKalman.h.
|
private |
Definition at line 112 of file UnscentedKalman.h.
|
private |
Definition at line 119 of file UnscentedKalman.h.
|
private |
Definition at line 111 of file UnscentedKalman.h.
|
private |
Definition at line 109 of file UnscentedKalman.h.
|
private |
Definition at line 110 of file UnscentedKalman.h.