DJI Mavic, Air and Mini Drones
Friendly, Helpful & Knowledgeable Community
Join Us Now

A short explanation of compass function, calibration and errors.

From a practical sense do you think a launch from the top story of this car park would be ok? Steel & concrete

E94E028C-4CCF-4124-88DA-E5ACD44B221B.jpeg
 
From a practical sense do you think a launch from the top story of this car park would be ok? Steel & concrete

View attachment 124683
Launch or take-off or anything else that imply that the AC gets airborne isn't the moment when a yaw error is created due to a magnetic interfered location.

All happens in the moment when the AC gets powered on ... and the compass is close enough to magnetic interference that it's deflected & don't show correct values.

If the compass is deflected at power on ... the IMU will be initialized to the same wrong direction. From there on the IMU doesn't have correct info about the AC heading direction ... the AC might be pointing to north in reality but the IMU think's it pointing to east for instance.

When a AC in a condition like above later gets airborne & fly away from the magnetic disturbance ... the compass will start to show correct values ... but the wrong initialized IMU will not be corrected, it will still not know in which direction the AC is pointing.

Then as soon the AC needs to correct it's position due to for instance started to be affected by winds ... it will command the wrong motors in order to keep the position ... the IMU reacts to that the positional error became larger instead of smaller & again try even more forcefully to correct it's position ...& fails. This create a error loop where the positional error just becomes larger ... & the AC fly's away.

The trick you can use in a location where you suspect magnetic interference is to power on the AC in you hand & let it fully be active (live view comes up in your mobile device) in your outstretched hand ... once fully active the AC can be placed on ground.

After this you always should check that the drone icon on the map in your app is pointing equal in relation to other objects in the map as the drone does in reality ... if not the IMU have been initialized wrongly, abort launch attempt, POWER DOWN & move away, power up again and repeat.
 
Launch or take-off or anything else that imply that the AC gets airborne isn't the moment when a yaw error is created due to a magnetic interfered location.

All happens in the moment when the AC gets powered on ... and the compass is close enough to magnetic interference that it's deflected & don't show correct values.

If the compass is deflected at power on ... the IMU will be initialized to the same wrong direction. From there on the IMU doesn't have correct info about the AC heading direction ... the AC might be pointing to north in reality but the IMU think's it pointing to east for instance.

When a AC in a condition like above later gets airborne & fly away from the magnetic disturbance ... the compass will start to show correct values ... but the wrong initialized IMU will not be corrected, it will still not know in which direction the AC is pointing.

Then as soon the AC needs to correct it's position due to for instance started to be affected by winds ... it will command the wrong motors in order to keep the position ... the IMU reacts to that the positional error became larger instead of smaller & again try even more forcefully to correct it's position ...& fails. This create a error loop where the positional error just becomes larger ... & the AC fly's away.

The trick you can use in a location where you suspect magnetic interference is to power on the AC in you hand & let it fully be active (live view comes up in your mobile device) in your outstretched hand ... once fully active the AC can be placed on ground.

After this you always should check that the drone icon on the map in your app is pointing equal in relation to other objects in the map as the drone does in reality ... if not the IMU have been initialized wrongly, abort launch attempt, POWER DOWN & move away, power up again and repeat.

Thanks, great practical advice at the end too! I’ll try that thanks.
 
  • Like
Reactions: slup
Thank you. I think I will need to read this again and again to come close to getting it, but it's good to try to know.
 
  • Angry
Reactions: Hobiemark
WHOA.......TMI o_O
The most important part is:
"
  1. Check the aircraft orientation arrow on the map - it should be pointing in the same cardinal direction as the aircraft on the ground;
  2. Check the magnetometer interference values in the app - if they are low (green) then the magnetometer readings are within specification.
(1) should be regarded as an essential pre-flight check - every flight. It would cut flyaways to nearly zero. But that neither of those checks is recommended by DJI, which is rather unfortunate. If the app is going to recommend just one essential check before takeoff - it really should be the orientation arrow which is far more likely to be a problem than an incorrect home point."
 
  • Like
Reactions: cien952 and Rich QR
You write "Check the magnetometer interference values in the app - if they are low (green) then the magnetometer readings are within specification" in DjiFly, where is this image ?
 
  • Like
Reactions: djctwo
You write "Check the magnetometer interference values in the app - if they are low (green) then the magnetometer readings are within specification" in DjiFly, where is this image ?
The Fly app doesn't give details - it just shows compass status as normal or not under the "Safety" tab.
 
BACKGROUND

The aircraft compass is often misunderstood, both in terms of function and purpose, but it is important to understand what the compass measures, why, and what happens to that information.

At the most basic level the purpose of the compass is to measure the earth’s magnetic field in order to find magnetic north relative to the aircraft heading. At any point near the earth the magnetic field is a single-valued vector quantity described by field strength and direction, and the compass comprises a 3-axis magnetometer aligned with the principal axes of the aircraft (x, y, z), independently measuring the local magnetic field components parallel to those axes.

THE EARTH’S MAGNETIC FIELD

The earth's core is magnetized due mostly to rotation, with magnetic north towards the North Pole and magnetic south towards the South Pole, although the two axes are not perfectly aligned.






In magnetic terms, the earth's north pole is actually a magnetic south pole, and the south pole a magnetic north pole, and so the magnetic field lines emanate from the magnetic south pole and return to the north pole in the classic bar magnet pattern, and so at any point on the surface of the earth the magnetic field lies at an angle to the ground, (except near the equator where it is approximately horizontal) called the inclination, and points towards the magnetic north pole.

Since the magnetic north pole and the geographic north pole are not in the same place there will, in general, be an angle between the horizontal component of the magnetic field lines (that point to magnetic north) and the direction of the geographic North Pole (true north). That angle varies by location since, as you look to the north, the apparent relative positions of magnetic north and true north depend on where you are. That offset is called the declination (or variation). So if you also know the declination (you have to know it based on your location since there is no way to measure it) then you can subtract the declination angle to determine where true north is.

Back to the compass - its only job is to determine the direction of magnetic north, and to do that it measures the direction (relative to the aircraft) of the horizontal component of the local magnetic field. If the only magnetic field that it saw were the earth's field then that would be trivial, but the aircraft, itself, has a magnetic field due to internal ferromagnetic components which will, in general, change the direction of horizontal component of the field.

Luckily, magnetic fields follow the Superposition Principle, which means that if two separate magnetic fields interact, the net field vector at any location is simply the vector sum of the individual fields. So, if the magnetic field of the aircraft can be independently measured then, with the assumption that it doesn't change as the aircraft moves around, it can simply be subtracted from the total magnetic field measured by the compass to leave just the earth's magnetic field.

COMPASS CALIBRATION

Measurement of the aircraft’s internal magnetic field at the compass location (it won’t be uniform throughout the aircraft) is achieved by the calibration process since, as the aircraft is rotated, the earth's magnetic field appears to rotate while the aircraft's magnetic field stays constant. The orthogonal rotations in the calibration process allow those two fields to be separated mathematically, and the FC now has the aircraft's magnetic field (the calibration) stored. It subtracts that from the measured field in flight, takes the horizontal component of the resulting field (now assumed to be just the earth's) and thus knows its heading relative to magnetic north.

CORRECTING TO GET TRUE NORTH

However, for navigation the FC needs the aircraft heading relative to true north, since that is the basis of the coordinate system for positioning, such as latitude/longitude. To calculate that heading it has to add the local declination value. There is a common misconception that somehow the calibration process determined declination but it should be obvious that it cannot do that. The orientation of our coordinate system is arbitrary relative to magnetic north and there is no way, as I mentioned above, to figure out the difference between true north and magnetic north with a compass; you have to know the declination separately by looking it up on a map, or calculating it approximately using spherical geometry and knowing the relative positions of the true north pole, the magnetic north pole and your location or, for the most accurate results, using your location with a global model of the earth's field.

The FC does the latter - it has a stored global magnetic field model in firmware and as soon as it gets a GPS position lock on startup it computes the declination (and inclination) from the model and adds the declination to the magnetic heading from the compass. Now it has true heading. That process is documented in the DAT file.

COMPASS INTERFERENCE

Note that all this assumes that there are no other magnetic fields present - only the earth's and the aircraft's. If there are other fields due to ferromagnetic structures, large or small, then the aircraft may or may not be able to detect their presence. The FC has field strength and magnetic field inclination criteria for acceptable measured magnetic field. On the M2, and quite possibly all the models, the total field strength is expected to be in the range 1400 - 1800 µT, as documented here and shown in the graph below. But beyond that, any local field potentially just changes the apparent direction of magnetic north and, if that error is significant, leads to all the common problems after takeoff.

View attachment 104335

The relationship between compass interference values and magnetic field strength.

Those flight problems are also not obvious in their origin - many people ask why, since very local magnetic interference will go away after takeoff, the problem only manifests afterwards during flight. The answer lies in the way that the FC actually computes heading (yaw). The primary yaw sensor in flight is not the compass - it is the rate gyros - i.e. the heading is primarily tracked inertially in flight, not magnetically. The IMU heading is initialized using the compass heading, before takeoff and after the declination has been computed. Once airborne the compass is only used to correct for drift in the rate gyro data. So if, after takeoff, the magnetic interference goes away, then the compass heading will change without the IMU ever detecting rotation of the aircraft, and the IMU and compass now disagree by far more than the drift correction algorithm can handle. That's the source of all the compass and yaw errors and, since the FC now doesn't know which way it is pointing, it cannot navigate and, unless it quickly switches to ATTI mode, will fly uncontrollably if it tries because it will try to correct for course or position deviations by applying thrust in the wrong direction. That has been the cause of almost all so-called “flyaways”. Any error over 30° or so can cause flight control problems, and anything over 45° will lead to loss of control. Around 90° leads to the classic toilet-bowl flight profile, while 180° causes a simple linear accelerating flight in exactly the wrong direction.

INTERFERENCE CORRECTION

I wondered for some time why DJI didn’t add some code to notice the compass change at takeoff from a magnetically distorted site. On takeoff, as the aircraft climbs out of the local interference but the rate gyros detect no rotation, the obvious correction is simply to re-initialized the IMU heading to the new compass heading. In fact they did exactly that with the second firmware upgrade to the Mavic 2, but previous models still don’t do that. It appears that the Mini and the Mavic Air 2 might have that functionality, but not yet confirmed.

There is also the question of "bad calibrations" - can they happen? I think there are a few scenarios in which that might occur. If the user is wearing something magnetic that may make it appear to be part of the aircraft's magnetic field. Or if the magnetic field is local enough to vary as the aircraft is rotated - that might have a similar effect.

COMPASS INTERFERENCE AND CALIBRATION MESSAGES

A persistently confusing issue is the well known message at power up: “Compass error. Move the aircraft or calibrate the compass.” It’s confusing because it often isn’t even accurate; it can mean several different things, a couple of which are not errors at all:
  1. The magnetic modulus (total magnetic field strength) is outside the expected bounds (error);
  2. The magnetic inclination is incorrect for the location (error);
  3. It is more than 30 days since the last compass calibration (M2 and newer models) - not an error - a firmware trigger;
  4. The aircraft is more than 50 km (30 miles) from its previous takeoff location - not an error - a firmware trigger.
(1) and (2) may be the result of local interference, in which case calibration is unnecessary, and moving the aircraft is appropriate. Or they may be the result of a change in the magnetic field of the aircraft itself, either due to components added/removed or components becoming magnetized due to exposure to a strong external magnetic field, in which case moving won’t help and calibration is required, or possibly even demagnetization of the aircraft.

To be fair to DJI, the causes of (1) and (2) cannot easily be distinguished and so the message is reasonable, but it would be much more helpful if (3) and (4) were explicitly spelled out with a different message.

The only way to be certain about what is going on and to establish whether it is safe to fly is:
  1. Check the aircraft orientation arrow on the map - it should be pointing in the same cardinal direction as the aircraft on the ground;
  2. Check the magnetometer interference values in the app - if they are low (green) then the magnetometer readings are within specification.
(1) should be regarded as an essential pre-flight check - every flight. It would cut flyaways to nearly zero. But neither of those checks is recommended by DJI, which is rather unfortunate. If the app is going to recommend just one essential check before takeoff - it really should be the orientation arrow which is far more likely to be a problem than an incorrect home point.

If the magnetometer interference readings are high or the aircraft orientation arrow is incorrect then there is magnetic interference at the compass - either external or internal - and moving the aircraft or calibrating will be required. If the interference values are low and the arrow is correct then the message was due to (3) or (4). You can recalibrate as requested but the aircraft is good to fly, and you can actually ignore the message - it will go away on motor start, but come back on the next power up.

Of course the question still remains - why do some models request periodic recalibration? Previous models didn’t do that. Worse still, the user manuals for DJI aircraft have been completely random on the subject in the past - some recommended only calibrating when requested and some recommended calibrating when moving any significant distance. Time was not previously a stated reason. The distance recommendation led many people to assume, incorrectly, that it had something to do with compensating for magnetic declination, but of course that’s physically impossible. So it's currently unclear why this was implemented. It could be that the DJI engineers decided that transport was one common cause of exposure to magnetic fields, or that periodic calibration might help to keep the compass performing closer to nominal. There is certainly no obvious physics-based reason.
My father was a pilot and therefore I am familiar with deviation. I remember his little saying; "East is least, West is best", meaning either subtracting from compass heading in the East or adding to compass heading in the West to arrive at True North number. Being from Indiana that was never a concern because Magnetic North and True North are the same value.
 
My father was a pilot and therefore I am familiar with deviation. I remember his little saying; "East is least, West is best", meaning either subtracting from compass heading in the East or adding to compass heading in the West to arrive at True North number. Being from Indiana that was never a concern because Magnetic North and True North are the same value.
Just give the north pole a few more years to wander - then you will have a declination. At some point around 180° if the predictions are correct.
 
  • Like
Reactions: LeadSledGirl
I found this through a link on Phantom Pilots. Very good info. I always check compass values, but wasn't really diligent on confirming orientation on the map. Will be doing from now on.

As an aside, I launched my old P2 from the driveway with never an issue. First flight with a P3 and guess what. All hell broke loose and she headed toward the roof. I was able to somehow wrestle it to land. Ever after takeoffs are from a plastic stool in the grass.

Thanks for the great writeup.
 
  • Like
Reactions: sar104
I found when I was at Ilulissat in Greenland that I was getting lots of compass errors and got the recalibrate message every couple of flights.

I asked at a shop in town that sold Mavic drones and they told me it was magnetic rocks. No idea how true that might have been.
 
After reading this thread from top to bottom, and read all crash report to compass interference, it is now my standart pre-flight check:

- power on Remote, put in left hand
- power on Aircraft in my right hand,
- enter app, live view..
- wait for GPS satelites lock, enter map view
- move Aircraft by right hand (yaw move right and left) to see if compass correspond and move with and pointing same direction as the aircraft in real world.
- place aircraft in land.
- do pre-flight check part 2 (as i called it) such as, check RTH altitude, check battery health, check record resolutin, and other settings..
- if everythings oke, arm the motor, and fly..
 
****… many thanks for this technical piece. I‘ve always kind of hated when someone would say “do this and this” but not explain the reasons why, let alone the mechanics. Even if only for the 4 reasons listed for the compass calibration error, it was worth the read for that alone. But understanding the handshake that goes on between the compass and IMU, that was like teaching me to fish. Thanks man.
 
Just read this again and am beginning to grasp it.Thank you for a cogent,drone saving piece!
 
  • Like
Reactions: sar104
Good question - I need to add that to the post. I'm assuming that you mean the direction of the drone from the controller, which is a common issue. It generally has nothing to do with the aircraft compass - it's the mobile device compass that is reading incorrectly. You can check that by opening a compass app on the mobile device to see if it is reading correctly. If it isn't then it may be due to magnetic interference from the RC stick modules, or it may be a separate problem (possibly more common on iOS devices) that seems to cause it to misunderstand the orientation of the device.
I have a magnetic clip on my iphone case which I believe throws the compass off. Nearly every time I fly I have to first remove the iphone from the case and calibrate the iphone compass by twisting with short stops through the three axes of the phone. I always check that the direction on the screen matches the drone direction on the ground before flying.
 
I have a magnetic clip on my iphone case which I believe throws the compass off. Nearly every time I fly I have to first remove the iphone from the case and calibrate the iphone compass by twisting with short stops through the three axes of the phone. I always check that the direction on the screen matches the drone direction on the ground before flying.
To clarify - problems with the iPhone compass will result in an incorrect view of the location of the aircraft relative to the direction the controller is facing, but they will not cause any problems for the aircraft itself, and the aircraft orientation arrow will still be pointing in the correct direction relative to north.
 

DJI Drone Deals

New Threads

Forum statistics

Threads
130,593
Messages
1,554,201
Members
159,598
Latest member
fast54