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

Compass error demonstration

But the one you trust is the compass and not the DG. The Mavic trusts the compass and not the IMU, and adjusts the IMU to match the compass.

Yes - in the implementation in the M2 firmware, that appears to be the case, at least at takeoff. My guess is that it would not behave that way later in flight - at least that's not how I would program it.
 
Yes - in the implementation in the M2 firmware, that appears to be the case, at least at takeoff. My guess is that it would not behave that way later in flight - at least that's not how I would program it.

Did some more experiments today. Seems like the Mavic Pros redundant compasses were more trouble than they were worth.

When the M2 first came out, I was aghast by the fact that they devolved into using a single compass. Well, the engineers probably had so many calls from tech support from customers not being able to calibrate the compasses on the Mavic Pro line, they had to find a better way. As you had mentioned before, heaven knows how many drones were lost, and then the pilots asked DJI to cover the damage if it seemed to have been caused by compass error and deemed a factory defect. Poor DJI, they couldnt have predicted that by trying to make the drone safer, they actually made it more unsafe.

Back to my point. It seems that you have figured out the Davinci Code that the M2 compass needs to be recalibrated after 50km or 30 days. Where did those obtuse requirements come from, I guess we dont know, but those are the facts from what you have determined.

The results of my test today with customers drones was as follows:

6 drones test flown. (3) M2, (2) MP, (1) Spark, (1) Air

M2 - both M2 compasses needed to be calibrated. Maybe because the drones came in and had not been started since their last flight which was hundreds of miles away

M2 - no error message; local customer

MP - both gave compass error messages from the same spot the local M2 passed.

Spark - no error

Air - no error

After calibrating the 2 out-of-town customers M2s, they did not give off an error message when taking off from the same spot the MP's errored.

After repairing scores of M2's already, I just never realized that their compasses need to be calibrated if they came from out of town. In the past, I went and calibrated them because it wouldnt let me spool the props unless I did. But after that calibration, they will take off from a spot where the MP said there was interference.

Funny to me how the mid range Mavic Pro line, with dual compasses, is more likely to sense interference and be affected by it than the Mavic 2 with a single compass, and also the Air and the Spark.

Do you remember the early model Mavics that had problems with the rear motor wires causing compass interference?
 
Last edited:
Did some more experiments today. Seems like the Mavic Pros redundant compasses were more trouble than they were worth.

When the M2 first came out, I was aghast by the fact that they devolved into using a single compass. Well, the engineers probably had so many calls from tech support from customers not being able to calibrate the compasses on the Mavic Pro line, they had to find a better way. As you had mentioned before, heaven knows how many drones were lost, and then the pilots asked DJI to cover the damage if it seemed to have been caused by compass error and deemed a factory defect. Poor DJI, they couldnt have predicted that by trying to make the drone safer, they actually made it more unsafe.

Back to my point. It seems that you have figured out the Davinci Code that the M2 compass needs to be recalibrated after 50km or 30 days. Where did those obtuse requirements come from, I guess we dont know, but those are the facts from what you have determined.

The results of my test today with customers drones was as follows:

6 drones test flown. (3) M2, (2) MP, (1) Spark, (1) Air

M2 - both M2 compasses needed to be calibrated. Maybe because the drones came in and had not been started since their last flight which was hundreds of miles away

M2 - no error message; local customer

MP - both gave compass error messages from the same spot the local M2 passed.

Spark - no error

Air - no error

After calibrating the 2 out-of-town customers M2s, they did not give off an error message when taking off from the same spot the MP's errored.

After repairing scores of M2's already, I just never realized that their compasses need to be calibrated if they came from out of town. In the past, I went and calibrated them because it wouldnt let me spool the props unless I did. But after that calibration, they will take off from a spot where the MP said there was interference.

Funny to me how the mid range Mavic Pro line, with dual compasses, is more likely to sense interference and be affected by it than the Mavic 2 with a single compass, and also the Air and the Spark.

Do you remember the early model Mavics that had problems with the rear motor wires causing compass interference?

Those are good supporting data. I actually don't think that the MP compasses themselves were any worse or more of a problem - the big difference is just how the MP vs the M2P handle compass errors after takeoff.
 
Great info. Thanks! To make sure I captured the essence as it pertains to my situation... let me ask a dumb question: when I am about to fly, I always calibrate the compass if it asks me to do so. And if the calibration fails, I do it again, or move to a different place, until the 'calibrate compass' message goes away. Am I safe then, or are there situations when that would not be enough?
 
With compass errors arising from magnetic interference one of the major causes of problems, I thought it might be useful to show a controlled demonstration of how that works.

To recap, when the aircraft is powered up the compass (3-axis magnetometer) reading is used to initialized the IMU yaw value, after which the rate gyros are the primary source of rotation data that are used to update the IMU yaw value. The compass data are only used for low-gain (gradual) corrections for drift and bias in the rate gyro data. As a result, it's important that the IMU yaw is correctly initialized for the FC to know the direction that the aircraft is facing. If the yaw value is substantially incorrect then the FC will apply inappropriate corrections to try to hold position.

In this test, shown in the graph below, I used a small, rare-earth magnet to reverse the magnetic field at the M2P compass (it has only one), so that the compass measured the aircraft heading as north when it was really facing south. The magnet was just a few inches from the aircraft. On power up, the IMU yaw was incorrectly initialized at -46 seconds as approximately north, as expected. At -38 seconds I removed the magnet and, with the spurious magnetic field removed, the compass correctly changed to south. That would normally happen naturally as the aircraft took off and left the (small) area of magnetic interference.

At zero seconds I started the motors to generate a txt log file and establish which IMU was active. The txt OSD_yaw value is identical to the IMU1 yaw value, confirming IMU1 was active.

Note that although the compass and IMU yaw values disagree by around 180°, the IMU yaw value is held steady - that's because the rate gyros haven't detected any rotation. The aircraft reports a compass error but doesn't attempt to resolve the problem. At 33 seconds I rotated the aircraft to face north, as shown correctly by the compass. The rate gyros also detect the 180° rotation and, as a result change the yaw value by that amount to approximately south, even though it's now facing north.


View attachment 73554

As you might expect, this kind of discrepancy would cause serious problems in any of the P modes, such as P-GPS. If, for example, when the aircraft was facing south but the IMU yaw value was north, the aircraft started to drift south due to a north wind, the FC will attempt to bring it back north. But since the IMU thinks the aircraft is facing north, it will do that by applying forward thrust (negative pitch). Since the aircraft is really facing south, negative pitch will actually push it further south. The FC will respond with more negative pitch, leading to uncontrolled flight to the south.

I'm going to repeat this test with an actual takeoff, but that requires a large flat field so that I can switch the aircraft to ATTI mode once it starts to fly off without worrying about obstacles. I'll post the results of that later. In case anyone else is tempted to try this, do not attempt unless you have ATTI mode programmed as one of the mode switch positions for when the flight goes bad.
A very good explanation. Nice job!. There is no need to demonstrate it and risk something happening to your M2P though. Plenty of people have already done that. Just look for the posts beginning with "Well.....I lost my quad today."
 
With compass errors arising from magnetic interference one of the major causes of problems, I thought it might be useful to show a controlled demonstration of how that works.

To recap, when the aircraft is powered up the compass (3-axis magnetometer) reading is used to initialized the IMU yaw value, after which the rate gyros are the primary source of rotation data that are used to update the IMU yaw value. The compass data are only used for low-gain (gradual) corrections for drift and bias in the rate gyro data. As a result, it's important that the IMU yaw is correctly initialized for the FC to know the direction that the aircraft is facing. If the yaw value is substantially incorrect then the FC will apply inappropriate corrections to try to hold position.

In this test, shown in the graph below, I used a small, rare-earth magnet to reverse the magnetic field at the M2P compass (it has only one), so that the compass measured the aircraft heading as north when it was really facing south. The magnet was just a few inches from the aircraft. On power up, the IMU yaw was incorrectly initialized at -46 seconds as approximately north, as expected. At -38 seconds I removed the magnet and, with the spurious magnetic field removed, the compass correctly changed to south. That would normally happen naturally as the aircraft took off and left the (small) area of magnetic interference.

At zero seconds I started the motors to generate a txt log file and establish which IMU was active. The txt OSD_yaw value is identical to the IMU1 yaw value, confirming IMU1 was active.

Note that although the compass and IMU yaw values disagree by around 180°, the IMU yaw value is held steady - that's because the rate gyros haven't detected any rotation. The aircraft reports a compass error but doesn't attempt to resolve the problem. At 33 seconds I rotated the aircraft to face north, as shown correctly by the compass. The rate gyros also detect the 180° rotation and, as a result change the yaw value by that amount to approximately south, even though it's now facing north.


View attachment 73554

As you might expect, this kind of discrepancy would cause serious problems in any of the P modes, such as P-GPS. If, for example, when the aircraft was facing south but the IMU yaw value was north, the aircraft started to drift south due to a north wind, the FC will attempt to bring it back north. But since the IMU thinks the aircraft is facing north, it will do that by applying forward thrust (negative pitch). Since the aircraft is really facing south, negative pitch will actually push it further south. The FC will respond with more negative pitch, leading to uncontrolled flight to the south.

I'm going to repeat this test with an actual takeoff, but that requires a large flat field so that I can switch the aircraft to ATTI mode once it starts to fly off without worrying about obstacles. I'll post the results of that later. In case anyone else is tempted to try this, do not attempt unless you have ATTI mode programmed as one of the mode switch positions for when the flight goes bad.
Good little science experiment and most likely will shed some light on some pilot's. "Fly aways". Thank you for this very informative experiment.
 
With compass errors arising from magnetic interference one of the major causes of problems, I thought it might be useful to show a controlled demonstration of how that works.
@sar104 , Sar, any chance you could post this on Phantom Pilots as well?
It's great info many there could benefit from. Outstanding job!
 
My real world experience is this: flying on a basalt volcano (lightning strikes strongly magnetize this rock), I calibrated, flew, and recovered at a site about 20 m from the top of a ridge. Packed up the drone and moved up the ridge to fly again but did not calibrate at the new site - bad decision! Right away on launch, I realized that my Mavic pro was moving about 60 degrees from my intended path. Fortunately, it was only 5 m away and close to the proper altitude. By experimenting, I was able to fly it back to my location and hand recover it. After calibration, it behaved normally.

Flying from the summits and ridges of "cinder cone" volcanoes, I occasionally cannot calibrate the compass because of "strong magnetic interference." I've never had to move more than 10 m to find a place
 
  • Like
Reactions: sar104
Experienced a compass error the other day while just getting ready to film some motocross racing - I took off from near the radio tower (radio station was transmitting from the race) and immediately got the compass error - saw that the drone was drifting well with the wind so I immediately headed up to 75 meters - walked to an open area and carefully brought it back - landed - reassessed and moved about 300 yards from the tower - rest of the day went well with no issues.
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
 
  • Like
Reactions: Tweeter
Great read @sar104 , I have on my preflight checklist to go to Settings>Advanced Settings>Sensor State>Check IMU and Compass.

I've never had a disruption on my flights so no idea on how it looks when there a magnetic interference in place (other than expect a red line of some sort), would you be so kind to show us a screenshot of what it looks like when the magnet is near?
 
My real world experience is this: flying on a basalt volcano (lightning strikes strongly magnetize this rock), I calibrated, flew, and recovered at a site about 20 m from the top of a ridge. Packed up the drone and moved up the ridge to fly again but did not calibrate at the new site - bad decision! Right away on launch, I realized that my Mavic pro was moving about 60 degrees from my intended path. Fortunately, it was only 5 m away and close to the proper altitude. By experimenting, I was able to fly it back to my location and hand recover it. After calibration, it behaved normally.

Flying from the summits and ridges of "cinder cone" volcanoes, I occasionally cannot calibrate the compass because of "strong magnetic interference." I've never had to move more than 10 m to find a place
Calibrating (or not calibrating) at the launch site won't have any effect. Calibration compensates for the magnetic properties of the AC. It doesn't and can't compensate for any magnetic effects external to the AC.

I suspect the second launch site was geomagnetically distorted and that caused the erratic flight. Geomagnetic distortions can be small - an inch or two is not uncommon.
 
@sar104 , Sar, any chance you could post this on Phantom Pilots as well?
It's great info many there could benefit from. Outstanding job!

I could post it there but it might confuse people, since none of the Phantom range of aircraft behaves like the Mavic 2 when confronted with a yaw/compass error after takeoff. I had originally intended this to illustrate the problem as it applied to all DJI equipment but, in the process, I realized that DJI changed the firmware and the Mavic 2 is different.
 
My real world experience is this: flying on a basalt volcano (lightning strikes strongly magnetize this rock), I calibrated, flew, and recovered at a site about 20 m from the top of a ridge. Packed up the drone and moved up the ridge to fly again but did not calibrate at the new site - bad decision! Right away on launch, I realized that my Mavic pro was moving about 60 degrees from my intended path. Fortunately, it was only 5 m away and close to the proper altitude. By experimenting, I was able to fly it back to my location and hand recover it. After calibration, it behaved normally.

Flying from the summits and ridges of "cinder cone" volcanoes, I occasionally cannot calibrate the compass because of "strong magnetic interference." I've never had to move more than 10 m to find a place

Fascinating - I had not realized that basalt could be magnetized by lightning.
 
A very good explanation. Nice job!. There is no need to demonstrate it and risk something happening to your M2P though. Plenty of people have already done that. Just look for the posts beginning with "Well.....I lost my quad today."

Too late - already demonstrated, although bear in mind that I have ATTI mode available on the mode switch in case of problems.
 
Excellent experiment and explanation. Between my house and the barn - where I usually launch - there is a buried electrical cable that brings electricity from the circuit box in the barn to the house. I've noticed that to get NO magnetic interference warnings, I need to launch at least fifteen feet on the far side of that cable, preferably more.
 
  • Like
Reactions: FoxhallGH
I've noticed that throughout all my flights with MP this past week, the mag error in the log is about -12. In some of the posts in this thread I've seen reference to that being down to 'geoDeclination'. I'm not familiar with that term - is that same as the local magnetic variance - the isogonic line on a sectional - which is 12 degrees east in SoCal?
 
Great read @sar104 , I have on my preflight checklist to go to Settings>Advanced Settings>Sensor State>Check IMU and Compass.

I've never had a disruption on my flights so no idea on how it looks when there a magnetic interference in place (other than expect a red line of some sort), would you be so kind to show us a screenshot of what it looks like when the magnet is near?

Changing the magnetic field in the vicinity of the aircraft doesn't necessarily
I've noticed that throughout all my flights with MP this past week, the mag error in the log is about -12. In some of the posts in this thread I've seen reference to that being down to 'geoDeclination'. I'm not familiar with that term - is that same as the local magnetic variance - the isogonic line on a sectional - which is 12 degrees east in SoCal?

What's "mag error"?

Declination and variation are the same thing - the difference between magnetic north and true north.
 
Changing the magnetic field in the vicinity of the aircraft doesn't necessarily


What's "mag error"?

Declination and variation are the same thing - the difference between magnetic north and true north.

I was referring to the IMU_ATTI(0):Yaw-magYaw field. Thanks, all makes sense now.
 

DJI Drone Deals

New Threads

Forum statistics

Threads
134,560
Messages
1,596,272
Members
163,062
Latest member
rstegner
Want to Remove this Ad? Simply login or create a free account