Position estimate problem in flight


Had an anomaly with the position estimate during a flight test yesterday. Fixed wing, FMUv4. Shortly after climbout the autopilot got very confused to it position and heading and the aircraft started wondering away (about 500 meters off course). GPS, airspeed, baro all look good. Eventually the autopilot figured itself out and was able to successfully RTL.

Anyone have ideas as to what happened?

Uploaded log here:

Not a px4 expert, but trying to be helpful: we’ve seen something a little similar to this when we’ve calibrated the mags inside, but forgot to recalibrate them at the flying field. We had really wild position diversions … easily 500m off true course for the first several minutes of flight and jumping around wildly, but eventually the ekf mostly sorted itself out and we were able to get some autonomous flight. The gps itself was pumping out good consistent data the whole time and we were able to get a pretty good attitude solution for the whole flight post processing the sensor data with an independent ekf that doesn’t weight the mags nearly as heavily (apparently.)

Thanks for the reply. I should have mentioned we checked compass calibration before and after this flight and it seemed spot-on at the N, E, S, W compass points. Same aircraft had several flawless flights before and after this event.

looking at the log file more closely there are some warning messages: “[lib__ecl] EKF GPS fusion timeout - reset to GPS” every ~10 seconds or so. It looks to me like we had GPS the whole time though. The other sensors look reasonable I think, but maybe I’m wrong?

I found this in the EKF code, but I’m not smart enough to follow where this leads:

Did you get any further findings ?

I faced similar issue with my drone flying away uncontrolled.

It is the 3rd time I faced this pb.
Not very easy to catch up !! :frowning:
But I had many successful flights there as well…

My difference is that I have other Pb like logging dropout, at the time drone was drifting away.
and 2 times GPS timeout at the very end of the flight when I was already controlling in manual mode.

here is my log:

I noticed that I had internal mag large offset warning while calibrating the mag.
I retried multiple times outside in different location and always had this issue.
At this flight location, the mag is drifting a lot. There must be some big magnetic perturbation there.

What I should do while facing this warning ?
Why the external compass doesn’t get large offset as well if it is due to the environment magnetic field perturbations ?

Could this be the only reason for the drone to drift away and lead to such a difference between the GPS and estimated location ?

if someone from PX4 could give a look and clarify would be awesome.

I just upgraded to the latest release, 1.6.1 and will give it a try.

I’ve been investigating this issue and a couple other flights that had similar issues for a while now. Best I can see right now is we had a very noisy Mag (compass) reading throughout the flight. We are going to try a different Mag (compass) location next time we fly.