Hi,
As the title suggests, I nearly crashed my drone following a MAG0 GROUND MAG ANOMALY, YAW-REALIGNED
warning, or more specifically, following this sequence of messages:
The setup I’m using is a nearly stock Aurelia X6 Standard with the stock Cube Orange+ as the flight controller. I swapped out the original GPS module for an RTK compatible GPS module and modified a few parameters accordingly. The new GPS mast is about 2 inches shorter than the original which was 7 inches tall. I should also mention that I performed a compass calibration with QGroundControl since I was getting a warning from the FC.
Here is the log of my last flight where I nearly avoided a crash. The log contains 2 flights. The first is a somewhat normal flight where the FC performs an in-flight yaw alignment followed by an EKF lane switch, where I temporarily lose control of the drone in Loiter mode while it performs a small spiral for a few seconds, before flying normally again. The second is the near miss where the EMERGENCY YAW RESET
messages are issued, and the drone pitches and rolls hard at full throttle before regaining control barely above ground.
After this incident, I studied my previous logs, and I saw that the MAG0 IN-FLIGHT YAW ALIGNMENT COMPLETE
messages would also appear in my flights before my GPS swap as shown in this log. I couldn’t find any logs, but I do know that even before the GPS swap, the out-of-control spiral that happens in the first flight of my previously shown near miss log would intermittently happen.
I also studied the previous log with the new RTK GPS module. We can see that the MAG0 GROUND MAG ANOMALY, YAW-REALIGNED
and MAG0 IN-FLIGHT YAW ALIGNMENT COMPLETE
messages appear. Despite no EKF lane switch or EMERGENCY YAW RESET
messages appearing, the drone still performed the uncontrollable spiral after takeoff before flying normally for the rest of the flight.
I have read through similar threads [1][2][3][4], which led me to investigate the effect of my current draw on my compasses. Here are a few samples:
Near miss with new RTK GPS:
EKF lane switch with new RTK GPS:
Normal flight with new RTK GPS:
Normal flight with original GPS:
That’s also when I realized that my external GPS compass used to be COMPASS_PRIO1_ID
, and my internal FC compass was set on COMPASS_PRIO2_ID
. So for the last graph, the internal compass is actually MAG[1]. As we can see, the internal compass is basically measuring the current draw instead of the magnetic field, while the external compass, with both the original and new GPS seems to be fairly immuned to the current draw.
After this analysis, while I am pretty sure that my issues are due to the current draw’s impact on the compass measurements, I wanted to be 100% certain that my fixes will avoid any future crash before flying this drone again.
Fixes:
- Switch
COMPASS_PRIO1_ID
andCOMPASS_PRIO2_ID
to prioritize the external compass. - Use MAGFit to get compass params using this log from 164s to 274s.
- Use offsets and current compensation to set the internal compass (Mag 1) params.
- Use offsets compensation to set the external compass (Mag 2) params.
Questions:
- After these fixes, should I still disable my internal compass?
COMPASS_USE2=Disable
- Is the
MAG0 IN-FLIGHT YAW ALIGNMENT COMPLETE
message normal? Does it have anything to do with the uncontrollable spiral? Should I setEK3_MAG_CAL
toAlways
instead ofAfter first climb yaw reset
which it is currently set to? - Should I set
FS_EKF_THRESH
toRelaxed
? - Should I take off in
AltHold
and switch toLoiter
in flight to avoid issues? - How is
COMPASS_ORIENTX
set? It seems to change by itself when I play around with theCOMPASS_PRIOX_ID
. - Why is the drone almost crashing following the
EMERGENCY YAW RESET
message? This behavior seems extremely dangerous. Even in the event of a total compass failure, couldn’t the drone simply switch toAltHold
while performing this action to avoid controllability issues? Could this behavior be related to this issue?
Thank you in advance for your help!