Testers needed for in-flight compass learning


I would like some testers for a new ArduPilot feature - in-flight compass learning.
This is a feature that was originally developed for the SkyViper quadcopter, but can work with a wide range of vehicles (planes, copters, helicopters, rovers, boats etc). It avoids the need to do a compass calibration dance, which is particularly useful for large vehicles.
The pull request is here:

I am also happy to provide pre-built binaries if you let me know in the comments below what flight controller you are using and what firmware type you want.
Some notes on how to use it:

  • you must have GPS lock for learning to work
  • to use it set COMPASS_LEARN to 3, and then reboot (to ensure EKF is reset)
  • then arm in a mode that doesn’t need GPS and fly or drive for a couple of minutes, making sure you yaw a lot to cover all compass directions. Roll and pitch is fine too, but is not required
  • for copters and helis, I suggest flying in ALT_HOLD mode
  • for planes I suggest flying in FBWA mode
  • for rovers and boats I suggest driving in MANUAL mode

When learning is complete you will see a message “CompassLearn: finished” on your GCS. It will automatically save your new offsets and you should be ready to use GPS modes.
Some other notes:

  • that this way of calibrating does not automatically learn the compass orientation, so please ensure your compass orientation is set correctly before starting.
  • learning will only start when armed. If you don’t want to actually fly then you can arm at zero throttle and just walk around with the vehicle, turning a lot, but that will lose the advantage of learning compass offsets with the motors running
  • 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
  • feel free to set your compass offsets to crazy values before starting the test. The initial values don’t matter

Please provide feedback in the form of dataflash logs in the comments below.
Thanks for testing!

Update:

I have put pre-built binaries here http://uav.tridgell.net/MagLearn/test1/
So far just CubeBlack for copter, heli, rover and plane. The binaries are against master. I have not back-ported this feature to older firmwares versions.

4 Likes

Thank you so much Tridge,

I would like to test this… please provide me with the binary for Pixhawk 2.1 cube … APM Copter 3.5.7 itzmejawad@gmail.com

great, thanks! I’ve added a link to some binaries in the post above

1 Like

Is it possible to get this for the mrobotics pixracer for arduplane, running the the most current stable chibios arduplane? If not any binary would do.

hey tridge, awesome feature, i‘d sure like to test that too! i‘m particularly interested to test on newly ported F35Lightning, using mpu9250‘s onboard mag, as this seems pretty prone to onboard mag-field interference from the nearby current shunt.
any additional suggestions regarding onboard interference compensation interactions?

i‘ll pull your code and build for that board.

cheers, basti.

sure, no problem, I’ve put Pixracer binaries in the same download site

thanks!

You can use the COMPASS_MOT_* parameters to compensate for this as well, using the in-flight calibrator will only produce a good result if the interference is fairly steady
Cheers, Tridge

I’ve now added support for ArduSub and AntennaTracker

Hi Tridge,
I could test the feature on a quadplane (?) with Pixhawk 1 (2mb) (to avoid possible “corner cases” in future :smiley: )
Is Q_Stabilize and Q_Hover and FBWA suitable ?

Rolf

yes, that will work fine
Shall I build you a binary, or would you like to build it yourself from the PR ?

Is this possible for Rover with PH2.1?

yes, please test the rover binary for CubeBlack I linked above

1 Like

A binary would be fine

LG Rolf .

I’ve added Pixhawk1 binaries at the above link
Thanks for testing!

Thanks also, flight will probably this afternoon (14 UTC)

Will try on a Pixracer Quad. What LOG value is best to gather data?

Sweet!

What design factors in a vehicle (such as a copter) influence this?

It’s working,

After VTOL launch and immediate forwardtranisition, the system reported “compass learn: finished” after completing a first “8”

COMPASS_OFS changed a little bit

Rolf

Flew on mRoPixracer 450 Quad. Messages and DF log show it worked. That log is too big to download, so did another flight., but it didn’t engage. Looking DF log after, I saw that “Compass_Learn” had been reset to “2” from the “3” in first flight. Is this normal, that after a run with “3”, it resets that Parameter to “2”? Have to go to work now so will re try later today.
Joe

Tridge, do you think you could compile plane for Omnibus F4 pro for me? I’ll try and test this weekend