TooN Algorithm Library - tag
0.2
|
Modules | |
Constant Position | |
Constant Velocity | |
Measurement classes | |
Classes | |
class | tag::KalmanFilter< State, Model > |
A basic Kalman filter implementation and various state, process models and measurement functions.
Template class providing a basic implementation of the Kalman filter. The state and the process model are both template parameter classes to keep it flexible. Both parameters have to implement a certain interface to make the filter work.
Measurements are incorporated through the template member function template<class Measurement> void KalmanFilter<class State, class Model>::filter(Measurement & m); where class Measurement also has to implement a certain protocol:
All of the member functions take the state as parameters, because the returned values are typically functions of the state in some form.
Basically, the three classes State, Model, Measurement have to know about each other and work together. However, splitting them apart allows one to change models and use multiple measurement functions for a single kind of state. That simplifies sensor fusion and SCAAT style use of the Kalman filter.
The following example demonstrates how to use the filter classes.
Note, that all the return values from the various classes are const references. This avoids any unnecessary copying of data. You can also return types that may be stored in const references, such as non-const references and return values.