Exteranl Compass Issues

Hello,
When I first got the Pixhawk I tried all functions and they worked perfectly. I don’t recall what FW rev. it was but it was about 2 months ago that I initially tested the PH. Now I am getting ready to install on a platform, so I thought I would bench test again. I connected an external compass, the same one that was originally working and it doesn’t seem to get recognized. Or if it does, it doesn’t function. Then I erased, re-loaded FW and reset a couple of times and things started working.
I did a compass test in the CLI Screen. I don’t recall getting question marks in the past. Now I get the attached screen shot with two external compasses shown with question marks.
Can anyone explain what is “normal” and why there are now issues?
Thank you,
Steven
PS I also am seeing warnings on nan in the compass config settings.

I see the same thing, too… In addition, in the Flight Data Screen I get changing compass heading when I move the external compass and also get a changing heading when moving the pixhawk… Not good. Magnetic effects on the z axis is very high at 180…

FW 3.1.2
pixhawk

Hi Steven and Sandy,
The two ‘external’ reports are due to a printing bug in the init() function for the PX4 compass. It is harmless, but I’ve pushed a fix for it.
The ‘??’ is because the report_compass() function in setup.pde hadn’t been updated to report PX4 as a compass type. I’ve also pushed a fix for that.
Sandy, the heading changes when you move the Pixhawk because the heading is a function of both attitude and compass readings. You can’t actually get a heading from a 3D magnetometer without knowing your attitude (roll and pitch) as well. It is quite a complex bit of maths to combine the attitude with the magnetic vector to get a heading - if you are curious have a look at calculate_heading() in libraries/AP_Compass/Compass.cpp starting on line 195.
So when your roll/pitch changes the heading is also affected. That is quite normal.
Cheers, Tridge

Hi Tridge,
Thanks for the response. I have some questions that may be on other people’s minds, now or in the future.
When one mounts the external compass, does it matter if it is slightly tilted? Maybe 10-20 degrees along the N/S axis? The best place to mount mine would be on a angled part of the air frame.
Thanks,
Steven

It can be tilted but definitely do a compass calibration because that also calibrates roll and pitch.

Thanks. I did do a 15 degree angle install of the compass and calibrated. It seems to work fine, HOWEVER, I get far too many Bad Compass Health warnings. As far as I can tell, all is working fine. Is there a bug in the MP software or the Plane FW? Btw, the offsets are all below 75.
Steven

No. Those are real issues being reported.