This repository has been archived by the owner on May 1, 2024. It is now read-only.
EKF covariance prediction stability improvements #1026
Merged
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.
Issue
A recent unit test I created to replicate a real-life issue (#1022) revealed a weakness in the covariance prediction code, creating correlation between physically decoupled states.
The fix
By incorporating the unit quaternion constraint in the quat2Rot conversion, the covariance prediction gets more stable and avoids having correlation between states that should be absolutely separated in practice (e.g. Z gyro bias -> Z accel bias).
This was most likely the main cause of the accel bias divergence we've seen in EKF2.
The generated code for the aiding sources (fusions) is also slightly different but I will update them later as most of the issues were apparently due to the covariance prediction and seems to be fixed now.
SITL tests showed that IMU biases are now really well estimated.
Furthermore, it seems that the heading converges much faster than before in mag-less operation during accelerations of the vehicle.