← All tools

Message & Error Explainer

What an ArduPilot message means and what to do about it

Українська

The measured field does not match the Earth's field at this place

Stops itCompass

What ArduPilot says:

Once it has a position, ArduPilot looks up in a built-in world map what the Earth's magnetic field should be there, turns the first compass's reading into north, east and down using its attitude estimate, and compares. North or east off by more than ARMING_MAGTHRESH (100 milligauss by default) gives “xy diff”, with the difference and the limit. The vertical part is meant to get twice the limit (“z diff”), but in this version a slip in the code keeps that test from ever failing. The check starts only after the GPS has a fix, so arming can work indoors and fail outside.

What to do, most likely first

  1. Steel or a magnet nearby bends the field: a car, a metal table, reinforced concrete.

    CheckThe difference in the message changes as you carry the aircraft a few metres.

    FixMove into the open before arming.

  2. The calibration was made in a disturbed place, or before something magnetic was added to the aircraft.

    FixCalibrate again outdoors with everything fitted and a GPS fix, then reboot.

  3. The compass is mounted upside down or tilted, and COMPASS_ORIENT does not say so.

    CheckIn the northern hemisphere, tilting the nose down must raise the compass's X value and rolling the aircraft upside down must lower Z; in the southern hemisphere the other way round.

    FixRun the calibration with COMPASS_AUTO_ROT 2 (the default): it finds the orientation of an external compass and saves it to COMPASS_ORIENT. For a compass on the board, correct AHRS_ORIENTATION.

4.7 corrects the vertical test. A compass that arms on this version can therefore be refused after an upgrade with “z diff”: the error was there before, it was only not looked at.

Parameters to look at

ParameterWhat it is
ARMING_MAGTHRESHCompass magnetic field strength error threshold vs earth magnetic model
COMPASS_ORIENTCompass orientation
COMPASS_EXTERNALCompass is attached via an external cable
AHRS_ORIENTATIONBoard Orientation
COMPASS_AUTO_ROTAutomatically check orientation
COMPASS_SCALECompass1 scale factor
The code that sends it

PreArm: Check mag field (z diff:N.N>N)

libraries/AP_Arming/AP_Arming.cpp AP_Arming::compass_checks() · Open in ArduPilot Copter-4.7.1

PreArm: Check mag field (xy diff:N.N>N)

libraries/AP_Arming/AP_Arming.cpp AP_Arming::compass_checks() · Open in ArduPilot Copter-4.7.1

Written here for Copter 4.6. In the tool you choose your vehicle and version, see your own parameter values beside the ones named here, and drop a flight log to have every message in it explained.

Open it in the Message & Error Explainer