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

EKF2: Fix Joseph covariance update for direct state observations #22911

Merged
merged 3 commits into from
Mar 20, 2024

Conversation

bresch
Copy link
Member

@bresch bresch commented Mar 20, 2024

Solved Problem

I found that the EKF would crash if gyro bias estimation is disabled.

Solution

Same issue as in #22847 , the intermediate covariance matrix isn't symmetric, so taking the row and the column is different. We must take the column to get correct results when the Kalman gain is manually modified (inhibited states).

I added more comments to explain how to the original Joseph covariance equation is manipulated to obtain an efficient implementation.

Changelog Entry

For release notes:

New parameter: -
Documentation: -

Test coverage

added unit test to reproduce the bug

bresch added 3 commits March 20, 2024 12:20
This makes the ekf unstable and creates NANs during initialization
The duration of a unit test had to be increased because the incorrect
covariance matrix update, was making the unit test passing faster
(over-optimistic variance).
@bresch bresch added the EKF2 label Mar 20, 2024
@bresch bresch requested a review from dagar March 20, 2024 11:34
@bresch bresch self-assigned this Mar 20, 2024
Comment on lines +884 to +885
// P (or "P_temp") is not symmetric so we must take the column
PH = P.col(state_index);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fix.

Copy link
Contributor

@sfuhrer sfuhrer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find!

@bresch
Copy link
Member Author

bresch commented Mar 20, 2024

CI checks failing:

I'll merge this important fix anyway.

@bresch bresch merged commit 638e17d into main Mar 20, 2024
89 of 92 checks passed
@bresch bresch deleted the pr-ekf2-joseph-fix branch March 20, 2024 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants