better compass calibration procedure?

971 views
Skip to first unread message

James Li

unread,
Sep 30, 2013, 3:57:59 PM9/30/13
to drones-...@googlegroups.com
There are a few different order of steps of compass calibration which might lead to quite different result. What is generally missing is that the compass drift due to USB power is quite different from the drift due to battery connection. From what I have observed, the drift due to using battery can be as much as 5 degree away from using USB cable. I think it further leads to inaccurate compassmos calibration. 

For example, assuming calibrated ture North with USB cable is N1
when plug in the battery, with the airframe not rotating, the compass is reading N2. (this step is commonly assumed N1-N2=0.. which is not always true.)
then, calibrate compassmos with respect to N2. 
finally, when users power the copter with all the used devices,FPV gear, vtx, etc. it will result in another New Copter North N3.
it would result in a constant offset from what the true North actually is. and the offset will be roughly be c=N3-N1. 



My suggestion is to recommend users to do the compass calibration with all used equipment loaded on the copter, power all electronics which will be use in actual flight. With this calibration, N2=N1 should almost be true. The result of this given procedure, all the on board EMI will/shall be taken into account already. 



Bill Bonney

unread,
Sep 30, 2013, 8:43:05 PM9/30/13
to drones-...@googlegroups.com
It is recommended that compass calibration is done outdoors away from any other sources of interference see http://copter.ardupilot.com/wiki/ac_compasssetupupadvanced/

Randy Mackay

unread,
Sep 30, 2013, 9:14:23 PM9/30/13
to drones-...@googlegroups.com
James,

     I agree that the user should do the "live calibration" with all the equipment on the copter.

     Theoretically the usb cable attached to the APM could cause the "live calibration" (not compassmot) to be slightly off but have you tried performing the test multiple times with and without the USB cable attached to see how much of a difference it makes?  I suspect it's very small and I'd prefer to make the changes to the instructions based upon hard evidence if possible.

-Randy



From: James Li <jy0...@gmail.com>
To: drones-...@googlegroups.com
Sent: Tuesday, October 1, 2013 4:57 AM
Subject: [drones-discuss] better compass calibration procedure?

--
You received this message because you are subscribed to the Google Groups "drones-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drones-discus...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Tom Coyle

unread,
Sep 30, 2013, 9:27:18 PM9/30/13
to drones-...@googlegroups.com
@James,
 
I use the 3DR telemetry radio link during the compass calibration and come very close to the same compensation values every time. Repeatability of the compass calibration using the telemetry radio is very good in my experience.
 
Regards,
TCIII ArduRover2 Developer

James Li

unread,
Oct 1, 2013, 4:25:43 PM10/1/13
to drones-...@googlegroups.com, Randy Mackay
Randy,

It highly depends on peoples' setup. the attached is one of my older quad which has PDB right below FC. It's about 1deg~1.5degree shift. The current difference is about 400mA. One of the most significant i have seen so far is PX4. Px4 has the switch regulator almost right below mag. I have seen as much as 5-10 degree shift. Another case is observed when putting FC on TBS kind of PwrDist/Pwr Reg based center plate. 


I think the procedure I recommended above can be added as supplemental step. The users can make a justification on their own to compare USB vs ALL-UP. If the shift is significant, the calibration will be recommended to be done with everything properly powered up. 

The question remains is how much shift is critical to mag calibration. 


the attached is the one that APM right above PDB. Copter is not rotated between power cycles. (powered with regulated power supply)
imu.PNG
yaw.PNG

Olivier ADLER

unread,
Oct 2, 2013, 7:36:10 AM10/2/13
to drones-...@googlegroups.com

Many things can have an influence on compass readings. Specially in urban environments where there are a lot of large metallic structures or underground tubes.


There is this Wiki page too :

http://copter.ardupilot.com/wiki/automatic-compass-declination/

Natural and Artificial Magnetic Anomalies Warning

Note: the following information has not been objectively tested to determine it’s impact on a vehicle’s compass accuracy in flight.

  1. Many things can distort the earth’s magnetic field in the area you are flying:
    • Steel framed or reinforced concrete buildings, bridges and roadways, iron pipes and culverts, high power electric lines, heavy equipment, trucks and automobiles, steel tanks, electric motors and even computers.
    • Flying between steel framed or reinforced high rise buildings will distort the magnetic field in addition to causing GPS multi-pathing.
  2. Safe distances for compass calibration
    • 6″ (15 cm) minimum: Metal rim glasses, pen/pencil, metal watch band, pocket knife, metal zipper/buttons, belt buckle, batteries, binoculars, cell phone, keys, camera, camcorder, survey nails, metal tape measure.
    • 18″ (50 cm) minimum: Clipboard, data collector, computer, GPS antenna, 2-way radio, hand gun, hatchet, cell phone case with magnetic closure.
    • 6 ft (2 m) minimum: Bicycle, fire hydrant, road signs, sewer cap or drain, steel pole, ATV, guy wire, magnets, chain-link fence, bar-wire fence, data collectors
      that use a magnet to hold the stylus.
    • 15 ft (5 m) minimum: Electrical box, small car/truck, powerline, building with concrete & steel.
    • 30 ft (10 m) minimum: Large truck, metal building, heavy machinery.

Emile Castelnuovo

unread,
Oct 2, 2013, 8:18:47 AM10/2/13
to drones-...@googlegroups.com

Oliver et al.  this is why there should be an easy way to calibrate compass on the field. Without MP.
All commercial competitors have this. A few stick commands and rotation on the three axis to determine the offsets. At the time I requested it, it was told that there was auto learn. Now that this has been disabled by default we should really think of something alternative. 
I'm aware of the limited resources of the AVR but I think it's worth considering.
Emile

--

Robert Lefebvre

unread,
Oct 2, 2013, 9:20:04 AM10/2/13
to drones-discuss
Why would you need to calibrate at the field anyway? You should only really have to calibrate once unless you make changes to the machine.

I don't consider the lack of off-line calibration to be a benefit.  It's simple a necessity with the other systems, because they don't include a a GUI as standard.  Offering an off-line calibration would be a big step back IMO.  How does the user know if the calibration was successful?  

Olivier ADLER

unread,
Oct 2, 2013, 5:14:52 PM10/2/13
to drones-...@googlegroups.com

Because you can't do that seriously inside or near a building. So without a tablet or laptop computer plus a 3DRadio, you can't do it in the field actually.

Try to walk with a hand compass near or inside a building and you will certainly see the problem. I've seen it around my house.


Olivier.

Robert Lefebvre

unread,
Oct 2, 2013, 5:53:26 PM10/2/13
to drones-discuss
Sorry, poorly phrased.  I know you want to do it in a field, the one time it needs to be done.  But you don't need to keep redoing it in the field over and over again.

I don't think it's too onerous to have people bring a GCS to a field to do first-time setup of a UAV.  I never fly without a GCS ever.  We should be encouraging that, rather giving people ways to avoid using them.  If you don't have a GCS when you do the calibration, you can't know if you have bad values.


Olivier ADLER

unread,
Oct 3, 2013, 4:10:03 AM10/3/13
to drones-...@googlegroups.com


Yes and no. If you are traveling to a far location, your vertical magnetic field component (inclination) can be very different from your home location, so in this case you need to recalibrate in the field.

We don't have an inclination parameter, so you can't set that before to leave home. We only have a declination parameter.


I'm not sure that all users do have or want to buy a tablet or a laptop for their copter, if they are just using it for gaming or as a hobby.


More, it is not rare on earth to see locations where inclination (and declination too) is not the predicted value at all. So in this case, it is better to calibrate in the field and this is the recommended method for surveying compass for example where you will find a field calibration procedure that you can use without external computer.



Olivier.

Robert Lefebvre

unread,
Oct 3, 2013, 6:34:38 AM10/3/13
to drones-discuss
You may be correct that inclination may change thus requiring recalibration to compensate.  I'm not sure but it requires recalibration but OK.  If that is the case, then what we actually need is for the system to check declination at start-up, and notify the user they should recalibrate.  I know for sure, that declination changes, but it does not need recalibration to fix it, it needs to have the declination number adjusted, and there is absolutely no way to check, or change that without MP.  You could only trust the auto-declination feature, which has failed me badly in the past.  Again, this is why I always fly with GCS.  It's the only way you can know if you have a problem or not.

Personally, I'd take it another way... I'd make it so that you cannot enter any automatic flying mode, including Loiter, unless the controller has seen a telemetry connection before arming.  It should be a prearming check.  That's how strongly I feel about it.

Encouraging or even allowing people to fly these complicated systems without GCS is risky and dangerous.  There are so many things that should be checked before flight.  Just look at all the flyaways that occur with DJI.  I'm not at all interested in making these things easier to use for people such as the guy in Manhattan.  This does not need to be a race to the bottom to see who can get these things on Walmart shelves the fastest.

If people want to fly for fun without a GCS, they should just stick to MultiWii which doesn't have any auto flying features.


Randy Mackay

unread,
Oct 3, 2013, 9:50:14 PM10/3/13
to drones-...@googlegroups.com

      hmm....I'm really not sure this is correct.  The "live calibration" is there to correct for the offsets that come from:
             1. the sensor's internals
             2. metal objects on the frame

     I don't see how these would changed based upon your location.

     I'd really like to see some numbers (i.e resulting offsets) from repeated tests of the "live calibration" done in two locations which show the offsets are different depending upon location.

-Randy



From: Olivier ADLER <cont...@nerim.net>
To: drones-...@googlegroups.com
Sent: Thursday, October 3, 2013 5:10 PM
Subject: Re: [drones-discuss] Re: better compass calibration procedure?

Olivier ADLER

unread,
Oct 4, 2013, 4:59:06 AM10/4/13
to drones-...@googlegroups.com, Randy Mackay

Randy are you sure ? The compass calibration is rotating the earth mag field (3D) so that the resulting vector is a leveled 2D one in the X - Y plane.

So if the earth mag field inclination change, it seems logical that the calibration must be redo ?


Olivier.

Randy Mackay

unread,
Oct 4, 2013, 9:47:15 AM10/4/13
to Olivier ADLER, drones-...@googlegroups.com

     I'm pretty sure it should be ok.  As far as I know the offsets are static and do not depend upon the strength or direction of the local magnetic field.  During the "Live Calibration" I don't even think the mission planner uses the copter's attitude as part of the algorithm.

     When it comes to using the compass readings to correct earth-frame yaw, yes only the x,y portion is used so it will have trouble when the inclination is too great (like when you're sitting right at the north pole) but no amount of re-calibration would fix this I think.

     I could be wrong, I haven't actually seen the MP algorithm but I believe it's just like the accelerometer calibration.

-Randy



Cc: Randy Mackay <rmac...@yahoo.com>
Sent: Friday, October 4, 2013 5:59 PM

Subject: Re: [drones-discuss] Re: better compass calibration procedure?

Olivier ADLER

unread,
Oct 4, 2013, 1:50:35 PM10/4/13
to drones-...@googlegroups.com, Olivier ADLER, Randy Mackay

Here is the method, extracted from an older thread :


It goes something like this:
- Create unit vector2 facing north (1.0,0.0) to represent earth's magnetic field.
- Rotate it by the set declination.
- Multiply the mag vector by the DCM matrix (puts mag vector in earth frame).
- Discard Z
- Determine the angle between the two vectors. This angle is the error we need to correct.


Does it mean that if the mag field inclination change, there is no influence on the reported north ?


Jonathan Challinger

unread,
Oct 4, 2013, 2:02:52 PM10/4/13
to drones-...@googlegroups.com
Inclination does not affect the direction of the horizontal part of the magnetic field, only the magnitude. If we were using the compass to measure roll and pitch, then it would matter, but we don't because we have a better reference (accels).

The compass calibration does not depend on any external conditions, other than that they be unchanging. You could do it in space or on mars and bring it back to earth and it would be correct. Same with the motor calibration.


Randy Mackay

unread,
Oct 4, 2013, 11:14:09 PM10/4/13
to drones-...@googlegroups.com

     Ok, so Jonathan and I seem to agree so I think officially we should say that it is not necessary to re-do the compass calibration depending upon your location unless someone can provide proof that it does.  Proof could come from repeating the calibration in different locations to show that the offsets are significantly different.

-Randy

From: Jonathan Challinger <mr.cha...@gmail.com>
To: drones-...@googlegroups.com
Sent: Saturday, October 5, 2013 3:02 AM

Subject: Re: [drones-discuss] Re: better compass calibration procedure?

Olivier ADLER

unread,
Oct 5, 2013, 7:43:36 AM10/5/13
to drones-...@googlegroups.com, Randy Mackay

Ok so i'm definitley wrong here, i think that my confusion does come from i thought that we were rotating the 3D earth field vector to put it in the horizontal plane, where actually we project it in the horizontal plane.


If you watch at Mikrokopter, they have a nice checking feature for the Mag field using inclination. They are comparing the theoretical inclination with the measured inclination.

From their Wiki :

http://www.mikrokopter.de/ucwiki/en/MagnetError


http://mikrocontroller.com/files/pictures/Inclination3.gif



This can give a good indicator if the two values are different (more than 10 %) you can suppose that you are in a location with a strong magnetic anomaly or something is wrong with the compass setup.


Their calibration procedure is different, and can be initiated in the field from the transmitter :

http://www.mikrokopter.de/ucwiki/en/MK3Mag#Calibration_of_the_compass



Olivier

Reply all
Reply to author
Forward
0 new messages