Tune or disable EKF (height estimate diverging)

Good morning,

My plane have 3 sensors to determine the altitude : GPS, barometer and a sonar. The value “altitude filtred” is diverging after 250 [s] and I’ve already tried to double the “EKF2_BARO_GATE” and to increase the “EKF2_ACC_NOISE” like it’s describe in the dronecode help (https://docs.px4.io/v1.9.0/en/advanced_config/tuning_the_ecl_ekf.html)

I would like to know if there is another parameter to tune or radically to disable the EKF for height.

Thank you !

Forestal Maël

Hi, can you please upload the logfile?

Hello,
Here are 2 logfiles :
One with the default parameters (baro gate 5 and noise 0.35) : https://logs.px4.io/plot_app?log=89e48fe0-1b16-4120-aeb5-7d4c8b41028c
And one with the modifications (baro gate 10 and noise 0.7) : https://logs.px4.io/plot_app?log=e89f4e4f-9aa8-460d-a9d2-42e8cfbb6aaa

I notice that the real time factor is not respected. Is it possible that the computing power of the computer influences the EKF algorithm ?

Thank you !

Can you please explain what you mean with “altitude filtered is diverging after 250s”?

In the first logfile you posted the EKF seems okey until 250s when the actual system “diverges”

Here we can see the altitude setpoint(green), the sonar (red) and the altitude filtred (blue).
Between 240 and 250 secondes the value oscillates :


A zoom is made :

Yes, but if you plot the ground truth you will see that the problem isn’t with the estimator but with the movement of the real system in the simulation

The ground truth have just an offset. I don’t see what you mean when you say “movement of the real system in the simulation” is that regulation or computing power ? How can I fix that ?

Can you please describe again in a bit more detail what the problem is that you are trying to debug?
As far as I can see you are running a simulation of a vehicle that at 250 s either hits something of has a controller issue. I don’t see what you mean with a problem with ekf2?

The probleme is that the vehicle crash every times at 250 s. I don’t understand why that append while the altitude setpoint is maintained. So I supposed that the EKF is false. And when I plot the ground truth I see that the real altitude is the same as the filtred, as you tell me. So the problem is not the EKF and I don’t know why the vehicle crash. Thank you for you help I’ll keep looking