Here 2 Critical Bad Compass Error

I have two Tarot Ironman 650 Quadcopters with Pixhawk 2.1 Cube Black & Here2 GPS. One GPS is configured I2c, and the other is CAN. The link is Frsky R9M with Taranis Qx7 Transmitters. Both often report “Critical Error Compass” during flight, but the flight seems unaffected. I have tried to find any evidence of the error in the logs, but I’m not sure where to look. The MAG report looks OK to me. Can anyone see the cause of the error or point me to where it appears in the log?
Here is a link to the logs and parameters:
https://drive.google.com/drive/folders/1CMO2JI36vSbviZqCDyQvLVSt8z-lOLbT?usp=sharing

Thanks
Phil

I am far from an expert in analyzing these things but I am working through a similar issue on my own aircraft right now. It looks like your Mags start doing some weird oscillation thing during flight right when the Compass error would have first shown up.


after the fluctuations everything seems to return to where it was before except the Mag Z innovation which causes the compass error to appear. On my aircraft I believe it is due to poor compass calibration and noise from the gas generator attached to the aircraft. Comparatively here’s what my mags look like when I get the compass errors.

The smoothness of the what I will call waves in your mag readings leads me to believe you might have flown past something that is throwing off your compass in flight, maybe a tower, or something throwing off some magnetic interference. Take all that with a grain of salt because I am very new to log analysis. Similar waves happen three times in your log although after each one the behavior of the mags seem to change.

Thanks for the detailed response. I think there were at least 3 critical error compass messages during the flight. I cannot find anywhere in the log a record of telemetry messages being sent - am I missing it, or are these things simply not recorded? I have checked the connections and routing of the cable. Recalibrating the compass did not stop the messages. The Here2 is mounted to a disc on a mast ~6" above the deck with strong Velcro. It is possible to deflect the Here2 about 15 degrees by twisting it forcefully, but I can’t imagine that happening in flight. Is there a logged firmware event or decision that prompts the critical error warning? Is there any tutorial or documentation of how to interpret the log contents?
Thanks again,
Phil

I have been using the following docs to learn about log analysis, the second delves pretty deep into EKF stuff.
http://ardupilot.org/copter/docs/common-diagnosing-problems-using-logs.html?highlight=logs
http://ardupilot.org/dev/docs/extended-kalman-filter.html#extended-kalman-filter-interpreting-log-data
In terms of the error, on mission planner I get “Error compass variance” flashing up on the HUD but it does not record in the messages. If you are using a different GCS software the messages might be different. Only way I know to see the error is through replaying a .tlog.
My error shows up when the following value goes over 1.


Looking at your log it seems it should have been on the whole flight. Which GCS software do you use?

In terms of the compass physically moving I’d say there is a chance of that but the vibration of your flight controller seems pretty low, that doesnt account for the mast however.

I am using a Taranis QX7 Transmitter with Craft and Theory Flight Deck telemetry user interface. The error usually shows up shortly after takeoff. I have Compass as one of the arming requirements, so it happens in flight. I had a lot of difficulty getting the CAN Here2 working, so I thought it may be related to CAN, but my other craft with an older Here2 running I2C also has the errors.Thanks for the links on log analysis. I think the I2C craft more often shows critical GPS error as well as Compass.

I think this sudden large departure in NKF3, IMZ might be related to the Compass Critical error Warning, but I don’t see anything in the log related to it. Any ideas?

I noticed that after a substantial climb, I initiated a 360 degree slow yaw. The yaw had completed about 180 degrees of rotation when the NKF3, IMZ departure began at ~ 15:15:19.
Does that maneuver constitute "After first climb yaw reset "?

In the parameters, I had EK2_MAG_CAL = 3
(0:When flying 1:When manoeuvring 2:Never 3:After first climb yaw reset 4:Always)
The description of the EK2_MAG_CAL parameter is:
This determines when the filter will use the 3-axis magnetometer fusion model that estimates both earth and body fixed magnetic field states and when it will use a simpler magnetic heading fusion model that does not use magnetic field states. The 3-axis magnetometer fusion is only suitable for use when the external magnetic field environment is stable. EK2_MAG_CAL = 0 uses heading fusion on ground, 3-axis fusion in-flight, and is the default setting for Plane users. EK2_MAG_CAL = 1 uses 3-axis fusion only when manoeuvring. EK2_MAG_CAL = 2 uses heading fusion at all times, is recommended if the external magnetic field is varying and is the default for rovers. EK2_MAG_CAL = 3 uses heading fusion on the ground and 3-axis fusion after the first in-air field and yaw reset has completed, and is the default for copters. EK2_MAG_CAL = 4 uses 3-axis fusion at all times. NOTE : Use of simple heading magnetometer fusion makes vehicle compass calibration and alignment errors harder for the EKF to detect which reduces the sensitivity of the Copter EKF failsafe algorithm. NOTE: The fusion mode can be forced to 2 for specific EKF cores using the EK2_MAG_MASK parameter.

It could be something related to the EK2_MAG_CAL = 3. I know my aircraft starts displaying the compass error usually after it completes a turn as well. I think that just has to do with the compass misbehaving where EKF thinks it should be pointed a certain direction but the sensor disagrees and then as the aircraft continues to spin around the disparity between the two continues to climb. That is more of a guess as to what happens than an actual answer.
At this point I would suggest flying around on different values for EK2_MAG_CAL just to see what happens. values of 4 and 2 seem like the best to try first, just keep in mind those notes at the end of your last post.

Thanks for the confirmation. I will experiment with EK2_MAG_CAL values. Is this just an annoying alarm, or does it seriously affect flight safety?

I have yet to see any of my aircraft fall out of the sky or seriously misbehave due to EKF or compass issues, however I am hesitant to call it safe. If the flight controller is reporting an error message there is usually a good reason for it.

Hello, I’m experiencing the same on my quad. During a hover test on a new quad setup 5kg MTOW, in stabilize mode, copter was stable and steady for 5 mins. As I started to yaw, after about 120 degree yaw, the copter performed an Uncommanded yaw of 120degree approximately. I landed it immediately. Copter goes out it control when switched to RTL. I see yaw reset and EKF switching 0-1 constantly. Was it any better after changing the EK2_MAG_CAL parameter?

Thank you!

Hi. I am flying 2 Tarot Ironman650 airframes with Cube Black APs. One has I2C and the other CAN Compass. Whatever was causing the Compass Error no longer seems to be a problem. We now have over 40hrs on the CAN Compass bird with no problem. I am attaching the param file as I am not sure what really fixed the problem.Phil’s Quad 1-18-2020a.zip (5.1 KB)