Compasses are completely useless, used to work

I’ve flown the same Pixhawk + GPS and external compass setup for years. I moved it to a new wing and updated to the latest Arduplane version a couple days ago. The old version was a NuttX version so… it’s from awhile ago.

The Pixhawk is mounted with the arrow facing the back of the plane, “Yaw 180”. GPS/compass puck facing forward, “normal”. The puck is tilted up at about 30 degrees on the wing. The same issues were happening with the puck sitting on the fuselage right behind the Pixhawk, at “Yaw 180” as well.

The stabilization works, the GPS works, the wing flies well. It will loiter and RTH. The left and right elevons are properly assigned. I had to reverse my pitch stick input for some reason - I’m not sure if this is part of the problem, if “yaw 180” is not correct? The transmitter sends a low value when I pull back on the stick, high value when I push forward.

It’s very hard to arm unless I disable the compass check due to throwing “compass variance”, and the compass values sent back to my ground station are garbage.

I’ve calibrated the compasses many times, it always succeeds. I even tried the old style calibration and the graphs filled in properly. Yet compass variance grows from a low value pointing south to over 2 pointing north, then back to a low value pointing south. The heading value sometimes works, then takes on an offset and doesn’t come back to a true heading.

If I disable one of the compasses, it’s worse. The external compass will randomly reorient - for example, it is working fine pointing south and reading 180. I turn the plane to face north. It turns fine to 0 degrees - then suddenly flips to 180 and throws “compass variance”. Now it is 180 degrees out until I turn it back south, when it suddenly will flip back to 180. Is something trying to detect the orientation and changing it?

The internal compass is broken in a different way. If I unplug the external compass, the internal compass works perfectly - until I power cycle the autopilot. Then it starts up with a random offset. However, rotating it works properly and it will make a full circle and come back to the original value - except for the offset which wrecks everything.

I’m getting sick of flipping and twisting around a 6’ wing in my office attached to my computer with a long USB cable! Any ideas on what has gone wrong?

If youre calibrating the compass inside your office, that means it must have concrete or other magnetic structure nearby. Tried calibrating outside? Maybe use a radio instead of a cable while calibrating a large wing?

Well, it’s my home office in a wooden structure. I’ve calibrated the same system in the office before, on a plane that had removable wings and was much easier to swing around.

I switched my groundstation to simply using FrSky passthrough telemetry on a Taranis, partly to simplify my field setup and partly because my 900MHz radios interfered with my 900MHz LRS control system. So I currently cannot run calibration via radio unless there is a way to trigger it with an RC channel.

Calibrating outside is a good idea though and I see this firmware includes COMPASS_LEARN which I have never tried. It’s not in the standard setup procedures, but does it work well? It looks like it correlates compass data with GPS motion, so it should be able to calibrate to a global reference which is better than doing the wing dance with two questionable compasses.

it only learns offsets, not diagonals or off-diagonals for elliptical corrections, so it is not suitable for vehicles where the field may be badly enough distorted that it can’t be represented reasonably as a sphere

I’m wondering if I should take my external compass off the wing and put it back on the power pod/fuselage so that it’s not tilted at all. Is this the kind of “diagonals” mentioned here or could that tilt be compensated for as a simple offset?

This problem was resolved by taking the compass off the wing and placing it level with the Pixhawk on the fuselage facing forwards. Normal orientation. I’m not sure why it didn’t work on the fuselage at Yaw 180. I did not try COMPASS_LEARN.

The only issue now is that it is sitting right over the ESC and throws compass variance at full throttle. Not really a problem and I might be able to calibrate it out.

It appears that ArduPlane is not capable of calibrating a compass that is tilted by 20-30 degrees as mounted on a wing.