Pixhawk does not use external compass

We are using a Pixhawk 2.4.8 with a 3DR compass. Mission Planner will not register that we are using an external compass. It uses an external GPS to locate the boat, but uses the compass from the Pixhawk. We tried modifying the compass settings:

I’m no expert but did you try these settings?
How about checking your COMPASS_ params in MP?
COMPASS

Maybe you can tell me how you calibrated your compasses?

Hello,

Thank you for replying.

When we suspected that the Pixhawk was using its internal compass, we disabled all compasses and individually went through Compass #1, Compass #2, and Compass #3. In all compass settings, only the Pixhawk compass was detected.
These are our compass parameters:
COMPASS_EXTERNAL: 1
COMPASS_EXTERN2: 0
COMPASS_EXTERN3: 0
COMPASS_USE: 1
COMPASS_USE2: 0
COMPASS_USE3: 0
COMPASS_ORIENT: 0
COMPASS_ORIENT2: 0
COMPASS_ORIENT3: 0

Mission Planner no longer has live calibration, only onboard calibration. When we started the onboard calibration, nothing happened.

I’m having the same issue with “calibration required” error message. How do I calibrate?

Xistrik,

I think it is most likely a hardware issue (compass is broken or wires are not connected correctly) rather than a configuration issue I think.

Can I ask how you know the external compass isn’t working? The heading is derived from the gyros, compass and GPS (if the vehicle is moving) so it’s not always possible to be sure just by looking at the heading displayed in the ground station. A more direct method is to look at the raw sensor output. If you’re using the Mission Planner, these can be seen by going to the Flight Data screen’s status tab (bottom left) and then check the mx, my, mz and magfield values. There are equivalent fields for the 2nd and 3rd compass as well (if present).

Hello,

We know the external compass does not work because when we rotate it, the boat icon does not move. However, when we rotate the pixhawk, the boat icon will orient accordingly.
We will try looking at the raw sensor output.

This compass problem is actually part of a larger issue. When we set up waypoints for a mission, the boat will not turn off when it has reached its last waypoint, and we think that one of the reasons why could be a compass or GPS malfunction.

xistrik,

OK, so as mentioned above, rotating just the external compass may not lead to the vehicle rotating on the ground station because the EKF will notice that the gyro and compass don’t match and reject the compass.

I’m happy to have a look at the 2nd problem if you can post a dataflash log. I guess you’re finding the vehicle is not switching to Hold mode when it reaches the last waypoint?

Hello rmackay9,

Most recent log: http://www.mediafire.com/file/40x89lqu16k1n7k/7_3_2018.BIN
We are new to Pixhawk, so we are unsure as to how to analyze the data.

Thanks,
Xistrik

Xistrik,

It looks like it is using the external compass because the COMPASS_EXTERNAL=1 and COMPASS_DEV_ID=466441.

I see the COMPASS_ORIENT=8 though which is “Roll180” meaning the compass is upside-down from the default. That was a good setting for the really old (now unsupported) APM boards but with the Pixhawk and most modern GPS/compass units this parameter should be left at the default of “0”.

By the way, I see the ARMING_CHECK parameter is set to “0” meaning all checks are off. I understand that the inability to arm is annoying but the arming checks should normally be left on (i.e. ARMING_CHECK=1) and then it’s best to work through the issues stopping arming instead of disabling the checks.

In this case, I wouldn’t be surprised to hear that the arming was failing with an “Inconsistent Compass”. This message was warning the user that the internal and external compasses were pointing in different directions.

Anyway, hope this helps and I’m here to help with any problems you hit from here on…

Hi rmackay9,

After a lot of fiddling and restarting Mission Planner, the software was able to recognize the external compass. However, the compass readings are inaccurate, and we are unable to do an onboard calibration. We press “Start,” but even when we move the Pixhawk and external compass, we do not see green bars. On an older Mission Planner build, we performed a live calibration, but the compass is still inaccurate.
Any ideas?

Thanks,
xistrik

@xistrik,

It sounds most like a hardware issue to me so it might be best to double check the wiring but if it’s still not better, perhaps considering getting a new GPS/compass module.

This could be helpful, if you have not noticed: I have noticed is that if compasses are disabled when you power on the Pixhawk, they will not start working when you enable them. The mx, my, mz, mx2, my2, mz2 values on the status tab will stay at 0. Once you cycle power (or perhaps just a reboot of Ardupilot) they show non-zero values.

I, too, have seen that an external compass would not show the calibration bars moving when I tried to calibrate. BUT, that was a month or so ago and I have changed compasses. It could be that it was a bad compass. I need to try again, as I do not have accurate compass readings. I have noticed that if the rover is facing a particular direction when it reaches a waypoint, even if the next waypoint is straight ahead, it will kick to the right or left even though it should just track right on through. If traveling in another direction, this may not happen. I believe it is caused when the rover believes its heading (as partially derived from the compass) makes it think it needs to turn. So @rmackay9, as you have told me, good compass readings are important. @xistrik , I hope you solve your problem and I look forward to learning from whatt you find.

1 Like

Kenny,

Ah, that kick you have seen is probably caused by a pivot turn bug that is now fixed in master.

I think we might push out Rover-3.4.2-rc1 for beta testing next week so you could give it a try and see if it resolves the problem.

1 Like

@rmackay9 @ktrussell
We uploaded Copter firmware to test the compass readings and we achieved a successful onboard calibration and accurate compass readings!
Perhaps there are issues with the Rover firmware?

Since we are building a boat, we will try to implement Copter firmware.

@xistrik,

Any chance you could post some dataflash logs of the copter firmware working and rover not working? It might be helpful if you’ve got tlogs from the ground station as well.

The vast majority of the compass related code is in the AP_Compass library which is used by most vehicles so it is certainly odd that it works on one but not the other. … I’d like to get to the bottom of this because personally I haven’t seen issues with compasses not working on Rover.

@rmackay9

Rover not working: http://www.mediafire.com/file/amfnq6tjzca2uxa/Rover_2018-07-17%2012-15-28.bin

Copter working: http://www.mediafire.com/file/6yf5fjr6i5k0f4e/QuadRotor_2018-07-17%2012-17-09.bin

We actually managed to calibrate the compass on Rover firmware after we uploaded the Copter firmware; however, the compass does not always calibrate, so we end up reflashing it again.