How to mitigate the "Flight Termination Failsafe" that activates when the "EKF2" diverges due to the flight simulation engine lagging which causes the CPU load to spike up and causes the aircraft to crash?

Hi PX4 community,

I am an aspiring flight controls engineer who loves to contribute to the aerospace domain.

I am currently running “PX4-SITL” simulations using “Alireza Ghaderi’s” PX4-XPlane plugin (latest release version “v4.1.3”) where I have built a custom fixed-wing aircraft using the X-Plane 11’s planemaker tool.

During SITL simulations, a persistent behavior that I am encountering and debugging to fix currently is that due to simulation de-synchronization which is causing the EKF2 to diverge followed by exploding due to the CPU spiking and the x-plane11 physics engine lagging, the following failsafe is being activated in QGC randomly while the simulation is running specifically when I am conducting px4 flight mode transition switches which in turn causes the aircraft to crash during sim. :

"Annunciation Failsafe activated: switching to terminate
**- No valid attitude estimate

  • Navigation error: No valid position estimate
  • Navigation error: No valid global position estimate
  • Navigation error: No valid altitude estimate"**

I have changed multiple EKF2 parameters within QGC which are part of the active PX4 full parameter list to see whether it will stop the EKF2 from exploding which causes the above failsafe to activate and crash the aircraft but the issue still persists in every simulation run.

These are the params that I have played around with to solve the above while debugging the issue:

  • EKF2_GPS_CHECK

  • EKF2_ABL_LIM

  • EKF2_ABL_ACCLIM

  • EKF2_ACC_NOISE

  • EKF2_ACC_B_NOISE

  • COM_POS_FS_EPH

  • COM_POS_LOW_ACT

  • SDLOG_MISSION

  • SDLOG_PROFILE

  • EKF2_GPS_P_NOISE

  • EKF2_GPS_V_NOISE

  • EKF2_GPS_P_GATE

  • EKF2_GPS_V_GATE

  • EKF2_MAG_TYPE

  • EKF2_MAG_DELAY

  • EKF2_MAG_GATE

  • CBRK_FLIGHTTERM

  • FD_FAIL_P

  • FD_FAIL_R

    I have increased the value of the above EKF2 parameters to delay the diverging process when the xplane11 physics engine stutters but despite that the flight termination failsafe persistently activates. I have also altered certain suggested X-Plane 11 settings such as stopping false network data UDP packets, reduced the graphics to low as well but it does not seem to improve the issue.

    If someone has encountered the same issue that I have mentioned above, can you please suggest what can be done to solve the issue in terms of steps.

Thanks

Aditya