kalman-cpp
Implementation of Kalman Filter in C++
KF Class Reference

Kalman filter implementation, for a linear system. More...

#include <kf.h>

Public Member Functions

 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...
 

Detailed Description

Kalman filter implementation, for a linear system.

Constructor & Destructor Documentation

◆ KF()

KF::KF ( )

Constructor, nothing happens here.

◆ ~KF()

KF::~KF ( )

Destructor, nothing happens here.

Member Function Documentation

◆ 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
P0Inital 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
ASystem matrix
BInput matrix
HOutput matrix
QProcess noise covariance
RMeasurement 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
x0Inital 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
utThe 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
zThe values of the output from measurement
uThe applied input to the system

The documentation for this class was generated from the following files: