Kalman filter implementation, for a linear system.
More...
#include <kf.h>
|
| KF () |
| Constructor, nothing happens here. More...
|
|
| ~KF () |
| Destructor, nothing happens here. More...
|
|
void | InitSystem (const mat &A, const mat &B, const mat &H, const mat &Q, const mat &R) |
| Define the system. More...
|
|
void | InitSystemState (const colvec &x0) |
| Initialize the system states. Must be called after InitSystem. If not, called, system states are initialized to zero. More...
|
|
void | InitStateCovariance (const mat &P0) |
| Initialize the state covariance. Must be called after InitSystem. If not called, covariance state is Initialized to an identity matrix. More...
|
|
void | Kalmanf (const colvec &u) |
| Do Kalman filter iteration step-by-step while simulating the system. Simulating the system is done to calculate system states and outputs. More...
|
|
void | Kalmanf (const colvec &z, const colvec &u) |
| Do Kalman filter iteration step-by-step without simulating the system. Use this if measurement is available and simulating the system is unnecessary. Here, true system states and system outputs do not matter. The only thing that matters is the estimated states. More...
|
|
colvec * | GetCurrentState () |
| Get current simulated true state. More...
|
|
colvec * | GetCurrentOutput () |
| Get current simulated true output. This is analogous to the measurements. More...
|
|
colvec * | GetCurrentEstimatedState () |
| Get current estimated state. More...
|
|
colvec * | GetCurrentEstimatedOutput () |
| Get current estimated output. This is the filtered measurements, with less noise. More...
|
|
Kalman filter implementation, for a linear system.
◆ KF()
Constructor, nothing happens here.
◆ ~KF()
Destructor, nothing happens here.
◆ GetCurrentEstimatedOutput()
colvec * KF::GetCurrentEstimatedOutput |
( |
| ) |
|
Get current estimated output. This is the filtered measurements, with less noise.
- Returns
- Current estimated output $\hat{z}_k$
◆ GetCurrentEstimatedState()
colvec * KF::GetCurrentEstimatedState |
( |
| ) |
|
Get current estimated state.
- Returns
- Current estimated state $\hat{x}_k$
◆ GetCurrentOutput()
colvec * KF::GetCurrentOutput |
( |
| ) |
|
Get current simulated true output. This is analogous to the measurements.
- Returns
- Current simulated output $z_k$
◆ GetCurrentState()
colvec * KF::GetCurrentState |
( |
| ) |
|
Get current simulated true state.
- Returns
- Current simulated state $x_k$
◆ InitStateCovariance()
void KF::InitStateCovariance |
( |
const mat & |
P0 | ) |
|
Initialize the state covariance. Must be called after InitSystem. If not called, covariance state is Initialized to an identity matrix.
- Parameters
-
P0 | Inital value for the state covariance |
◆ InitSystem()
void KF::InitSystem |
( |
const mat & |
A, |
|
|
const mat & |
B, |
|
|
const mat & |
H, |
|
|
const mat & |
Q, |
|
|
const mat & |
R |
|
) |
| |
Define the system.
- Parameters
-
A | System matrix |
B | Input matrix |
H | Output matrix |
Q | Process noise covariance |
R | Measurement noise covariance |
◆ InitSystemState()
void KF::InitSystemState |
( |
const colvec & |
x0 | ) |
|
Initialize the system states. Must be called after InitSystem. If not, called, system states are initialized to zero.
- Parameters
-
x0 | Inital value for the system state |
◆ Kalmanf() [1/2]
void KF::Kalmanf |
( |
const colvec & |
u | ) |
|
Do Kalman filter iteration step-by-step while simulating the system. Simulating the system is done to calculate system states and outputs.
- Parameters
-
u | tThe applied input to the system |
◆ Kalmanf() [2/2]
void KF::Kalmanf |
( |
const colvec & |
z, |
|
|
const colvec & |
u |
|
) |
| |
Do Kalman filter iteration step-by-step without simulating the system. Use this if measurement is available and simulating the system is unnecessary. Here, true system states and system outputs do not matter. The only thing that matters is the estimated states.
- Parameters
-
z | The values of the output from measurement |
u | The applied input to the system |
The documentation for this class was generated from the following files: