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

Implemented wrapper for KalmanFilters.jl SRKF #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

THargreaves
Copy link
Collaborator

A simple wrapper for the square-root Kalman filter from KalmanFilters.jl. Still a bit of a draft and lacking documentation. Will add when implementation details sorted out.

They implemented their algorithm in a very modular way so it was a breeze to write the wrapper. They also look pretty memory efficient and rely on low-level LAPACK operations so should be speedy. They also implement the Unscented KF but not the extended.

They do not compute the incremental marginal log-likelihood but this is easy since they return the innovation mean and covariance (the likelihood is the density of a Gaussian with these parameters at zero).

The one sticking point is that the QR decomposition they use for updating does not enforce positive diagonals for R so that this is not a valid Cholesky decomposition and logpdf(MvNormal(...), ...) fails. I have a hacky manual computation of the log density to handle this case for now but I've raised an issue here JuliaGNSS/KalmanFilters.jl#16.

There are still some minor performance improvements that could be made either in this repo or in the original depending on their needs. Specifically, it is not necessary to compute the Kalman gain since we have

x_post = x_pred - (Ksqrt(Y)) * inv(sqrt(Y)) * y_tilde

And Ksqrt(Y) and sqrt(Y) are contained in the QR decomposition output. Maybe there is a need for compute K directly though?

There are also algorithms for updating (x, P) as well as doing a joint time+measurement update that avoids a second QR decomposition—but that feels like an issue for way down the line. These algorithms should also be amenable to the GPU using batch LUs from CuSolver.

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

Successfully merging this pull request may close these issues.

1 participant