Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
Kalman::KFilter< T, BEG, OQ, OVR, DBG > Class Template Referenceabstract

Generic Linear Kalman Filter template base class. More...

#include <kfilter.hpp>

Inheritance diagram for Kalman::KFilter< T, BEG, OQ, OVR, DBG >:
Inheritance graph
[legend]

Public Member Functions

virtual ~KFilter ()=0
 Virtual destructor. More...
 
- Public Member Functions inherited from Kalman::EKFilter< T, BEG, OQ, OVR, DBG >
void init (Vector &x_, Matrix &P_)
 Sets initial conditions for the Kalman Filter. More...
 
 EKFilter ()
 Default constructor. More...
 
 EKFilter (K_UINT_32 n_, K_UINT_32 nu_, K_UINT_32 nw_, K_UINT_32 m_, K_UINT_32 nv_)
 Constructors specifying all necessary matrix and vector dimensions. More...
 
virtual ~EKFilter ()
 Virtual destructor. More...
 
K_UINT_32 getSizeX () const
 Returns the size of the state vector. More...
 
K_UINT_32 getSizeU () const
 Returns the size of the input vector. More...
 
K_UINT_32 getSizeW () const
 Returns the size of the process noise vector. More...
 
K_UINT_32 getSizeZ () const
 Returns the size of the measurement vector. More...
 
K_UINT_32 getSizeV () const
 Returns the size of the measurement noise vector. More...
 
void setDim (K_UINT_32 n_, K_UINT_32 nu_, K_UINT_32 nw_, K_UINT_32 m_, K_UINT_32 nv_)
 Sets all dimensions at once. More...
 
void setSizeX (K_UINT_32 n_)
 Sets the size of the state vector. More...
 
void setSizeU (K_UINT_32 nu_)
 Sets the size of the input vector. More...
 
void setSizeW (K_UINT_32 nw_)
 Sets the size of the process noise vector. More...
 
void setSizeZ (K_UINT_32 m_)
 Sets the size of the measurement vector. More...
 
void setSizeV (K_UINT_32 nv_)
 Sets the size of the measurement noise vector. More...
 
void step (Vector &u_, const Vector &z_)
 Makes one prediction-correction step. More...
 
void timeUpdateStep (Vector &u_)
 Makes one prediction step. More...
 
void measureUpdateStep (const Vector &z_)
 Makes one correction step. More...
 
const Vectorpredict (Vector &u_)
 Returns the predicted state vector (a priori state estimate). More...
 
const Vectorsimulate ()
 Returns the predicted measurement vector. More...
 
const VectorgetX () const
 Returns the corrected state (a posteriori state estimate). More...
 
const MatrixcalculateP () const
 Returns the a posteriori error covariance estimate matrix. More...
 

Protected Member Functions

virtual void makeB ()
 Virtual creator of B. More...
 
virtual void makeBaseB ()
 Virtual pre-creator of B. More...
 
- Protected Member Functions inherited from Kalman::EKFilter< T, BEG, OQ, OVR, DBG >
void NoModification ()
 Allows optimizations on some calculations. More...
 
virtual void makeBaseA ()
 Virtual pre-creator of A. More...
 
virtual void makeBaseW ()
 Virtual pre-creator of W. More...
 
virtual void makeBaseQ ()
 Virtual pre-creator of Q. More...
 
virtual void makeBaseH ()
 Virtual pre-creator of H. More...
 
virtual void makeBaseV ()
 Virtual pre-creator of V. More...
 
virtual void makeBaseR ()
 Virtual pre-creator of R. More...
 
virtual void makeCommonProcess ()
 Optional function used to precalculate common values for process. More...
 
virtual void makeA ()
 Virtual creator of A. More...
 
virtual void makeW ()
 Virtual creator of W. More...
 
virtual void makeQ ()
 Virtual creator of Q. More...
 
virtual void makeCommonMeasure ()
 Optional function used to precalculate common values for measurement. More...
 
virtual void makeH ()
 Virtual creator of H. More...
 
virtual void makeV ()
 Virtual creator of V. More...
 
virtual void makeR ()
 Virtual creator of R. More...
 
virtual void makeDZ ()
 Hook-up function to modify innovation vector. More...
 

Protected Attributes

Matrix B
 Input matrix. More...
 
- Protected Attributes inherited from Kalman::EKFilter< T, BEG, OQ, OVR, DBG >
Vector x
 Corrected state vector. More...
 
Vector u
 Input vector. More...
 
Vector z
 Predicted measurement vector. More...
 
Vector dz
 Innovation vector. More...
 
Matrix A
 A jacobian matrix. More...
 
Matrix W
 A jacobian matrix. More...
 
Matrix Q
 Process noise covariance matrix. More...
 
Matrix H
 A jacobian matrix. More...
 
Matrix V
 A jacobian matrix. More...
 
Matrix R
 Measurement noise covariance matrix. More...
 
K_UINT_32 n
 Size of the state vector. More...
 
K_UINT_32 nu
 Size of the input vector. More...
 
K_UINT_32 nw
 Size of the process noise vector. More...
 
K_UINT_32 m
 Size of the measurement vector. More...
 
K_UINT_32 nv
 Size of the measurement noise vector. More...
 

Private Member Functions

virtual void makeMeasure ()
 Measurement function overridden to be linear. More...
 
virtual void makeProcess ()
 Process function overridden to be linear. More...
 
virtual void sizeUpdate ()
 Matrix and vector resizing function, overridden to take B into account. More...
 

Private Attributes

Vector x__
 Temporary vector. More...
 

Additional Inherited Members

- Public Types inherited from Kalman::EKFilter< T, BEG, OQ, OVR, DBG >
enum  { beg = BEG }
 
typedef KMatrix< T, BEG, DBG > Matrix
 Matrix type. More...
 
typedef T type
 Type of objects contained in matrices and vectors. More...
 
typedef KVector< T, BEG, DBG > Vector
 Vector type. More...
 

Detailed Description

template<typename T, K_UINT_32 BEG, bool OQ = false, bool OVR = false, bool DBG = true>
class Kalman::KFilter< T, BEG, OQ, OVR, DBG >

Generic Linear Kalman Filter template base class.

Usage
This class is derived from EKFilter. You should really read all the documentation of EKFilter before reading this.
This class implements a Variable-Dimension Linear Kalman Filter based on the EKFilter template class.
Notation
Assume a state vector $ x $ (to estimate) and a linear process function $ f $ (to model) that describes the evolution of this state through time, that is :

\[ x_k = f \left( x_{k-1}, u_{k-1}, w_{k-1} \right) = //! A x_{k-1} + B u_{k-1} + W w_{k-1} \]

where $ u $ is the (known) input vector fed to the process and $ w $ is the (unknown) process noise vector due to uncertainty and process modeling errors. Further suppose that the (known) process noise covariance matrix is :

\[ Q = E \left( w w^T \right) \]

Now, let's assume a (known) measurement vector $ z $, which depends on the current state $ x $ in the form of a linear function $ h $ (to model) :

\[ z_k = h \left( x_k, v_k \right) = //! H x_k + V v_k \]

where $ v $ is the (unknown) measurement noise vector with a (known) covariance matrix :

\[ R = E \left( v v^T \right) \]

Suppose that we have an estimate of the previous state $ \hat{x}_{k-1} $, called a corrected state or an a posteriori state estimate. We can build a predicted state (also called an a priori state estimate) by using $ f $ :

\[ \tilde{x}_k = f \left( \hat{x}_{k-1}, u_{k-1}, 0 \right) = //! A \hat{x}_{k-1} + B u_{k-1} \]

since the input is known and the process noise, unknown. With this predicted state, we can get a predicted measurement vector by using $ h $ :

\[ \tilde{z}_k = h \left( \tilde{x}_k, 0 \right) = //! H \tilde{x}_k \]

since the measurement noise is unknown.
Note
In this class, makeProcess() and makeMeasure() have already been overridden, and cannot be ovverridden again. However, there is a new matrix to create : B. This means there are two new virtual functions that can be overridden : makeBaseB() and makeB().
See Also
EKFilter

Definition at line 83 of file kfilter.hpp.

Constructor & Destructor Documentation

template<typename T , K_UINT_32 BEG, bool OQ, bool OVR, bool DBG>
Kalman::KFilter< T, BEG, OQ, OVR, DBG >::~KFilter ( )
pure virtual

Virtual destructor.

Definition at line 36 of file kfilter_impl.hpp.

Member Function Documentation

template<typename T , K_UINT_32 BEG, bool OQ, bool OVR, bool DBG>
void Kalman::KFilter< T, BEG, OQ, OVR, DBG >::makeB ( )
protectedvirtual

Virtual creator of B.

Definition at line 42 of file kfilter_impl.hpp.

template<typename T , K_UINT_32 BEG, bool OQ, bool OVR, bool DBG>
void Kalman::KFilter< T, BEG, OQ, OVR, DBG >::makeBaseB ( )
protectedvirtual

Virtual pre-creator of B.

Definition at line 39 of file kfilter_impl.hpp.

template<typename T , K_UINT_32 BEG, bool OQ, bool OVR, bool DBG>
void Kalman::KFilter< T, BEG, OQ, OVR, DBG >::makeMeasure ( )
privatevirtual

Measurement function overridden to be linear.

Implements Kalman::EKFilter< T, BEG, OQ, OVR, DBG >.

Definition at line 70 of file kfilter_impl.hpp.

template<typename T , K_UINT_32 BEG, bool OQ, bool OVR, bool DBG>
void Kalman::KFilter< T, BEG, OQ, OVR, DBG >::makeProcess ( )
privatevirtual

Process function overridden to be linear.

Implements Kalman::EKFilter< T, BEG, OQ, OVR, DBG >.

Definition at line 45 of file kfilter_impl.hpp.

template<typename T , K_UINT_32 BEG, bool OQ, bool OVR, bool DBG>
void Kalman::KFilter< T, BEG, OQ, OVR, DBG >::sizeUpdate ( )
privatevirtual

Matrix and vector resizing function, overridden to take B into account.

Reimplemented from Kalman::EKFilter< T, BEG, OQ, OVR, DBG >.

Definition at line 88 of file kfilter_impl.hpp.

Member Data Documentation

template<typename T , K_UINT_32 BEG, bool OQ = false, bool OVR = false, bool DBG = true>
Matrix Kalman::KFilter< T, BEG, OQ, OVR, DBG >::B
protected

Input matrix.

Definition at line 98 of file kfilter.hpp.

template<typename T , K_UINT_32 BEG, bool OQ = false, bool OVR = false, bool DBG = true>
Vector Kalman::KFilter< T, BEG, OQ, OVR, DBG >::x__
private

Temporary vector.

Definition at line 112 of file kfilter.hpp.


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


kfilter
Author(s): Jorge Almeida, Vincent Zalzal, Sylvain Marleau, Richard Gourdeau
autogenerated on Mon Mar 2 2015 01:31:45