Kalman Filter included?
MattW86 opened this issue · 3 comments
Hi,
Thanks very much for this great library.
Just wondering if this library contains regular Kalman filter for linear systems?
Cheers
There is no dedicated KF implementation, but you can of course use the more general EKF implementation also for linear systems. Just use your state transition matrix as jacobian. I hope this answers your question.
Thanks very much for your reply. It would be best if you could give an example. I am pretty new to Kaman filter.
@MattW86 You can set up derived classes like the following:
template<...>
class YourSystemModel : public Kalman::LinearizedSystemModel<...>
{
...
// do typedef assignments so that your state type is "S" and control type is "C"
S f(const S& x, const C& u)
{
return this->F*x;
}
};
template<...>
class YourMeasModel : public Kalman::LinearizedMeasurementModel<...>
{
...
// do a typedef assignment so that your state type is "M"
M h(const S& x)
{
return this->H*x;
}
}
Note: I have omitted all of the template arguments. Follow the pattern in the examples/Robot1
folder and you should be ok.
You can then use the ExtendedKalmanFilter
as a linear kalman filter.
You don't need to call the updateJacobians
method inside of your f
or h
methods because these are called in the predict
and update
methods of the filters before the calls to f
or h
.