![]() |
latest version v1.9 - last update 10 Apr 2010 |
![]() |
A tracker implementation making use of the class kalmanFilter. More...
#include <ltiKalmanTracker.h>
Classes | |
class | parameters |
The parameters for the class kalmanTracker. More... | |
Public Member Functions | |
kalmanTracker (const int &stateDimensions=4) | |
kalmanTracker (const kalmanTracker &other) | |
virtual | ~kalmanTracker () |
virtual const char * | getTypeName () const |
int | getSystemStateDimensions () const |
bool | apply (const float &xMeasurement, const float &yMeasurement, float &xPredictionApriori, float &yPredictionApriori) |
bool | apply (float &xPredictionApriori, float &yPredictionApriori) |
kalmanTracker & | copy (const kalmanTracker &other) |
virtual functor * | clone () const |
const parameters & | getParameters (void) const |
bool | updateParameters () |
void | setMeasurementNoiseCovariance (const matrix< float > &r) |
const vector< float > & | getEstimate () const |
const vector< float > & | getEstimateAposteriori () const |
const matrix< float > & | getErrorCovarianceApriori () const |
const matrix< float > & | getErrorCovarianceAposteriori () const |
void | reset (void) |
bool | isInitialized () const |
Protected Member Functions | |
bool | performTimeUpdate () |
bool | performMeasurementUpdate (const float &xMeasurement, const float &yMeasurement) |
Protected Attributes | |
kalmanFilter | kalman |
bool | initialized |
lti::vector< float > | measurement |
lti::vector< float > | prediction |
A tracker implementation making use of the class kalmanFilter.
It tracks a 2D point, using a system state vector that contains x and y coordinate as well as x and y velocity (denoted by vx and vy) and, optionally, x and y acceleration (ax and ay) of this point. These state vectors correspond to the assumption of constant velocity and constant acceleration, respectively. The state vector is structured like this: (x,vx,y,vy), or (x,vx,y,vy,ax,ay). The measured x and y coordinate are given to the apply method, which returns the estimated x and y coordinates at the next time step.
These matrices (contained in the parameters) must be specified:
matrix<float> measurementNoiseCovariance (; 2x2)
matrix<float> processNoiseCovariance (; 4x4 / 6x6)
These matrices (contained in the parameters) should be specified, but are initialized to default values that should be sufficient for a first try:
vector<float> initialSystemState (; 4 / 6)
matrix<float> initialErrorCovariance ( and
; 4x4 / 6x6)
The parantheses contain notation and dimensionality of the matrices for the constant velocity / constant acceleration case.
lti::kalmanTracker::kalmanTracker | ( | const int & | stateDimensions = 4 |
) |
constructor for n-dimensional system state (n may be 4 or 6).
default is 4.
lti::kalmanTracker::kalmanTracker | ( | const kalmanTracker & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::kalmanTracker::~kalmanTracker | ( | ) | [virtual] |
destructor
bool lti::kalmanTracker::apply | ( | float & | xPredictionApriori, | |
float & | yPredictionApriori | |||
) |
Perform only a time update (i.e.
no new measurement available), resulting in a prediction of x and y coordinates for the next time step, which are then returned.
bool lti::kalmanTracker::apply | ( | const float & | xMeasurement, | |
const float & | yMeasurement, | |||
float & | xPredictionApriori, | |||
float & | yPredictionApriori | |||
) |
Perform a measurement update and then a time update, resulting in a prediction of x and y coordinates for the next time step, which are then returned.
virtual functor* lti::kalmanTracker::clone | ( | ) | const [virtual] |
returns a pointer to a clone of this functor.
Implements lti::functor.
kalmanTracker& lti::kalmanTracker::copy | ( | const kalmanTracker & | other | ) |
copy data of "other" functor.
other | the functor to be copied |
Reimplemented from lti::functor.
const matrix<float>& lti::kalmanTracker::getErrorCovarianceAposteriori | ( | ) | const |
Get the a posteriori error covariance ().
const matrix<float>& lti::kalmanTracker::getErrorCovarianceApriori | ( | ) | const |
Get the a priori error covariance ().
const vector<float>& lti::kalmanTracker::getEstimate | ( | ) | const |
Get the (a priori) system state estimate ().
This is the prediction one would normally be interested in.
const vector<float>& lti::kalmanTracker::getEstimateAposteriori | ( | ) | const |
Get the a posteriori system state estimate ().
const parameters& lti::kalmanTracker::getParameters | ( | void | ) | const |
returns used parameters
Reimplemented from lti::functor.
int lti::kalmanTracker::getSystemStateDimensions | ( | ) | const |
Return the number of system state dimensions (currently either 4 or 6).
virtual const char* lti::kalmanTracker::getTypeName | ( | ) | const [virtual] |
returns the name of this type ("kalmanTracker")
Reimplemented from lti::functor.
bool lti::kalmanTracker::isInitialized | ( | ) | const |
bool lti::kalmanTracker::performMeasurementUpdate | ( | const float & | xMeasurement, | |
const float & | yMeasurement | |||
) | [protected] |
Perform measurement update.
bool lti::kalmanTracker::performTimeUpdate | ( | ) | [protected] |
Perform time update.
void lti::kalmanTracker::reset | ( | void | ) |
Reset the filter state () and error covariance (
).
The tracker is left in an un-initialized state.
void lti::kalmanTracker::setMeasurementNoiseCovariance | ( | const matrix< float > & | r | ) |
set a new measurement noise covariance, e.g.
because future measurements are less/more reliable (overlapping starts/ends)
bool lti::kalmanTracker::updateParameters | ( | ) | [virtual] |
set parameters of this Kalman tracker
Reimplemented from lti::functor.
bool lti::kalmanTracker::initialized [protected] |
kalmanFilter lti::kalmanTracker::kalman [protected] |
The kalmanFilter used by this tracker.
lti::vector<float> lti::kalmanTracker::measurement [protected] |
This temporary variable wraps two floats (the x/y measurement) in a vector.
lti::vector<float> lti::kalmanTracker::prediction [protected] |
This temporary variable wraps two floats (the x/y prediction) in a vector.