I had a serious issue during a BVLOS flight where the EKF position departed drastically from the GPS position. An anonymized (locations changed) logfile can be found at:
Apologies I can’t upload the BIN file with the actual location.
The first minute of the flight was normal - at 75 seconds into the flight, the GPS.Lat and POS.Lat diverge drastically, and the same with GPS.Lng and POS.Lng. The reported positions were on a straight line heading approximately upwind when in fact the aircraft was heading rapidly downwind. I had to manually fly the aircraft back using FPV and the positions did not correct themselves until well after landing.
The wind was about 15m/s - within the capabilities of the platform normally.
The GPS lock was excellent - 28 to 30 satellites, HDoP < 0.6 at all times. The GPS is a HolyBro F9P operating in non-RTK mode. The flight controller is a Holybro PixHawk 4 Mini.
I have never seen the EKF output depart from the GPS location so significantly and think that this is a serious bug that really needs fixing to prevent fly-aways, (RTL would not work) whether or not there were contributing causes. If the EKF is very unhappy, the reported position really ought to follow a good GPS fix unless there is a very good reason why not (can’t think of one).
There are two hardware issues that could potentially have contributed
- Compass interference from the motor current, which although they have previously caused no issue beyond occasional “compass inconsistent” warnings, I had disabled compass 2 (it is closer to the power wiring and has worse interference) and I’d attempted to improve the interference with COMPASS_MOT_* parameters based on ground full-power tests. I had overlooked to change COMPASS_MOTCT however. I will of course be seeking to physically improve this interference by increasing separation in future. The wiki documentation for COMPASS_MOT_X etc could benefit from improvement by someone that knows how it works, especially around determining values.
- Some unexpected rain starting almost immediately after takeoff may have affected the air speed sensor. I have had issues with rain causing incorrect airspeed readings on previous flights but have not noticed any obviously wrong air speed readings in this log file, and wrong airspeed readings have never caused incorrect position previously either.
Edit: I forgot to mention, I noted two messages in the log about 8 seconds before the positions drastically diverged: “EKF2 IMU0 yaw align to GPS velocity” and “EKF2 IMU1 yaw align to GPS velocity”. I note a small jump in POS.Lng at this time but the general trend continues to follow GPS for about 8 seconds.