Internal vs external compass conflict

Very odd.

So I’m fighting my way through initial integration of the pixhawk 2.1 and after a compass calibration I realized that no matter what the compass “page” says in mission planner only the internal compass is used! I can confirm this by putting my hand on the autopilot and wiggling it and I see the compass wiggle accordingly. If I put my hand on the HERE GPS/Compass I get no such wiggle, even if I disable/enable through every possible configuration.

I’m not crazy right? The Here GPS does have a compass: HMC5983 MAG, and LIS3MDL Mag

So my question is, How do I get it to take a mag reading from the external Here GPS unit and not only from the internal pixhawk 2.1 compass?

(not crazy - this needs to be documented better).
Look for the compass bitmask parameter. That let’s you enable/disable any of them.

1 Like

What compass Device ID’s are showing in the parameter list?

There is a request for an update in mission planner that hopefully will make life a lot easier on compass setup. As it is now is a bit obscure :slight_smile:


Qplane v1.0.param (17.0 KB)

I’ve been working on this all night…made some progress with the quad plane as a whole but not this compass issue. It will fly like it is but I’m certain i’d rather understand what is going on with it before I start to depend on it :slight_smile:

Any help is very appreciated.

If you try an onboard calibration do you see 3 bars calibrating?

Compass 1-ICM20948
Compass 2- LSM303D
Compass 3-AK8963

I’ve never tried the onboard calibration, will try that soon as of now though, I’m spent. Where are these 3 compasses located physically? One in the autopilot, one in the GPS unit and where else? Why three different species?

Should be:

2 Compasses inside the Cube 2.1 (internals)
1 Compass in the Here Gps (external)

The AK8963 is on the MPU9250, the LSM303D is on FC mainboard (both internal). The ICM20948 is on the Here module isn’t it? I have an older one where this is not the case but I believe the newer ones do have it.

BTW-AFAIK the magnetometer on the ICM20948 is also an AK8963.

Is there some reason you have Yaw 270 for compass orientation? Also, just a comment. With no compass’s active you will see yaw movement (compass wiggle as you say) on the HUD when rotating the FC from the Z-axis gyro so that doesn’t really mean anything.

Disable compass 2&3 and try again.

Ok, back at it again.

I found the use compass 3 parameter and changed it from 0 to 1. If I have three compasses (two on the autopilot, one external) then I should be able to calibrate all three (I love redundancy).

The Yaw 270 was on because I was under the impression that when I checked External Compass option that it was referring to the only external compass (the Here GPS) which is mounted with the arrow pointing towards the left wing (has to be, the cables are a problem on this little creature).

I tried manually calibrating the bird three times and each time compass one (set as primary) is green, compass two is yellow and now compass three is red. No manual attempt improves this.

To further complicate things, upon successful completion of calibration (which Mission planner says it is successful) the auto check and fix option is on. WTF does that do and do I know it’s doing it?

I tried the self calibration, no go there at all. Compass 1 gets to 2%, compass 2 is 10% and compass 3 gets to 27% and it all stops. I let it run for 30 minutes.

What I’m looking for is compass one to be referencing the Here GPS magnetometer with use compass and external checked and a 270 yaw applied that puts the compass due north when I point the bird straight at my front door (verified due north). It must be green and verified by wiggling the external Here GPS module and seeing a corresponding wiggle in the HUD.

Compass 2 to be green and when primary compass is switched to compass 2 instead of the default of compass 1 then I can wiggle the autopilot and see the compass wiggle correspondingly.

If Compass 3 is also on the autopilot then I want to have the same things as compass 2.

Compass typemask is at the default value of 32 which I can only assume means “let all drivers check for their sensor” (perhaps an edit to explain 32 is a good idea?)

Anyone know what I’m doing wrong??

Found the datasheet for the ICM20948:

The compass is a AK09916, which is supported

So I see no reason why the autopilot should not be able to see all three.

So i’ve been experimenting with different combinations of options, I cannot get the compass(s) to behave as expected to any degree.

What does work:
primary set to compass1
use compass one and two checked
compass1 is external
yaw 270deg set for compass 1

It’s dead nuts on with those settings.
It survive’s multiple manual calibrations
Wiggling the Here GPS does nothing
Wiggling the autopilot (pixhawk 2.1) results in a wiggling compass heading.

I read this thread:
And I read this: 3 compasses installed - problems starting compass calibration, enumeration - missing docs - [SOLVED]

More experimentation (test1):

compass dev ID 1: 723977
compass dev ID 2: 131874
compass dev ID 3: 263178

I am unable to verify which compass corresponds to those dev ID numbers.

I used 14deg 20minutes for my declination as pulled from the provided website, pos/neg values are correct.

Turned off auto rotation correction (check and fix) it is now disabled (value = 0)

I turned off ALL drivers on compass typemask is 7167

I checked off all three of the use compass (1, 2 and 3), value for all three is now 0.

This value system makes compass calibration fail (as in you can’t even start doing a calibration) 100% of the time.

Despite this if you rotate the aircraft (the autopilot specifically) the compass on the HUD does spin so it is getting the compass heading information from somewhere with some kind of calibration values being applied or not applied.

The reported orientation is 100% correct. My bird is pointed north and that is what the HUD is showing.

Test1.param (16.9 KB)

I think the rotation you see is the ekf doing its things and using the gyro for heading. As for compasses, lets just hope the new mission planner feature comes out quickly and help people solve all this probs.

Once this feature will work it should help people a great deal in recognizing wich is wich and what is going on.

1 Like

Just run the python script. That’s all I did to define those ID’s.

And again with no compass at all the HUD will show Yaw from the z-axis gyro. Also w/o a compass it will always show pointing North on boot and then move from the gyro.

Where did you come up with 7167 as the Typemask to turn off all drivers? I get 16383 to do that. Or 8191 if you ignore the SITL compass. If you want to turn off the drivers for the compass’s you have ID’s for I think it would be 262

I’ve taken a break from this. I now understand about the gyro taking over for the compass if there is no compass available, that would explain some things that happened in the past as well.

I don’t have any python script. I’ve got to get moving on this bird, it’s been way too long already.

The script is in the link posted above.

I would simply disable compass 2&3 (3 is useless anyway, look at the offsets) and confirm your compass orientation parameter value is correct. I have several craft with 3 compass’s and none of the internal compass’s are enabled because the offsets are too high to use.

And with regards to “redundancy” I was going to offer an opinion but this one by one of the Ardupilot Dev’s says it much better:

Compass redundancy sounds great, but it doesn’t actually really work like that. Today, ArduPilot does not have a process to detect a compass that going bad, reject it, and use another one instead. That would be great, but we’re not there yet. That among other things would be great improvements on the compass handling

All it can do today is look at them both and monitor for consistency . If they become inconsistent due failure or calibration problems, it will generate an EKF error and stop using them altogether. It cannot pick one or the other. It can only tell you “hey, something is wrong with my compasses”.

As such, the more compasses you introduce, the more likely it is one will fail or get confused, and the more likely it is to cause a problem rather than solving one.

1 Like