Bayesian Filtering Library Generated from SVN r
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SRIteratedExtendedKalmanFilter Class Reference

#include <SRiteratedextendedkalmanfilter.h>

Inheritance diagram for SRIteratedExtendedKalmanFilter:
KalmanFilter Filter< MatrixWrapper::ColumnVector, MatrixWrapper::ColumnVector >

Public Member Functions

 SRIteratedExtendedKalmanFilter (Gaussian *prior, unsigned int nr_it=1)
 
virtual ~SRIteratedExtendedKalmanFilter ()
 Destructor.
 
virtual void SysUpdate (SystemModel< MatrixWrapper::ColumnVector > *const sysmodel, const MatrixWrapper::ColumnVector &u)
 Perform a system update with the current measurement model ans system model using an input u.
 
virtual void SysUpdate (SystemModel< MatrixWrapper::ColumnVector > *const sysmodel)
 Perform a system update with the current measurement model and system model.
 
virtual void MeasUpdate (MeasurementModel< MatrixWrapper::ColumnVector, MatrixWrapper::ColumnVector > *const measmodel, const MatrixWrapper::ColumnVector &z, const MatrixWrapper::ColumnVector &s)
 Perform a measurement update use a measurement model, measurements z and virutal measurements s.
 
virtual void MeasUpdate (MeasurementModel< MatrixWrapper::ColumnVector, MatrixWrapper::ColumnVector > *const measmodel, const MatrixWrapper::ColumnVector &z)
 Perform a measurement update use a measurement model, measurements z.
 
MatrixWrapper::Matrix SRCovarianceGet () const
 Returns a square root of the covariance of the measurement input u.
 
void SRCovarianceSet (MatrixWrapper::Matrix JP_new)
 Set the square root covariance to a specific value.
 
void PriorSet (MatrixWrapper::ColumnVector &X, MatrixWrapper::SymmetricMatrix &P)
 Set mean and covariance of the state estimation to a specific value.
 
virtual void CalculateMeasUpdate (MatrixWrapper::ColumnVector z, MatrixWrapper::ColumnVector Z, MatrixWrapper::Matrix H, MatrixWrapper::SymmetricMatrix R)
 
virtual void CalculateMatrix (MatrixWrapper::Matrix &H_i, MatrixWrapper::SymmetricMatrix &R_i, MatrixWrapper::Matrix &invS, MatrixWrapper::Matrix &Sr, MatrixWrapper::Matrix &K_i)
 Calculate K_i , invS and Sr.
 
virtual void CalculateMean (MatrixWrapper::ColumnVector &x_k, const MatrixWrapper::ColumnVector &z, MatrixWrapper::ColumnVector &Z_i, MatrixWrapper::Matrix &K_i)
 Calculate the new state estimate.
 
virtual void CalculateCovariance (MatrixWrapper::Matrix &R_vf, MatrixWrapper::Matrix &H_i, MatrixWrapper::Matrix &invS, MatrixWrapper::Matrix &SR)
 Calculate the covariance of the new state estimate (P_k)
 
virtual GaussianPostGet ()
 Get Posterior density.
 
void AllocateMeasModel (const vector< unsigned int > &meas_dimensions)
 Function to allocate memory needed during the measurement update,.
 
void AllocateMeasModel (const unsigned int &meas_dimensions)
 Function to allocate memory needed during the measurement update.
 
virtual void Reset (Pdf< MatrixWrapper::ColumnVector > *prior)
 Reset Filter.
 
virtual bool Update (SystemModel< MatrixWrapper::ColumnVector > *const sysmodel, const MatrixWrapper::ColumnVector &u, MeasurementModel< MatrixWrapper::ColumnVector, MatrixWrapper::ColumnVector > *const measmodel, const MatrixWrapper::ColumnVector &z, const MatrixWrapper::ColumnVector &s)
 Full Update (system with inputs/sensing params)
 
virtual bool Update (SystemModel< MatrixWrapper::ColumnVector > *const sysmodel, MeasurementModel< MatrixWrapper::ColumnVector, MatrixWrapper::ColumnVector > *const measmodel, const MatrixWrapper::ColumnVector &z, const MatrixWrapper::ColumnVector &s)
 Full Update (system without inputs, with sensing params)
 
virtual bool Update (SystemModel< MatrixWrapper::ColumnVector > *const sysmodel, MeasurementModel< MatrixWrapper::ColumnVector, MatrixWrapper::ColumnVector > *const measmodel, const MatrixWrapper::ColumnVector &z)
 Full Update (system without inputs/sensing params)
 
virtual bool Update (SystemModel< MatrixWrapper::ColumnVector > *const sysmodel, const MatrixWrapper::ColumnVector &u, MeasurementModel< MatrixWrapper::ColumnVector, MatrixWrapper::ColumnVector > *const measmodel, const MatrixWrapper::ColumnVector &z)
 Full Update (system with inputs, without sensing params)
 
virtual bool Update (SystemModel< MatrixWrapper::ColumnVector > *const sysmodel, const MatrixWrapper::ColumnVector &u)
 System Update (system with inputs)
 
virtual bool Update (SystemModel< MatrixWrapper::ColumnVector > *const sysmodel)
 System Update (system without inputs)
 
virtual bool Update (MeasurementModel< MatrixWrapper::ColumnVector, MatrixWrapper::ColumnVector > *const measmodel, const MatrixWrapper::ColumnVector &z, const MatrixWrapper::ColumnVector &s)
 Measurement Update (system with "sensing params")
 
virtual bool Update (MeasurementModel< MatrixWrapper::ColumnVector, MatrixWrapper::ColumnVector > *const measmodel, const MatrixWrapper::ColumnVector &z)
 Measurement Update (system without "sensing params")
 
int TimeStepGet () const
 Get current time.
 

Protected Member Functions

void PostSigmaSet (const MatrixWrapper::SymmetricMatrix &s)
 Set covariance of posterior estimate.
 
void PostMuSet (const MatrixWrapper::ColumnVector &c)
 Set expected value of posterior estimate.
 
void CalculateSysUpdate (const MatrixWrapper::ColumnVector &J, const MatrixWrapper::Matrix &F, const MatrixWrapper::SymmetricMatrix &Q)
 
void CalculateMeasUpdate (const MatrixWrapper::ColumnVector &z, const MatrixWrapper::ColumnVector &Z, const MatrixWrapper::Matrix &H, const MatrixWrapper::SymmetricMatrix &R)
 
virtual bool UpdateInternal (SystemModel< MatrixWrapper::ColumnVector > *const sysmodel, const MatrixWrapper::ColumnVector &u, MeasurementModel< MatrixWrapper::ColumnVector, MatrixWrapper::ColumnVector > *const measmodel, const MatrixWrapper::ColumnVector &z, const MatrixWrapper::ColumnVector &s)
 Actual implementation of Update, varies along filters.
 
void CalculateNis (const MatrixWrapper::ColumnVector &z, const MatrixWrapper::ColumnVector &Z, const MatrixWrapper::Matrix &H, const MatrixWrapper::SymmetricMatrix &R)
 

Protected Attributes

ColumnVector _Mu_new
 
SymmetricMatrix _Sigma_new
 
Matrix _Sigma_temp
 
Matrix _Sigma_temp_par
 
Matrix _SMatrix
 
Matrix _K
 
double _Nis
 
std::map< unsigned int, MeasUpdateVariables > _mapMeasUpdateVariables
 
std::map< unsignedint, MeasUpdateVariables >::iterator _mapMeasUpdateVariables_it
 
Pdf< MatrixWrapper::ColumnVector > * _prior
 prior Pdf
 
Pdf< MatrixWrapper::ColumnVector > * _post
 Pointer to the Posterior Pdf.
 
int _timestep
 Represents the current timestep of the filter.
 

Detailed Description

This is a class implementing the Kalman Filter (KF) class for Square Root Iterated Extended Kalman Filters. this is a possible implementation of a Kalman filter, which in will yield better numerical stable results, since the covariance matrix is defined as the Square root of the Covariance matrix of the state estimation. See

 @Book{   Anderson_auxiliary,
  author    = {Anderson, B.D.O. and Moore, J.B.},
  title     = {Optimal filtering},
  publisher = {Prentice-Hall, Englewood Cliffs, NJ },
  year      = {1979}
}

for more details. Note that this particular implementation:

Definition at line 53 of file SRiteratedextendedkalmanfilter.h.

Constructor & Destructor Documentation

◆ SRIteratedExtendedKalmanFilter()

SRIteratedExtendedKalmanFilter ( Gaussian prior,
unsigned int  nr_it = 1 
)

Constructor

Precondition
you created the prior
Parameters
priorpointer to the Monte Carlo Pdf prior density
nr_itthe number of iterations in one update

Member Function Documentation

◆ CalculateCovariance()

virtual void CalculateCovariance ( MatrixWrapper::Matrix &  R_vf,
MatrixWrapper::Matrix &  H_i,
MatrixWrapper::Matrix &  invS,
MatrixWrapper::Matrix &  SR 
)
virtual

Calculate the covariance of the new state estimate (P_k)

\[ JP = JP-JP*JP^{'}*H_k^{'}*inv(S)^{'}*inv(R+Sr)*H_k*JP  \]

\[ P_k=JP*JP^{'} \]

◆ CalculateMatrix()

virtual void CalculateMatrix ( MatrixWrapper::Matrix &  H_i,
MatrixWrapper::SymmetricMatrix &  R_i,
MatrixWrapper::Matrix &  invS,
MatrixWrapper::Matrix &  Sr,
MatrixWrapper::Matrix &  K_i 
)
virtual

Calculate K_i , invS and Sr.

\[ Sr= cholesky(H_i*JP*JP^{'}*H_i^{'}+R_i)^{'}  \]

\[ invS=inv(Sr)\]

\[ K_i=JP*JP^{'}*H_i^{'}*invS^{'}*invS \]

◆ CalculateMean()

virtual void CalculateMean ( MatrixWrapper::ColumnVector &  x_k,
const MatrixWrapper::ColumnVector &  z,
MatrixWrapper::ColumnVector &  Z_i,
MatrixWrapper::Matrix &  K_i 
)
virtual

Calculate the new state estimate.

\[ x_k = x_{k-} + K.(z - Z) \]

◆ CalculateMeasUpdate() [1/2]

void CalculateMeasUpdate ( const MatrixWrapper::ColumnVector &  z,
const MatrixWrapper::ColumnVector &  Z,
const MatrixWrapper::Matrix &  H,
const MatrixWrapper::SymmetricMatrix &  R 
)
protectedinherited

Calculate Kalman filter Measurement Update

\[ x_k = x_{k-} + K.(z - Z) \]

\[ P_k = (I-K.H).P_{k-} \]

with

\[ K = P_{k-}.H'.(H.P_{k-}.H'+R)^{-1} \]

◆ CalculateMeasUpdate() [2/2]

virtual void CalculateMeasUpdate ( MatrixWrapper::ColumnVector  z,
MatrixWrapper::ColumnVector  Z,
MatrixWrapper::Matrix  H,
MatrixWrapper::SymmetricMatrix  R 
)
virtual

Calculate Kalman filter Measurement Update

\[ x_k = x_{k-} + K.(z - Z) \]

\[ S=(H_k*J_k*J_k^{'}*H_k+D*R*D^{'})^{'} \]

\[ Sr=cholesky(S)^{'}\]

\[ J_k = J_k-J_k*J_k^{'}*H^{'}*inv(S)^{'}*inv(R+Sr)*H_k*J_k  \]

with

\[ K = J_{k}*J_{k}^{'}*H'*inv(S)^{'}*inv(S) \]

◆ CalculateSysUpdate()

void CalculateSysUpdate ( const MatrixWrapper::ColumnVector &  J,
const MatrixWrapper::Matrix &  F,
const MatrixWrapper::SymmetricMatrix &  Q 
)
protectedinherited

Calculate Kalman filter System Update

\[ x_k = J \]

\[ P_k = F.P_{k-}.F' + Q \]

◆ MeasUpdate()

virtual void MeasUpdate ( MeasurementModel< MatrixWrapper::ColumnVector, MatrixWrapper::ColumnVector > *const  measmodel,
const MatrixWrapper::ColumnVector &  z,
const MatrixWrapper::ColumnVector &  s 
)
virtual

Perform a measurement update use a measurement model, measurements z and virutal measurements s.

Implements KalmanFilter.

◆ PostGet()

virtual Gaussian * PostGet ( )
virtualinherited

Get Posterior density.

Get the current Posterior density

Returns
a pointer to the current posterior

Reimplemented from Filter< MatrixWrapper::ColumnVector, MatrixWrapper::ColumnVector >.

◆ SysUpdate()

virtual void SysUpdate ( SystemModel< MatrixWrapper::ColumnVector > *const  sysmodel,
const MatrixWrapper::ColumnVector &  u 
)
virtual

Perform a system update with the current measurement model ans system model using an input u.

Implements KalmanFilter.

◆ TimeStepGet()

int TimeStepGet ( ) const
inherited

Get current time.

Get the current time of the filter

Returns
the current timestep

◆ Update() [1/8]

virtual bool Update ( MeasurementModel< MatrixWrapper::ColumnVector , MatrixWrapper::ColumnVector > *const  measmodel,
const MatrixWrapper::ColumnVector &  z 
)
virtualinherited

Measurement Update (system without "sensing params")

Parameters
measmodelpointer to the measurement model to use for update
zmeasurement

◆ Update() [2/8]

virtual bool Update ( MeasurementModel< MatrixWrapper::ColumnVector , MatrixWrapper::ColumnVector > *const  measmodel,
const MatrixWrapper::ColumnVector &  z,
const MatrixWrapper::ColumnVector &  s 
)
virtualinherited

Measurement Update (system with "sensing params")

Parameters
measmodelpointer to the measurement model to use for update
zmeasurement
s"sensing parameter"

◆ Update() [3/8]

virtual bool Update ( SystemModel< MatrixWrapper::ColumnVector > *const  sysmodel)
virtualinherited

System Update (system without inputs)

Parameters
sysmodelpointer to the system model to use for update

◆ Update() [4/8]

virtual bool Update ( SystemModel< MatrixWrapper::ColumnVector > *const  sysmodel,
const MatrixWrapper::ColumnVector &  u 
)
virtualinherited

System Update (system with inputs)

Parameters
sysmodelpointer to the system model to use for update
uinput to the system

◆ Update() [5/8]

virtual bool Update ( SystemModel< MatrixWrapper::ColumnVector > *const  sysmodel,
const MatrixWrapper::ColumnVector &  u,
MeasurementModel< MatrixWrapper::ColumnVector , MatrixWrapper::ColumnVector > *const  measmodel,
const MatrixWrapper::ColumnVector &  z 
)
virtualinherited

Full Update (system with inputs, without sensing params)

Parameters
sysmodelpointer to the system model to use for update
uinput to the system
measmodelpointer to the measurement model to use for update
zmeasurement

◆ Update() [6/8]

virtual bool Update ( SystemModel< MatrixWrapper::ColumnVector > *const  sysmodel,
const MatrixWrapper::ColumnVector &  u,
MeasurementModel< MatrixWrapper::ColumnVector , MatrixWrapper::ColumnVector > *const  measmodel,
const MatrixWrapper::ColumnVector &  z,
const MatrixWrapper::ColumnVector &  s 
)
virtualinherited

Full Update (system with inputs/sensing params)

Parameters
sysmodelpointer to the system model to use for update
uinput to the system
measmodelpointer to the measurement model to use for update
zmeasurement
s"sensing parameter"

◆ Update() [7/8]

virtual bool Update ( SystemModel< MatrixWrapper::ColumnVector > *const  sysmodel,
MeasurementModel< MatrixWrapper::ColumnVector , MatrixWrapper::ColumnVector > *const  measmodel,
const MatrixWrapper::ColumnVector &  z 
)
virtualinherited

Full Update (system without inputs/sensing params)

Parameters
sysmodelpointer to the system model to use for update
measmodelpointer to the measurement model to use for update
zmeasurement

◆ Update() [8/8]

virtual bool Update ( SystemModel< MatrixWrapper::ColumnVector > *const  sysmodel,
MeasurementModel< MatrixWrapper::ColumnVector , MatrixWrapper::ColumnVector > *const  measmodel,
const MatrixWrapper::ColumnVector &  z,
const MatrixWrapper::ColumnVector &  s 
)
virtualinherited

Full Update (system without inputs, with sensing params)

Parameters
sysmodelpointer to the system model to use for update
measmodelpointer to the measurement model to use for update
zmeasurement
s"sensing parameter"

◆ UpdateInternal()

virtual bool UpdateInternal ( SystemModel< MatrixWrapper::ColumnVector > *const  sysmodel,
const MatrixWrapper::ColumnVector &  u,
MeasurementModel< MatrixWrapper::ColumnVector, MatrixWrapper::ColumnVector > *const  measmodel,
const MatrixWrapper::ColumnVector &  z,
const MatrixWrapper::ColumnVector &  s 
)
protectedvirtualinherited

Actual implementation of Update, varies along filters.

Parameters
sysmodelpointer to the used system model
uinput param for proposal density
measmodelpointer to the used measurementmodel
zmeasurement param for proposal density
ssensor param for proposal density

Implements Filter< MatrixWrapper::ColumnVector, MatrixWrapper::ColumnVector >.

Member Data Documentation

◆ _K

Matrix _K
protectedinherited

Definition at line 101 of file kalmanfilter.h.

◆ _mapMeasUpdateVariables

std::map<unsigned int, MeasUpdateVariables> _mapMeasUpdateVariables
protectedinherited

Definition at line 103 of file kalmanfilter.h.

◆ _mapMeasUpdateVariables_it

std::map<unsignedint,MeasUpdateVariables>::iterator _mapMeasUpdateVariables_it
protectedinherited

Definition at line 104 of file kalmanfilter.h.

◆ _Mu_new

ColumnVector _Mu_new
protectedinherited

Definition at line 96 of file kalmanfilter.h.

◆ _Nis

double _Nis
protectedinherited

Definition at line 102 of file kalmanfilter.h.

◆ _post

Pdf<MatrixWrapper::ColumnVector >* _post
protectedinherited

Pointer to the Posterior Pdf.

The Posterior Pdf represents the subjective belief of the person applying the filter AFTER processing inputs and measurements. A filter does not maintain the beliefs at all timesteps t, since this leads to non-constant (or ever growing if you prefer) memory requirements. However, it is possible, to copy the Posterior density at all timesteps in your application by means of the PostGet() member function

See also
PostGet()

Definition at line 95 of file filter.h.

◆ _prior

Pdf<MatrixWrapper::ColumnVector >* _prior
protectedinherited

prior Pdf

Definition at line 82 of file filter.h.

◆ _Sigma_new

SymmetricMatrix _Sigma_new
protectedinherited

Definition at line 97 of file kalmanfilter.h.

◆ _Sigma_temp

Matrix _Sigma_temp
protectedinherited

Definition at line 98 of file kalmanfilter.h.

◆ _Sigma_temp_par

Matrix _Sigma_temp_par
protectedinherited

Definition at line 99 of file kalmanfilter.h.

◆ _SMatrix

Matrix _SMatrix
protectedinherited

Definition at line 100 of file kalmanfilter.h.

◆ _timestep

int _timestep
protectedinherited

Represents the current timestep of the filter.

Todo:
Check wether this really belongs here

Definition at line 100 of file filter.h.


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