Implemented wrapper for KalmanFilters.jl SRKF #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.