Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kalman Filter included? #22

Open
MattW86 opened this issue Aug 12, 2018 · 3 comments
Open

Kalman Filter included? #22

MattW86 opened this issue Aug 12, 2018 · 3 comments

Comments

@MattW86
Copy link

MattW86 commented Aug 12, 2018

Hi,
Thanks very much for this great library.
Just wondering if this library contains regular Kalman filter for linear systems?
Cheers

@mherb
Copy link
Owner

mherb commented Aug 12, 2018

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.

@MattW86
Copy link
Author

MattW86 commented Aug 12, 2018

Thanks very much for your reply. It would be best if you could give an example. I am pretty new to Kaman filter.

@jwdinius
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants