Inconsistent compass

I’ve just downloaded the 3.3 beta firmware due to the horrible flight characteristics I experienced after having done an autotune on 3.2.1.
The thing flew very well to start with, but I then landed and tried to take off again. The telemetry on my android then kept telling me that the compass was inconsistent and would not allow arming.
The GPS and external compass is a Neo 6H and used to work fine on APM 2.6 with no inconsistencies…
I have a Neo 7M which I have now fitted and done a recalibration of both the accerometer and the compass.
Maybe the Neo 6H is faulty…? any ideas?
Best DP.

I had the same issue about an hour ago. 3.3rc8 on a pixhawk. Compass is a M8n. Same conditions, take off, land, take off then yaw seems messed up and it spun around. I neglected to insert the SD card so no dataflash but here’s the telemetry log

The inconsistent compass message means that the internal and external compasses are not pointing in the same direction. In general this means that either the orientation of the compass is incorrect or, more likely, that there’s a lot of interference on one of the compasses. Perhaps calibrating it again will help. Worst case you can disable the internal compass by setting COMPASS_USE2 to zero.

In the new missionplanner, the EKF realtime screen shows the compass bar rises, and sometimes goes into the orange. Could it be a poor calibration? Its a larger craft (880mm) and I have trouble rotating it smoothly and a perfect circle (probably more like an oval). Should I try turning on compass learn? I guess the other possibility could be EMI from the 6s power-distribution board about 2" below. Any idea on how I could tell if its a bad calibration or EMI? Thanks for your help Randy. And thank you for the time the developers such as yourself have put in over the years, amazing work.

1 Like

Derek,
So there are two separate although related issues here. The inconsistent compass message is because the vehicle’s arming checks have found the internal and external compasses aren’t pointing in the same direction. They’re off by at least 30degrees. It’s probably because of lots of metal near the internal compass. You can try calibrating it but if that doesn’t clear it up you may need to just disable the internal compass (COMPASS_USE2 = 0).

The EKF’s compass variance is because the primary compass’s (usually the external one) vector isn’t moving consistently with the other sensors (ie. accelerometers and gyroscopes). This can be a temporary thing - for example if you plug in the vehicle while it’s on a car roof, the moment you move the vehicle away from the car the EKF will complain. If it’s more permanent, for example if it always climbs when you rotate the vehicle in a relatively metal-free environment then there may not be much that you can do about it. As long as the EKF compass variance doesn’t go into the red (i.e. > 0.8) then it’s probably ok. If it’s going red then we should check the COMPASS_ORIENT parameter matches the compass’s orientation. Another compass calibration in a metal free environment may help. Finally I’d probably ask you to try the new experimental compass calibration that includes “scaling” (current calibration only does “offsets”).

Could that inconsistent compass be caused by clicking the auto-declinination after doing the live calibration? I may have done that (can’t remember for sure). Thinking back I also might have entered a manual declination after doing the live calibration.

That makes sense about the metal.

One thing I noticed looking at the logs, the compass EKF bar stays near the bottom while the craft is pointed south (the direction it was pointed when it was armed), but when the craft started coming back towards me (pointed north), the EKF went up quite a bit. There’s no way that could be the declination or calibration? Has to be metal interfering?

No, I don’t think messing with the declination settings would cause the problems you’re describing. That merely tells the system which way is north, but the problem you’re having is more basic than that, it’s detecting a problem with the way the vector is moving.

Randy: could not the compass EKF going bad in flight have to do with mag field changing in flight due to current through the power wiring? That would cause the mag field to move around, and may be upsetting the EKF? Doing CompassMot procedure may help?

Thank you for your help Rob. Reading more on mags I understand now what the offsets are. My system is a 6s drawing about 15amps at hover, so perhaps that could be part of the issue. The Pixhawk has some separation above the power distribution board (with several capacitors).

i.imgur.com/4zSkxtE.jpg?1
i.imgur.com/iXfWF4u.jpg?1

The yaw seems to change for a while after the vehicle stops

[youtube]6F3dwCGyX3A[/youtube]

Offsets on the internal are x=332, y=-237, z=200

This graph is from last night. I attempted to take off twice but the craft flipped both times(separate issue which I’m working on). What I would like to draw your attention to is the change in mag. The whole log time before the crash is me slowly moving the throttle up, and the jumps in the graph are when the craft started tipping (to which I backed off the throttle momentarily). It seems to show the power system affecting the internal mag but not external.

And here’s another Pixhawk that I just got

youtube.com/watch?v=4X9FmDlHJ-Y

Is the internal compass

  1. Junk?
  2. Affected by the other things nearby on the Pixhawk board?
  3. Affected by the usb or computers in the room?
1 Like

Forgot to mention that video is with the internal compass disabled, compass learn disabled and did the compass dance over again.

The first video I mean :slight_smile:

Derek,
The video is “private” but in any case, it’s very possible that the power wires near the flight controller cause interference on the internal compass especially when the throttle is raised. If the interference is very bad it’s possible that it will trigger the compass-consistency pre-arm check to fail.
All you can do is:

  1. somehow move the power wires further from the flight controller.
  2. run compassmot on the vehicle
  3. disable the internal compass by setting COMPASS_USE2 to 0

Hi Derek,

How did you plot the Mag x,y,z values from different magnetometers? (Internal and external)

Was this done in Mission Planner? What is procedure to obtain this plot?

Do you know how to do the same in QGroundControl?

I Derek, How did you solve this issue, although it is late just to ask if you still remember