inav icon indicating copy to clipboard operation
inav copied to clipboard

GPS Inconsistent behavior

Open stronnag opened this issue 10 years ago • 188 comments

Spoiler : Somedays, adequate humber of satellites and reasonable HDOP doesn't meant nav functions will work as expected.

Today I flew 85fe245 and f440ead on my usually utterly reliable quad. This machine has not failed to execute PH, RTH or missions since we fixed SBAS months ago ---- until today.

Result. Completely random PH behaviour (if PH fails, then I don't even try any other nav function). Randomly, on hard reset, nav functions will either work or fail. Some log files at http://seyrsnys.myzen.co.uk/inav_ph_woes/. All the log files were created in a short time frame with good satellite coverage (16-19) and good HDOP (1.1 - 1.3).

  • LOG00279.TXT: 85fe245. PH fails miserably, repeated.
  • LOG00280.TXT: f440ead (having persistent mag/acc makes checkout / build / flash / apply config in the field so easy:). Works OK.

... does some betaflight stuff on the minis for 30 minutes

  • LOG00281.TXT: f440ead: nav functions fail miserably, repeatedly (multiple arm / disarms)
  • LOG00282.TXT: f440ead: powercycle nav functions work again !!!!
  • LOG00283.TXT: f440ead: powercycle nav functions still work. Out of lipos, otherwise I'd have tried 43eaf10 (which behaved perfectly across multiple lipos earlier in the week).

Note 0. LOG00281 Index 1, PH attempt 4 is a good example of 'fly off' selection_473

Note 1. 281-283 were executed in quick succession, it is unlikely that there was some environmental change that affected the results. Note 2. If PH is not (obviously, visually working), it is rapidly aborted.

Exec Summary : nav post 43eaf10 seems pretty random to me at the moment. Other experiences solicited.

stronnag avatar Aug 06 '16 16:08 stronnag

Seems like a GPS-related problem. GPS (and estimated navVel) velocity doesn't seem to be correlated with UAV attitude and stick input: image

It might also be a compass issue: At log 281 there is a moment when UAV is flying at only forward pitch - this is usually flying straight forward and GPS heading should be roughly equal to magnetic heading, however they are opposite: image

However, I doubt it's compass - UAV heading strongly correlates with yaw stick input. I'd blame GPS reception that reported invalid coordinates/velocities/course for some reason.

@stronnag was there strong wind that day, if so - what direction?

digitalentity avatar Aug 06 '16 23:08 digitalentity

@digitalentity, thanks for the analysis.

There was less than 8 m/s wind; I often fly in more. My initial thought (from the field) was that it was just a bad GPS day. I guess that happens from time to time. I did not suspect the compass, much of random flying / drifting around was manually correlating the observed heading with the LTM reported heading (which seemed consistent), whereas the mwp calculated 'range from home' often seemed incongruous.

It was an object lesson in 'try PH before engaging more advanced nav functions'.

I'll do some more missions today before closing.

stronnag avatar Aug 07 '16 06:08 stronnag

@stronnag Interestingly GPS glitch detection did fire an alarm a few times. We definitely need better glitch detection logic.

digitalentity avatar Aug 07 '16 06:08 digitalentity

A day later .... updated the firmware to abf1015 (so no significant change). Starts with similarly less than stellar sat statistics (13-15 sats, 1.3-1.5 HDOP); couple of hours later its back to normal, 19-20 sats and 1.1 HDOP.

PH and other nav functions back to their awesome performance and consistency, even at the lower than normal end of the sat coverage range. Someone in the DoD really didn't like me yesterday.

Maybe we should use some of those spare X-FRAME bits for a glitch detection alert or counter?

stronnag avatar Aug 07 '16 15:08 stronnag

@stronnag thanks for your report, indeed something must be wrong with GPS reception. We can use a byte in X-Frame to indicate INAV internal status flags, however we still don't have a good logic of detecting GPS failures...

digitalentity avatar Aug 08 '16 02:08 digitalentity

The solution to the problem is using EKF algorithm although it looks messy and complex.

Linjieqiang avatar Aug 09 '16 07:08 Linjieqiang

EKF is nothing close to a glitch detection and protection, it's merely an algorithm to blend data from available sensors.

digitalentity avatar Aug 09 '16 07:08 digitalentity

If large difference between receiving from gps and predicting form EKF,program will move the data from gps.Maybe I'm wrong.

Linjieqiang avatar Aug 09 '16 07:08 Linjieqiang

It's not the EKF itself, it's a supporting code logic that does the detection.

digitalentity avatar Aug 09 '16 08:08 digitalentity

Oh.Sorry.It's my wrong.

Linjieqiang avatar Aug 09 '16 09:08 Linjieqiang

Today I had a situation when at pos hold mode my hexacopter rapidly started to fly away. Not sure whether it was caused by loosing some sats or... Anyway maybe it would be a good idea either to take an average of 2-3 readings or ignore for pos hold mode position change grater than... (say 10cm/sample depending on model speed from the previous cycle/ significant sat.num loss)?

xdigyx avatar Aug 10 '16 20:08 xdigyx

GPS glitches are very rare, my report was a once a year occurrence, for a frequent flyer. Your problem is more likely symptomatic of mag interference. Have you verified that the mag works perfectly at all throttle settings?

stronnag avatar Aug 10 '16 20:08 stronnag

Not sure what's telling you it's mag problem. If it was, then I believe the model would make slowly bigger and bigger circles, but it would not rapidly fly away. Do you agree? Although I have used pos hold max for 1h, it happened only once till now, apart this time pos hold works great. Unfortunately I had no BBox enabled...

xdigyx avatar Aug 11 '16 05:08 xdigyx

Hard to diagnose w/o logs. Circles happen when heading is slightly wrong (up to maybe 30 deg) - this result in quad moving in slightly wrong direction. Bigger error will result in quad going in significantly wrong direction and a case of fly away.

digitalentity avatar Aug 11 '16 06:08 digitalentity

There were no circles (for sure if it were then I would see it every time when using pos hold for a while). But there was just sudden pitch inclination increase by approx 30 deg. Now I know how to enable onboard dataflash bbox, so hope to catch it next time.

xdigyx avatar Aug 11 '16 07:08 xdigyx

It's either a magnetic anomaly or compass failure, or real GPS glitch. If compass wiring is not good the sporadic bug in connectivity to compass chip may cause the chip to freeze and give out same heading over and over again. Please also check the wiring to the compass.

digitalentity avatar Aug 11 '16 07:08 digitalentity

#453

digitalentity avatar Aug 11 '16 07:08 digitalentity

I am using onboard compass, so no wiring, can try to threat it with hot air but low chance. The FC is shielded (50x50mm 35um Cu PCB) from the bottom and grounded.

xdigyx avatar Aug 11 '16 07:08 xdigyx

@xdigyx shielding like that would not block magnetic field from power cables. It might shield oscillating magnetic field, but frequency would have to be > 100kHz. Interference from power cables is almost not oscillating, grounded Cu PCB or even full Faraday cage is ineffective. The only solution is to move power cables from battery/ESC further away from FC and (better option) use external magnetometer on a mast

DzikuVx avatar Aug 11 '16 07:08 DzikuVx

Got your point, I was not thinking about this as the yaw heading reads were changing only 1-3deg depending on THR level. Firstly I will try to catch the event with blackbox to see what's the root cause and maybe discuss what can be done to avoid such situation . Then I will use an external mag.

xdigyx avatar Aug 11 '16 07:08 xdigyx