EKF2: fix joseph covariance update for Schmidt-Kalman filter #22847
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.
If part of the Kalman gain is zeroed, the first step of the joseph update does not produce a symmetrical matrix.
I was playing with the mag 3D fusion and a different error-state formulation and managed to make the ekf diverge (really hard to trigger, I've only seen it once. Luckily logging from boot was enabled).
https://logs.px4.io/plot_app?log=75f6a8a5-d47a-47ac-a48a-bf2d846ba501
After replaying on main I saw that the issue was real:
With this PR it no longer diverges:
Changelog Entry
For release notes:
Test coverage
replay
Context
Related links, screenshot before/after, video