Help with GPS glitch. POS differes from GPS, but GPS is correct

Hey guys. I’ve been looking at this log for a few hours now and I can’t figure it out. I’m pretty new to ardupilot, so I would really appreciate any help that someone might be able to give me.

I’m having pretty regular GPS glitches that only happen within a few seconds of takeoff. It doesn’t happen 100% of the time, but it does happen often. Sometimes I just get the warning and I can hardly tell, and other times my quad will pull pretty hard in a random direction and I have to take over in stabilize pretty quickly. I’ve been looking through my log files and after really studying my last flight, I believe that the GPS data was correct during the glitch. But the POS.LAT and POS.LNG are gradually diverging from the GPS values and then eventually snap back after EKF primary changes to zero. Shortly after that the glitch is cleared.

Here is part of my log:

It’s pretty clear to me that POS.LAT is wrong here. Is there anything I can do to help prevent this from happening? Initially I was working towards shielding my GPS, changing it to a better quality one, and making sure it’s placement was good. But after plotting my flight in google earth and looking at the log, the GPS data is what looks correct. So I think my problem is somewhere else.

Attached is my log file. The glitch actually happens twice here. The one at the beginning launch didn’t affect my flight much. The one at the end was much worse though.

Thanks for the help

I think you also have a compass problem.
Can you run the Auto Analysis tool from Mission Planner and post the results?

Here are the results. You are right that my compass is not looking too good. I have struggled with that compass a lot honestly. I’ve changed it out to new ones, moved it to all different location on the quad, and re calibrated many times. Do you think this is the cause of my GPS glitch?

Log File C:\Users\Windows 10\AppData\Local\Temp\tmpAABA.tmp.log
Size (kb) 30892.13671875
No of lines 361974
Duration 0:54:12
Vehicletype ArduCopter
Firmware Version V3.5.5
Firmware Hash 27229c83
Hardware Type 
Free Mem 0
Skipped Lines 0
Test: Autotune = UNKNOWN - No ATUN log data
Test: Brownout = GOOD - 
Test: Compass = FAIL - FAIL: Large compass offset params (X:-552.26, Y:-214.72, Z:-605.36)
FAIL: Large compass offset in MAG data (X:-552.00, Y:-214.00, Z:-605.00)
Large change in mag_field (121.45%)
Max mag field length (961.53) > recommended (550.00)

Test: Dupe Log Data = GOOD - 
Test: Empty = GOOD - 
Test: Event/Failsafe = FAIL - ERRs found: FENCE GPS_GLITCH 
Test: GPS = UNKNOWN - join() takes exactly one argument (2 given)
Test: IMU Mismatch = GOOD - (Mismatch: 0.29, WARN: 0.75, FAIL: 1.50)
Test: Motor Balance = GOOD - Motor channel averages = [1436, 1437, 1451, 1449]
Average motor output = 1443
Difference between min and max motor averages = 15
Test: NaNs = GOOD - 
Test: OpticalFlow = FAIL - FAIL: no optical flow data

Test: Parameters = FAIL - 'THR_MIN' not found
Test: PM = GOOD - 
Test: Pitch/Roll = GOOD - 
Test: Thrust = GOOD - 
Test: VCC = WARN - VCC min/max diff 0.377051v, should be <0.3v

Debug the compass errors first.
(I bet you will not get any GPS related errors when resolved the compass issues, but we will see…)

Can you post a picture of your setup?
Compass1 (531977) and 2 (658953) are equally “bad”.
Compass3 (460042) is much worse! I would not activate that one at the moment.

Suggestion 1:
Do compass to current calibration, when you are certain that your current readings are well calibrated.

Suggestion 2:
Move your first compass to an area with low magnetic interference. << I would highly recommend that option.

Thanks for the insight. I’ll post some pictures tomorrow when I have my quad with me.

I have really struggled with the compass since I’ve started with this. I’m using a mrobotics pixracer and I’ve tried two of their external gps/compasses. I have a few of each and have tried them all.

https://store.mrobotics.io/product-p/mro-ugps-samm8q-01.htm

https://store.mrobotics.io/product-p/gps001-mr.htm

I’ll try relocating the external compass tomorrow, but I’m pretty sure I’ve tried moving it all over, and I’m pretty sure I even tried calibrating a pixracer and gps that were screwed together with plastic standoff’s that were not even connected to a quad and got similar results. I’ve done this indoors and outdoors. Is this pretty abnormal?

I’ve sent an email to mrobotics on Friday afternoon. Maybe they will have a suggestion, but I haven’t heard from them yet.

What kind of craft do you have? Do you mind telling me what type of compass you use and what typical offsets you see?

Compass offsets are most likely okay! Especially, when you did the calibration without your drone and achieved similar values.

Large change in mag_field (121.45%)

That concerns me! This is because of a dependence between current and compass reading.

Thanks again. I did install another GPS/compass (holybro), and it is getting much lower offsets (around 100). Still not as low as i see most people have, but it’s much better. I also calibrated with the motors, and that caused me to see the need to move the GPS up another 0.9 inch. Now it is a total of 2.1 inches above the ESC. It seems a little excessive, but I get much better results.

I did still get a GPS glitch today, but I think it might be an actual gps issue where the GPS.alt jumped about 5 meters while the quad was hovering. I’ll report back if find anything else tomorrow.

Hi,

@JeremyG - I think I am experiencing the same problem you did with the GPS glitches.
GPS looks fine and there is a jump in the POS.

I just asked about it in a different post - GPS glitches - what can be the reason?

Have you solved your problem?
Please let me know if you have any clue that could help…