#include <kalman_filter.h>
Public Member Functions | |
| KalmanFilter (unsigned int ns, unsigned int nm, unsigned int nc, const vnl_matrix< double > &Ai, const vnl_matrix< double > &Hi, const vnl_matrix< double > &Bi, const vnl_matrix< double > &z_initial, const vnl_matrix< double > &x_initial, const vnl_matrix< double > &Pi) | |
| Constructor. | |
| KalmanFilter (unsigned int ns, unsigned int nm, const vnl_matrix< double > &Ai, const vnl_matrix< double > &Hi, const vnl_matrix< double > &z_initial, const vnl_matrix< double > &x_initial, const vnl_matrix< double > &Pi) | |
| Constructor. | |
| void | set_initial_input (const vnl_matrix< double > &x_initial) |
| void | measurement_update (const vnl_matrix< double > &zk, const vnl_matrix< double > &Rk) |
| measurement_update. | |
| vnl_matrix< double > | predict (const vnl_matrix< double > &Qk) |
| predict. | |
| vnl_matrix< double > | predict (const vnl_matrix< double > &Qk, const vnl_matrix< double > &uk) |
| predict. | |
| vnl_matrix< double > | update_predict (const vnl_matrix< double > &zk, const vnl_matrix< double > &Rk, const vnl_matrix< double > &Qk) |
| update_predict. | |
| vnl_matrix< double > | estimate () const |
| vnl_matrix< double > | prediction () const |
Private Attributes | |
| unsigned int | num_signal_dimensions |
| unsigned int | num_measurement_dimensions |
| unsigned int | num_control_dimensions |
| vnl_matrix< double > | A |
| vnl_matrix< double > | H |
| vnl_matrix< double > | B |
| vnl_matrix< double > | x |
| vnl_matrix< double > | x_pred |
| vnl_matrix< double > | z |
| vnl_matrix< double > | P |
| vnl_matrix< double > | K |
Friends | |
| vcl_ostream & | operator<< (vcl_ostream &os, const KalmanFilter &kf) |
| output operator. | |
Definition at line 36 of file kalman_filter.h.
| KalmanFilter::KalmanFilter | ( | unsigned int | ns, |
| unsigned int | nm, | ||
| unsigned int | nc, | ||
| const vnl_matrix< double > & | Ai, | ||
| const vnl_matrix< double > & | Hi, | ||
| const vnl_matrix< double > & | Bi, | ||
| const vnl_matrix< double > & | z_initial, | ||
| const vnl_matrix< double > & | x_initial, | ||
| const vnl_matrix< double > & | Pi | ||
| ) |
Constructor.
Initialises the necessary parameters and matrices
| ns | number of dimensions in signal |
| nm | number of dimensions in measurement |
| nc | number of dimensions in control input |
| A | the ns*ns matrix relating signal at time k to signal at time k+1. |
| H | the nm*ns matrix relating the measurement to the signal. |
| B | the nc*ns matrix relating the signal to the control input. I'm not sure what this is used for, but I've included it for completeness. |
| x_initial | the initial ns*1 estimate of the signal. |
| p_initial | the initial error variance vector. P = p_initial.transpose()*p_initial. |
Definition at line 54 of file kalman_filter.cxx.
| KalmanFilter::KalmanFilter | ( | unsigned int | ns, |
| unsigned int | nm, | ||
| const vnl_matrix< double > & | Ai, | ||
| const vnl_matrix< double > & | Hi, | ||
| const vnl_matrix< double > & | z_initial, | ||
| const vnl_matrix< double > & | x_initial, | ||
| const vnl_matrix< double > & | Pi | ||
| ) |
Constructor.
Initialises the necessary parameters and matrices
| ns | number of dimensions in signal |
| nm | number of dimensions in measurement |
| A | the ns*ns matrix relating signal at time k to signal at time k+1. |
| H | the nm*ns matrix relating the measurement to the signal. |
| x_initial | the initial ns*1 estimate of the signal. |
| p_initial | the initial error variance vector. P = p_initial.transpose()*p_initial. |
Definition at line 131 of file kalman_filter.cxx.
| vnl_matrix<double> KalmanFilter::estimate | ( | ) | const [inline] |
Definition at line 117 of file kalman_filter.h.
| void KalmanFilter::measurement_update | ( | const vnl_matrix< double > & | zk, |
| const vnl_matrix< double > & | Rk | ||
| ) |
measurement_update.
Calculate the Kalman gain, update the signal estimate from the last time point using the previous estimate and the new measurement, and update the error covariance matrix.
| zk | the new measurement |
| Rk | the measurement error covariance matrix |
Definition at line 192 of file kalman_filter.cxx.
| vnl_matrix< double > KalmanFilter::predict | ( | const vnl_matrix< double > & | Qk | ) |
predict.
Calculate the next state given the current estimate and project the error covariance matrix ahead in time as well. In this case, I am assuming there is no control input.
| Qk | the process error covariance matrix |
Definition at line 248 of file kalman_filter.cxx.
| vnl_matrix< double > KalmanFilter::predict | ( | const vnl_matrix< double > & | Qk, |
| const vnl_matrix< double > & | uk | ||
| ) |
predict.
Calculate the next state given the current estimate and project the error covariance matrix ahead in time as well.
| Qk | the process error covariance matrix |
| uk | the control input |
Definition at line 281 of file kalman_filter.cxx.
| vnl_matrix<double> KalmanFilter::prediction | ( | ) | const [inline] |
Definition at line 119 of file kalman_filter.h.
| void KalmanFilter::set_initial_input | ( | const vnl_matrix< double > & | x_initial | ) | [inline] |
Definition at line 89 of file kalman_filter.h.
| vnl_matrix< double > KalmanFilter::update_predict | ( | const vnl_matrix< double > & | zk, |
| const vnl_matrix< double > & | Rk, | ||
| const vnl_matrix< double > & | Qk | ||
| ) |
update_predict.
A wrapper function to both update the measurement and predict the new state.
| zk | the new measurement |
| Rk | the measurement error covariance matrix |
| Qk | the process error covariance matrix |
Definition at line 324 of file kalman_filter.cxx.
| vcl_ostream& operator<< | ( | vcl_ostream & | os, |
| const KalmanFilter & | kf | ||
| ) | [friend] |
output operator.
| kf | the Kalman filter to output |
Definition at line 342 of file kalman_filter.cxx.
vnl_matrix<double> KalmanFilter::A [private] |
Definition at line 48 of file kalman_filter.h.
vnl_matrix<double> KalmanFilter::B [private] |
Definition at line 54 of file kalman_filter.h.
vnl_matrix<double> KalmanFilter::H [private] |
Definition at line 51 of file kalman_filter.h.
vnl_matrix<double> KalmanFilter::K [private] |
Definition at line 69 of file kalman_filter.h.
unsigned int KalmanFilter::num_control_dimensions [private] |
Definition at line 45 of file kalman_filter.h.
unsigned int KalmanFilter::num_measurement_dimensions [private] |
Definition at line 42 of file kalman_filter.h.
unsigned int KalmanFilter::num_signal_dimensions [private] |
Definition at line 39 of file kalman_filter.h.
vnl_matrix<double> KalmanFilter::P [private] |
Definition at line 66 of file kalman_filter.h.
vnl_matrix<double> KalmanFilter::x [private] |
Definition at line 57 of file kalman_filter.h.
vnl_matrix<double> KalmanFilter::x_pred [private] |
Definition at line 60 of file kalman_filter.h.
vnl_matrix<double> KalmanFilter::z [private] |
Definition at line 63 of file kalman_filter.h.
1.7.5.1