PX4 / PX4-ECL

Estimation & Control Library for Guidance, Navigation and Control Applications
http://dev.px4.io
BSD 3-Clause "New" or "Revised" License
477 stars 508 forks source link

EKF covariance prediction stability improvements #1026

Closed bresch closed 3 years ago

bresch commented 3 years ago

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. DeepinScreenshot_select-area_20210709164507

Furthermore, it seems that the heading converges much faster than before in mag-less operation during accelerations of the vehicle.

DeepinScreenshot_select-area_20210709164240