mherb / kalman

Header-only C++11 Kalman Filtering Library (EKF, UKF) based on Eigen3
MIT License
1.33k stars 383 forks source link

Incorrect comment for System::f #12

Closed cboulay closed 8 years ago

cboulay commented 8 years ago

here

It looks like that's the comment for MeasurementModel::h, which returns the measurement value, not SystemModel::f, which returns the state.

mherb commented 8 years ago

Thanks for pointing this out! Will be fixed in a future release (might take a little, I am working on a new API, but the current one will still be around for a while)

cboulay commented 8 years ago

I was more pointing it out as a probe to make sure I understood what was going on. I'm happy I was correct, I think. And thanks for the great library; I'm finding it easy to read and learn from.

As github issues aren't the best places for these questions, may I send you an e-mail to ask a question about your SRUKF implementation?

The questions:

  1. In addition to the algorithm you used from this paper, did you happen to see the algorithm in this paper from the same authors in Appendix A.C?
    • The main difference is that in the former the process noise and measurement noise come in during the calculation of the state and observation covariances, while in the latter the noises are both used in an augmented state variable, propagated to the sigma points which are used in f and h directly. Thus, the noise is not used directly in the calculation of S
    • The other difference is that the sigma points are not redrawn after S is updated.

I haven't implemented the latter so I don't know if the results are significantly different or if one is more robust or efficient than the other. I'm especially concerned about this if it turns out our observation noise has to be updated on every step.

  1. Have you used your library in an application where (observation) noise was dynamic? My understanding is that all I have to do is call observation_model.setCovariance(new_covariance). Should new_covariance be the full covariance or as square-root?
mherb commented 8 years ago

I just pushed two commits with a fix for the initial issue regarding the wrong docstring and an addition for setting/updating the covariance.

Please feel free to send me an email with questions, but consider opening issues here on github as these questions might be relevant to other people as well.

Regarding your two questions:

did you happen to see the algorithm in this paper from the same authors in Appendix A.C?

No. I also didn't really have the time to look through it in detail.

Have you used your library in an application where (observation) noise was dynamic?

As you already figured, you can make your process and/or state noise dynamic/time-dependent by updating your state/measurement model. As shown in the examples, you should derive your measurement model from Kalman::MeasurementModel and make sure that the CovarianceBase template parameter is set to Kalman::SquareRootBase if you want to use a Square-Root based filter (this avoids unnecessary square root computations).

You may then update the value of your measurement/process noise using either setCovariance, which expects a full covariance matrix as argument or using setCovarianceSquareRoot. I added the latter of them in 16d74cb . setCovarianceSquareRoot expects a lower triangular matrix square root as argument (The strictly upper part of the matrix is irrelevant). This avoids the Cholesky decomposition on each update.

cboulay commented 8 years ago

Great, thanks!