EKF2 problem: z velocity estimate weird behaviour


I am working on a multicopter that is able to hover at any pitch angle. Currently I experienced a lot of trouble with the EKF2 estimator. The errors that I often have encountered are “PREFLIGHT FAIL: EKF INTERNAL CHECKS” and “PREFLIGHT FAIL: EKF HIGH IMU ACCEL BIAS”, when I try to rearm after some certain moves. I do not have a lot experience with the ecl EKF and would be grateful if some one could maybe give a hint for what I have to look out for.

Setup: Pixhawk 4 from Holybro, together with GPS module (external magnetometer disabled), mostly indoors( but haven’t tested extensively outdoors), GPS diabled in EKF_AID_MASK, other EKF parameter should all be mostly on default except for the EKF2_IMU_POS_* parameters. On one of two multicopter the Pixhawk is surrounded by carbon plates on 5 sides.
Happens also on stable Release 1.8

It is hard to say what really triggers these errors, since it is not a hundred percent repeatable. But often direct after fast yaw motion or at pitch angles close to 90 degrees, I observe that the z velocity estimate is converging to wrong value (up to 1 m/s off) or is slowly oscillating (amplitude also up to 1 m/s). This happens while I am holding the multicopter in my hands (motors unplugged) without moving in vertical direction. After putting the drone down on the ground and disarming, I can observe that the _preflt_horiz_fail is triggered, since the _yaw_innov_magnitude_lpf is rather high (sometimes in saturation around 0.8). This causes the “PREFLIGHT FAIL: EKF INTERNAL CHECKS”, when I try to rearm. After having the _yaw_innov_magnitude_lpf approaching zero and crossing the test_limit, the “PREFLIGHT FAIL: EKF HIGH IMU ACCEL BIAS” error occurs almost always when I try to rearm. (Sometimes happens also without the INTERNAL CHECKS error upfront)

One thought was that the 90 degree pitch could cause the problem. In the documentation of the EKF2 in the slides of Process and Observation Models, I saw that there are different heading measurement options, to avoid a possible gimbal lock. But I don’t know where I could set one of these options.

A log file of one of the flights, where the z velocity is going to 1 m/s while the drone is pitched at 90 degrees and it is staying roughly at the same height, can be found here:

Moving to the Attitude and LPE estimator seems to solve the issue. I am still interested to know what could have cause the issue.

Thank you very much for your help.

1 Like

I also had similar issue with ekf2 giving wrong vz estimation.
It sometimes thinks the drone is going down when it actually going upwards.
I thought it was due from heavy noise from vibration of my drone setup but your data shows almost no vibration in the sensor.
This issue slightly improved by increasing accel bias in EKF2 parameters but not completely.

i think exceeding COM_ARM_EKF_AB can cause the “PREFLIGHT FAIL: EKF HIGH IMU ACCEL BIAS” message. I see a lot of people posting on getting these errors. I wonder if the default parameters are a little too tight for the typical off-the-shelf non-temp calibrated flight controller. We see this High IMU Accel Bias error a lot on our aircraft too. We recently found that slowly rotating the aircraft to +/- 90 degrees pitch and roll during ground handling helps the EKF dial in the bias better and seems to clear the error.

Thank you very much for your answer. I will try this.