EKF ground mag anomaly - has anyone heard of it?

Hi everyone!

I just had 2 brand new Y6 builds hit the ground the exact same way. Both boards flew great in X4 config a month ago but now both hit the ground in 60 seconds after ARM.
I went thru all 3 logs but for the life of me, I cannot ID any root cause.
Copter_1-flight_1: started acting strange at mode change from STAB to ALThold, copter starts acting strange and crashes gently.
Copter_1-flight_2: takeoff in ALThold flies nice for 30 sec then starts twitching right looses orientation and crashes hard.
Copter_2- flight_1 (all components are different, even the batteries): 30 seconds after takeoff starts twitching to the left then complete loss of orientation and it hits the ground upside down.

257.BIN (960.8 KB)
73.BIN (3.0 MB)
74.BIN (3.9 MB)

OK, hold on to your hats this is huge!!!
Has anyone ever heard the error: “EKF ground mag anomaly”? That is the reason why both copters went nuts and crashed.
This is the first time I am flying at this site so I had no idea, but after rebuilding Copter_2 I went out to the old site and the copter flew perfect for 10 minutes. then I went to the new site and same Copter_2, same batteries, crashed again.
Then I heard the error message: EKF ground mag anomaly.

From the crash behavior I had the impression that it was magnetic origin, but I never thought that the ground is at fault and not me.

personal note:
Finally I was a able to prove that I am not completely stupid! I am so HAPPY!!!
Now back to rebuilding Copter_1

This do not lead automatically to a crash .
It might be that you have a combination of poor compass and low Pid on Yaw.
Anyway if you calibrate on each site the Compass you should avoid that error message.

Check Yaw Pid , if you have still the default value it might be too low.

The PIDs were default which is definitely not ideal.
Copter_1 is a 1000mm Y6 with 17" prop Copter_2 is a 3DR X8 modified to Y6.
Both had the COMPASS_LEARN=1 so it should have learned the changes.
I have flown at 10m from iron and steel structures, into 60-100W transmitters and around 400 KiloVolt power lines.
I have never heard this error before.
How can I check if the compass learn is working or not?

You can easily see if offsets are changing looking in Mission Planner Compass values before moving to another location where the offsett are supposed to change.

Knowing if the new offsetts are good or not I guess is almost impossible, for this reason I personally prefer to do a new calibration if teh doubt arise.

The “mag anomaly” warn IMO do not make alone your copter to crash .
It appears quite often with 3.4.5 on my copters but never crashed.

You can see abrupt changes in the EKF2 magnetic values just prior to the incident.
This initiates an EKF2 IMU0 in-flight yaw alignment at the point your flyaway starts.

These sort of magnetic events seem to an issue at the moment.
I am currently trying to track down my own version of this.

Just to let you know that you are not alone in this Ground Mag Anomaly problem.

This is from a test flight
Pixhawk2.1 using internal Mags which are getting too much interference (I have been removing all external stuff looking for a processor reboot problem)
As you see I got the same messages which happened when I moved the Loiter position horizontally by 5m and the copter immediately went into toilet bowling.
The Compasses had just been calibrated before this.

Thanks Mike!
Do you have some high voltage cables or steel structure at the flying site?

Not so much !

Mike,
Did you have the same issues at 3.3.x?
I had the sae control stack (PH+GPS+etc) with 3.3.x and never had this message.

No, I had this copter flying well on 3.3 but we have it fitted with an RTK multi frequency GPS and I have been chasing problems with the SBF GPS implementation for a while so have had to keep upgrading.

There is a compass problem in here somewhere!
Last test flight with ‘Learn offsets’ turned on, the toilet bowling started and then it settled down until it stopped completely.
Loiter looked good, holding a tight position.

However

Push forward on the stick and the copter moved forward, PLUS 30deg to the left.
Same with all stick movement, 30deg divergence.

Was also getting multiple switches between mags which was causing a yaw twitch.
Obviously I have one of the 2 external mags misaligned.
Todays project.

I just updated a copter from 3.3.3 to 3.4.6, and had several of the ground mag anomaly and yaw realignment messages today. Had never seen them before today.
No flight problems, though. I’ll look at my logs when I get some time and see if things start to go crazy like they did for you guys.

So what is the diagnosis is for this issue? Is it also hardware dependent or only external environment based?

I think in my case it is working properly and related to environment…
I can place a compass on the ground in various places in my yard and the needle doesn’t point north. And I’ve always had magnetometer calibration issues around my home.
So, I think I’m arming and my compass points north-east due to whatever is under the ground here. Then after I’m up off the ground it readjusts and north points north.

Guys, did anyone go back to 3.3?
I am really contemplating that solution. I have more than 10 hous of flight and I cannot get it to fly level in windy conditions.
In PosHold it holds up to the wind for a while compensates well, holds the postion than it does a “toilet bowling” like movement (approx 1 circle) than it goes back to doing it s job and PosHold in the wind.
Also no relation to “toilet bowling” but it has several "EKF2 IMU in-flight yaw alignment complete " messages.

Any more clues?

I had several problems with compass and different drones in the last 2 years .
Sometimes I spend days to obtain a good working compass.

In my experience these problems were never connected to the firmware version (from 3.3 to 3.5.4 ) but to the hardware.

Defective I2C port , bad compass sensor, noisy power supply .

My secret weapon to understand and solve compass problems with Arducopter is the Zubax GPS that have an excellent compass on CAN bus.
Eliminating the I2C bus makes more easy to understand where is the problem.

I also keep a working external compass on I2C bus after a compass integrated on a M8N Gps was found defective.

2 Likes

I bumped into the same error, seems it has to do with the magnetic field in the hangar. I tried using a compass, but its just not facing towards the actual North from time to time. I was thinking this by solving this through the magnet declination through by adjusting the magnetic declination manually by changing the COMPASS_DEC param in Mission Planner. I don’t know if this will work, but I will let you know if it makes any difference.

1 Like

Hi, I’m having the same issues! Did it work??

Had the same issue on a location I was taking off on almost a daily basis and still does, so it could not have been a “real” problem. In my case I re flashed the rover and than copter, loaded the parameters and did all calibrations.
The problem was gone.