The compass....misunderstood or easy scapegoat?

Flying over buildings that have large motors in the aircon units may also result in a large compass deviation and crash due to the resultant change in the local magnetic field that it can't cope with.
This part sounds unlikely. The strength of a magnetic field diminishes considerably with distance.
How close are you thinking someone might fly to aircond units on top of buildings?
If you are close enough to be affected by the magnetic field, you're much too close to the building anyway.
At normal safe distances, if there is any magnetic effect, it would be slight and you would fly through it before you even noticed a problem.
 
The compass not only provides horizontal direction data but also vertical direction data.
Not horizontal and vertical direction, but azimuth and elevation to one-degree. Vertical direction is measured by the barometric altimeter module to 0.03hPa (0.25m). Vertical motion is detected by the accelerometer in the IMU. The IMU also contains a three-axis gyro that provides position data.

According to the NAZA specs, this is all you need to maintain position. There's no mention at all about a compass. The firmware in the MC might use the elevation data from the compass to supplement the gyro in the IMU, but it doesn't appear in the specs. The main purpose of the compass is to navigate between waypoints. I really don't see how a bad compass calibration can possibly cause a fly-away.
 
The NAZA and NAZA Lite controllers are sold with and without the GPS module for the F450 and other multirotors. The Gps module contains the compass. If you purchase the controller without the GPS, there is no compass. The Flight controller works fine without it. It does not need the compass to remain level.
The only thing you lose is Return to Home, Intelligent Orientation Control and position hold. As I understand it, in attitude mode, the compass is used for Course Lock but the quad still flies in ATTI mode without one.
If you leave the compass dangling by the wire or rotate it on the leg, that certainly would confuse the flight controller. If you just unplug the cable from the NAZA, it will fly just fine.
If the compass is giving a gravity vector to the flight controller that is very different than the leveling info from the IMU, then the NAZA should ignore the compass data and fly in ATTI mode without it. As an engineer and programmer, I see this as a bug or poor design in the firmware.
 
This part sounds unlikely. The strength of a magnetic field diminishes considerably with distance.
How close are you thinking someone might fly to aircond units on top of buildings?
If you are close enough to be affected by the magnetic field, you're much too close to the building anyway.
At normal safe distances, if there is any magnetic effect, it would be slight and you would fly through it before you even noticed a problem.

Mostly true but there is an influence from buildings on the mag. Here are two flights, one a typical suburban flight and the other about as urban as you can get (flying between two buildings). The fluctuation is all within limits and only manifests itself in slight variations (+/- 10 degrees) of heading. It makes flying down the centerline of the street a little tricky but there's no TBE or other real threats (EDIT: other than evil sparrows).

suburb-mag.jpg



city-mag.jpg


If the compass is giving a gravity vector to the flight controller that is very different than the leveling info from the IMU, then the NAZA should ignore the compass data and fly in ATTI mode without it. As an engineer and programmer, I see this as a bug or poor design in the firmware.

How does it know which one is right? The problem with single source IMU and compass is it only takes one of them to be wrong. And there's really no easy way to know which is right. EDIT: I just realized this is what Inspire does. It dumps to ATTI when it suspects compass problems. However, it dumps to ATTI too often. It's not very accurate from what I've read.

And yes, Naza can fly without the compass, ATTI only. 6DOF vs. 9DOF. I've never flown it that way so can't remark on differences to stability. I would guess the majority of people opt for the compass / GPS.

And Steve, DJI docs are scant at best. I wouldn't expect them to provide a detailed description of how they achieve their sensor fusion.
 
Last edited:
1. Most people have no idea how the compass actually works or what calibration does.
2. Not only is it possible for the compass to cause your bird to fly out-of-control, it is the number one cause of out-of-control flight.
3. Compass calibration does not cause flyaways. If you don't follow the recommendations and calibrate incorrectly, you could experience what appears to be a flyaway.
4. Avoiding calibration when the recommendations are to calibrate can lead to less accurate flight and possibly TBE.

EDIT: I keep reposting this link:

Compass Calibration, A Complete Primer
http://www.phantompilots.com/threads/compass-calibration-a-complete-primer.32829/

Not much discussion concerning the gyro's function here.
  • gyro inputs (i.e.. pitch/roll)
  • 12. Gyro repeater
  • 13. Gyro Error in Navigation
    • Causes of Error
    • Friction
    • Ship’s Motion
    • Electronic Malfunctions
    • Power Fluctuations.
    A gyro compass is an electronic/mechanical device with inherent error…. the key is knowing the error and adjusting for it
  • 14. Gyro Error in Navigation
    • Determination of Error
    • Visual Range ( The most accurate ).
    • Adjusting Three LOP’s (triangulation). Used before getting underway.
    • Comparing a “PGC” bearing with a known true bearing.
    • Celestial Azimuths and Amplitudes.
    • Comparison with a Gyro of known error.
Gyro compass deviations are different than magnetic and need to be compensated for in relative heading vs. PGS (per gyro compass). I guess this has me trying to figure out if the loss are obstruction of the gyro would lead to quad flying on true heading w/o compensating for error. If I lose a gyro on board a vessel I have to do a simple compensation formula to get my true heading. Can I assume that DJI's units are doing this automatically, of course deviation is different depending on local. I totally agree that compass does not cause fly aways but could indeed cause bird to fly off in the wrong direction.

Gyro Failure
In the event of gyro failure LOP’s are taken in relative bearings. The magnetic compass can be used to know your ship’s head. Rel. Bearing+Mag. Ship’s Head=Mag. Bearing Then the magnetic heading can be converted to true bearing.


I have found on board Navy vessels (as a sub contractor) that a gyro repeater placed too close to the compass can cause variable deviations as can many other things. As an example here's a short list of other electrical items if placed to close to the compass can cause variable deviations:

Electric motors
Magnetic controllers
Non-married conductors
Loudspeakers
Electric indicators
Electric welding
Large power circuits

And here is a short list of magnetic items that can cause deviations if placed to close to the compass:

Movable guns or weapon loads
Magnetic cargo
Hoisting booms
Cable reels
Metal doors in wheelhouse
Chart table drawers
Movable gyro repeater
Windows and ports
Signal pistols racked near compass
Sound powered telephones
Magnetic wheel or rudder mechanism
Knives or tools near binnacle
Watches, wrist bands, spectacle frames
Hat grommets, belt buckles, metal pencils
Heating of smoke stack or exhaust pipes
Landing craft

My PV2+ has arrived at home and I can't wait to get off this boat and open that thing up for a looksie! One more week to go!!!

Time_To_Get_Busy_-_no_caption.png
 
  • Like
Reactions: dirkclod
In my simplistic brain, I thought a compass would orient mostly to the north no matter if it was on the right side of the quad or on the left side. Also it should point north whether the compass was tilted or not. So when I got the taller legs for more gimbal clearance, I haphazardly attached my compass to my leg in a "new, better" spot on another leg. Boy was that a mistake!!! Hani eventually had to repair my gimbal after that crash.
 
I tried taking off yesterday from a different location without re-calibrating the compass (I'd forgotten to do the dance). As soon as I took off, the phantom assumed a pitch up / back attitude & started moving backwards pretty quickly. I was able to correct this with the right stick & bring it back to me to catch. Then I performed the calibration and this problem disappeared.

Does the 'compass dance' perform more than one calibration, compass and internal accelerometer?
 
I have read many 'fly away' posts blaming a faulty or uncalibrated compass as the cause.

But what does the compass actually perform for us in the Phantom.

I am under the impression that the compass only provides azimuth data that keeps the aircraft pointed in a particular direction, whether its hovering or moving horizontally, until the operator yaws it in another direction.

Having used GPS in the desert for 20 years, I have noted that just before navigating to a waypoint, I have to travel a short distance before the GPS knows my motorcycle's azimuth or orientation. The GPS can't tell the azimuth of the aircraft in a hover, until the craft has moved horizontally over the earth for a short distance.

HL is a good example of this in action. In HL, the orientation or azimuth of the aircraft is ignored and the GPS uses its data to bring the craft back to home point.

So, IMO, blaming the compass on a 'fly away' is incorrect. Maybe those that know the workings of the NAZA controller and compass can chime in and help explain.

So after reading all of this thread I conclude that no one really knows what the compass does or indeed how the Phantom flies at all. I propose that the whole system operates using magic and that the NAZA is a magical device and even DJI doesn't understand how it works. Much like most modern technology. My magic theory is easy to explain "IT'S MAGIC" whereas everyone else s theories are complicated and need a physics degree to understand.

I am going out now to fly my magic quadcopter.
 
  • Like
Reactions: Pilot11six
So after reading all of this thread I conclude that no one really knows what the compass does or indeed how the Phantom flies at all. I propose that the whole system operates using magic and that the NAZA is a magical device and even DJI doesn't understand how it works. Much like most modern technology. My magic theory is easy to explain "IT'S MAGIC" whereas everyone else s theories are complicated and need a physics degree to understand.

I am going out now to fly my magic quadcopter.


when I was akid am radio was the norm.

along came that thing called FM radio , stereo and awesome sounding....
it stood for : F..ing Magic

yea thats a plan get out and fly.
I agree I am more amazed how well they work vs the issues....
 
when I was akid am radio was the norm.

along came that thing called FM radio , stereo and awesome sounding....
it stood for : F..ing Magic

yea thats a plan get out and fly.
I agree I am more amazed how well they work vs the issues....
Had to have that FM converter just under my 8Track player :cool:
 
I had a flyaway recently. Well, I presume it was a flyaway before it crashed onto the roof of a building.

I calibrated the compass, as I do with every takeoff, got the green flashing lights and was good to go. I took off and flew over to this interestingly painted ferry boat in the river. Up to this point everything was fine and stable.

Then as I flew over the boat I got a 'compass calibration required' message and the bird was uncontrollable instantly. I seemed to have a very very small influence on height/throttle but nothing. As I was trying to get it higher it flew in one direction at quite some speed completely pass me for a good 300ft until it crashed into a building.

Funnily enough all data was wiped from my SD card too. What was this down to? The bird looked like it wasn't going to stop and I was lucky it hit a building if I'm being honest. I put this down to compass but I welcome other diagnostics
 
Info on compass:
What is compass for?
Compass calibration is important to safe, controlled flight. It compensates for changing background magnetic "noise", a.k.a. magnetic inclination and deviation (not to be confused with declination). Inclination and deviation that isn't corrected through compass calibration will cause inconsistencies between GPS and compass that can result in "toilet bowl effect", a swirling motion that can cause the Phantom to fly out of control.

What is Magnetic Inclination and Deviation?
Magnetic deviation is a horizontal variation that comes from the Phantom itself and the equipment you have installed on it as well as the magnetic makeup of the area you are flying in (again not to be confused with declination). Sometimes the deviation will be insignificant, but other times it can be big enough to cause you to lose control. Inclination is a vertical magnetic variation that shifts depending on where you are.

Warning Signs
The Phantom can detect when the compass is providing extremely poor (implausible) data. This typically occurs if you place it near a strong magnetic field or do not calibrate it properly. It will flash red and yellow lights and will not start the motors when this happens. Unfortunately, it can only detect this in extreme conditions and you can still fly with really bad compass data if you're not careful.

Another important safeguard is the compass mod value. This is the total magnetic field as measured by the sensor. You can check this with the Phantom Assistant software. According to DJI, it should be above 750 and below 2,250 but ideally it should be between 1,000 and 1,700. Between 1,200 to 1,500 is very good. Check it away from magnetic influences. If it reads very high or very low, check it again in a different location. If it is still off, it could be magnetized and need degaussing or it could be damaged.

What Does Calibration Actually Do?
Calibration measures the magnetic fingerprint of the surrounding area. By turning the compass 360 degrees, the Phantom can see where the compass reading doesn't smoothly increase or decrease. It uses this information to build an adaption table so that when the Phantom turns during flight, the reading is smooth and linear.

When Should I Calibrate?
You do not need to calibrate before every flight and in some cases you definitely should not calibrate. That doesn't mean you shouldn't ever bother doing it. It only takes one time for it to go very wrong. The most important aspect of compass calibration is making sure the magnetic "noise" around your Phantom is consistent between calibration and during flight.
  • DO Calibrate
    • If you go to a new location that is a good distance (i.e. >100 miles) from the last place you calibrated the compass.
    • If the terrain has changed significantly i.e. going from prairie to mountainous.
    • If you change any equipment on your Phantom.
    • If you just installed new firmware.
    • If you just degaussed your compass (BTW, don't degauss unless you are absolutely positively sure you need to).
    • If you have taken all the precautions to make sure there are no localized magnetic fields near you.
  • DO NOT Calibrate
    • If you're in an urban area surrounded by concrete, buildings, and hidden or overhead power lines / pipes / etc.
    • If you're on the beach or on a boat.
    • If you're in immediate proximity to metallic objects or anything magnetic.
  • Pre-Calibration Checklist
    • Everything used in flight should be powered up during calibration, e.g. GoPro, tracker, etc.
    • Remove all metal from within 5 - 10ft radius, e.g. watch, phone, belt buckles, coins, controller, etc.
    • Calibrate on grass or dirt and not on concrete, asphalt, in or on a building or structure.
    • Calibrate on a level surface if possible
 
  • Like
Reactions: cjmwales
Thanks for that. But that doesn't explain why it lost calibration whilst in the air after a successful calibration
 
I have a P3A and wanted to be able to retrieve the magnetometer data for a flight. Back when a lot of fly aways were happening I was looking for a way to determine if there was a compass problem that could be seen by looking at the flight logs. I'm also interested in the tilted horizon problem some people are having. Towards this end I reverse engineered the DJIFlightRecordXXX.txt file format. But, I determined that the magnetometer data doesn't exist in these files.

So now I'm reverse engineering the FLYXXX.DAT file format. I've run into some issues that some of the posters in this thread might find interesting and/or be able to help me with. The FLYXXX.DAT file is divided into segments of different types. There seems to be a clock that runs at 600 hZ. At each clock tick various segment types get written to the file. The problem I'm facing is that would seem that data in one segment type gets "fused" into the data in another segment type. I'm trying to unravel that.

One segment type (SegType207) contains the accelerometer, gyroscope, barometric altimeter, gps info(lat, long, altitude, num satellites). There is some velocity info as well, It also has a quaternion that is the P3's attitude. But, there doesn't seem to be any info in this segment type about the magnetometer. This segment type runs at 200 hZ.

There is another segment type (SegType44) that runs at 50 hZ that I suspect has the magnetometer data. It's just not presented similar to the display seen in the GO app. There are 3 numbers that are roll, pitch and yaw (The roll and pitch are opposite in sign to the birds orientation). There are 4 more numbers that are a quaternion that come very close to representing the aforementioned roll, pitch and yaw numbers. I suspect this quaternion represents the P3's attitude as determined by the magnetometer data. I tried to verify this experimentally by turning on the P3, letting it sit for 5 seconds and then turning it 90 degrees and sit for another 5 seconds. The values in this segment type changed accordingly. But, the problem is that so did the values in the other segment type. I suspect that this segment type gets "fused" into the other segment type. I'm going to try the same experiment in ATTI mode and see if that "unfuses" these two segment types.

There may be quaternions in other segment types. It's easy enough to find them; I just haven't done it yet.

If any of you follow all this and have any suggestions I'd be interested to hear them. If you don't follow this I'm sure my explanation could be better; so please ask questions.
 
I have a P3A and wanted to be able to retrieve the magnetometer data for a flight. Back when a lot of fly aways were happening I was looking for a way to determine if there was a compass problem that could be seen by looking at the flight logs. I'm also interested in the tilted horizon problem some people are having. Towards this end I reverse engineered the DJIFlightRecordXXX.txt file format. But, I determined that the magnetometer data doesn't exist in these files.

So now I'm reverse engineering the FLYXXX.DAT file format. I've run into some issues that some of the posters in this thread might find interesting and/or be able to help me with. The FLYXXX.DAT file is divided into segments of different types. There seems to be a clock that runs at 600 hZ. At each clock tick various segment types get written to the file. The problem I'm facing is that would seem that data in one segment type gets "fused" into the data in another segment type. I'm trying to unravel that.

One segment type (SegType207) contains the accelerometer, gyroscope, barometric altimeter, gps info(lat, long, altitude, num satellites). There is some velocity info as well, It also has a quaternion that is the P3's attitude. But, there doesn't seem to be any info in this segment type about the magnetometer. This segment type runs at 200 hZ.

There is another segment type (SegType44) that runs at 50 hZ that I suspect has the magnetometer data. It's just not presented similar to the display seen in the GO app. There are 3 numbers that are roll, pitch and yaw (The roll and pitch are opposite in sign to the birds orientation). There are 4 more numbers that are a quaternion that come very close to representing the aforementioned roll, pitch and yaw numbers. I suspect this quaternion represents the P3's attitude as determined by the magnetometer data. I tried to verify this experimentally by turning on the P3, letting it sit for 5 seconds and then turning it 90 degrees and sit for another 5 seconds. The values in this segment type changed accordingly. But, the problem is that so did the values in the other segment type. I suspect that this segment type gets "fused" into the other segment type. I'm going to try the same experiment in ATTI mode and see if that "unfuses" these two segment types.

There may be quaternions in other segment types. It's easy enough to find them; I just haven't done it yet.

If any of you follow all this and have any suggestions I'd be interested to hear them. If you don't follow this I'm sure my explanation could be better; so please ask questions.
On the off chance anybody is looking at this I've figured it out. I know how to get the raw magnetometer data in the FLYXXX.DAT file now.
 
Is it similar to this or has it be reformatted as the P3 is no longer a Naza 'proper' FC?

http://www.rcgroups.com/forums/showthread.php?t=2071772
Thanks. Overall helpful information. If I'd known about this link some of the reverse engineering would've been easier.

Same basic idea; some things identical, some completely different. The FLYXXX.DAT format has many more what I call segment types (called IDs in that post).

The particular segment type that contains the raw magnetometer data is similar to this
http://www.rcgroups.com/forums/showpost.php?p=27398674&postcount=12

I've been looking at another segment type that might be similar to the ID containing the motor info
http://www.rcgroups.com/forums/showpost.php?p=27419984&postcount=15
At least knowing this info will make it easier to find the proper segment type.

I'll check into it.
 
Bud, this is good information. Some sites have decoded the FLY*.DAT files but they haven't shared the data structure which is annoying. I'd like to get it out into the public where it belongs.

Suggest you should start a new thread and share some of the findings. I have worked a lot with pawelsky's libraries. Have a look at the A2 library as that may shed more light. P3 is more similar to the A2 than the NAZA.

http://www.rcgroups.com/forums/showpost.php?p=30774154&postcount=549
 

Members online

Forum statistics

Threads
143,066
Messages
1,467,358
Members
104,936
Latest member
hirehackers