I’m running V3.4-rc4 on a BBBMINI. I have both an external compass (HMC5843) and a compass on the MPU9250 inertial sensor (AK8963). The software automatically names the HMC5843 as Compass 1, and the AK8963 as Compass 2.
Several months ago (on an earlier build), I had a few flights where the HMC5843 stopped functioning, and the AK8963 automatically showed up as Compass 1. The problem is that it then had the wrong offsets, and more importantly, had the wrong orientation. (The HMC5843 has orientation ROTATION_ROLL_180, and the AK8963 has orientation ROTATION_NONE). This causes some erratic behavior, especially in Loiter mode.
My external compass seems to be functioning again, and I would rather not replace it unless it starts happening again. I would prefer the AK8963 appeared as Compass 1, so if the HMC5843 disappears again, then the Compass 1 configuration is still good.
Is there any way I can do this? I’ve included a screenshot of my setup, if anyone has suggestions on how to change it.
Hi there. So I’ve had similar things happen with a Pixhawk long ago and it led to us putting quite a bit of time into ensuring that when the compasses move around, that we correctly recognise this and throw up a pre-arm check warning that the compass calibration needs to be done.
I’ve had a peek at our Linux drivers and it looks to me like they also have this feature. The arming checks were certainly on right?
It’s possible to set the primary compass but as far as I know it’s not possible to set the order. Normally the external compass appears as the lowest number and is used by default.
In AP_Compass the IDs are per-backend on Linux, not per sensor. However if you have different compasses like you do (AK8963 and HMC5883) it should detect changes. As @rmackay9 said, could you check you don’t have arming checks off?
Thank you Randy and Lucas.
The problem I had with switching compasses was something I encountered 7 months ago on an earlier build. In fact, I had posted a topic about it over on diydrones: http://diydrones.com/forum/topics/need-tips-troubleshooting-ekf-errors-log-file-attached.
It is a relief to hear that the current builds will recognize when a compass moves around and refuses to arm. I don’t know if this was true for the prior build I was on, but it is also very possible that I had disabled the compass pre-arm check at that time.
I’ve finally built up the courage to reenable my external compass. The offsets on my internal compass move around a lot, which may have something to do with a number of wires close to the sensor. My current post was to ensure that I didn’t get a recurrence of this problem.
So as I understand, the software knows which sensor is which, and will detect if, for example, the AK8963 has moved from compass 2 to compass 1. That at least gives me some peace of mind that this problem won’t occur again, and I’ll make sure the compass pre-arm check stays enabled.