Compass calibration: How Apple does it (vs how we do it)

One of the APM features the dev teams have been working hardest on is improved compass calibration. Magnetometers are a tricky thing to get right because there are at least three kinds of variation: 1) each sensor is different, 2) the Earth's magnetic field varies around the planet (Declination), 3) The "hard iron" magnetic interference of each aircraft is different, and even that varies in flight when the motors are going. 

Right now we have three different kinds of calibration you can use: 

  1. Auto calibration. You do nothing, and the code figures out all the offsets and declination by comparing the compass readings with the GPS and IMU readings over time in flight. Pro: no user effort. Con: it takes a few minutes of flying to get right, so the compass is inaccurate at first launch.
  2. Manual calibration in the Mission Planner. This is the screen on the Configuration screen, where you can enter your Declination and then press the "Calibration" button and move and rotate your aircraft around for 30 seconds while it records the data and does some math to calibrate the sensor. Pro: works. Con: it's a little awkward, especially for big aircraft. Also doesn't reflect the magnetic interference that can occur when the motors are going in flight.
  3. Replay a flight log. This is a very cool option, shown above, where you can just replay a flight log (.tlog) and the code will compare the GPS and IMU readings with the compass reading and make the necessary corrections. Pro: works great. Con: must have already flown, will be messed up if you load a .tlog file where you didn't actually fly. 

It's interesting to see how others do this. In the video below, from the radio program Marketplace, you can see (at 1:20) how Foxconn calibrates the magnetometer in an iPad. It's basically the same as our Method 2, but highly automated:

Views: 2663


Developer
Comment by R_Lefebvre on April 13, 2012 at 12:33pm

It's amazing to see such high technology manufacturing processes being used in China.  It's definitely not the 3rd world sweatshop that many people picture when they think about the label "Made in China".  

Comment by Ellison Chan on April 13, 2012 at 1:22pm

Robert, how do you get, "not the 3rd world swearshop", from a salary of $14/day?  They have to leave their families at home and go back once or twice a year, just to earn a basic living.

The company spends many fold more money on automation and high tech equipment than worker salaries and benefits, which are non-existent.  That's my definition of a classic sweat shop.

Oh, and just to stay on topic, I like the mag calibration routines.

Comment by Eagle on April 13, 2012 at 4:59pm

Thank you Chris for details regarding three different kinds of calibration.  Now I wish I could use option #3.  But so far all I'm able to do is destroying the airframe 5 seconds after hand launch (RIP Bixler)... so I'm using option #2 for now.  Schedule to maiden my FPV168 (fiberglass) tomorrow morning.  PRO: It got wheels.  no more hand launch for me.  If it fails... i'm switching to copters...

Comment by Cliff-E on April 13, 2012 at 5:42pm

Nice video on the iPad. One needs to realize the compass is a pretty critical thing for flight safety in simple mode. Cause if the control system doesn't know its true bearing (and your 300 feet away), doesn't matter if the gyros or accel are working fine--you end up fighting the control system in manual mode. FYI, method #2 is similar to the MK's as well.

FYI, accounting for motor/ESC interference can be tricky.

Comment by Kevin Bouchard on April 13, 2012 at 5:45pm

Eagle: If you want to avoid crashes, I'm afraid copters aren't for you... :p

Comment by Eagle on April 13, 2012 at 6:15pm

What is for me Kevin?  Legos? Persévérence Kevin... le secret du succès. 


3D Robotics
Comment by Chris Anderson on April 13, 2012 at 7:11pm

Eagle: Needless to say, do not switch on an autopilot until you've already got the plane in the air flying well and at a safe altitude. This has nothing to do with compass calibration. You can't launch a plane under autopilot control until it's been properly trimmed and calibrated in the air. 

Comment by Dwgsparky on April 13, 2012 at 7:56pm

As a newbie powering up his APM2 for the first time tonight and finding the only problem is that the compass does not know where north is , it works fine and turns as the module is turned  ,, I have set the declination but the plane has not flown, will it self calibrate as I fly the plane to trim it out under RC control? or have I missed something. Thanks

 

Comment by Eagle on April 13, 2012 at 8:00pm

I liked this Blog for a simple reason.  Last year I was able to sucessfully fly APM1 with a Switch Airframe.  I managed to crash it with the addition of a GoPro cam.... Comes winter...and i spent many hours to build the FPV168.  Was to cold to fly anyway... I wanted to upgrade to a bigger airframe in order to add some videos/osd on it. I purchased APM2 (pre-order in december) and I managed to get a grip on a MinimOSD. Lately I follow ArduPlane version upgrades and I came across some issues with many added parameters like the Manual_LEVEL and COMPASS_LEARN... so my learning curve regarding APM took a deep dive... I did not want to test things with the FPV168. So I did some testing with a Bixler and turned out to be a disaster.  Fortunetly a member (Tridge) gave me great advise in order to get back in track.  Thanks again man!.  You solved many of my problems with the latest software updates. Just to be clear I'm not saying that the Bixler is not a good airframe. I'm only saying that with GoPro and other payloads... I might have pushed it to the limit.  And my rusted RC pilot skills might not helped on the subject. I'm far from beiing an ACE regarding RC flying... even if I fly balsa airframe when I was a kid a long time ago... flying in circle with wire leads... younger members probably don't have a clue what I'm talking about... it's ok...your lucky to enjoy this hobby in 2012.

 

Maybe not the best place to post some pictures but I will do it anyway.

 

FPV168 Mods:

Landing gears was modify in order to get rid of the front wheel.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Motor:

Rime Fire .46 with AirScrew 3 blades 10x7

 

 

 

 

 

 

 

 

 

 

Tail wheel, DuBro tail wheel system

 

 

 

 

 

 

 

 

 

 

Power

HK Plush 60amp ESC (...in order to avoid brownout) + Spektrum Telemetry

Note: I add a HeatSink... just in case

 

 

 

 

 

 

 

Modify FPV168 cock pit to mount APM2/OSD/GoPro

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Please wish me luck for tomorrow.

Will write a blog to let you dear DIYDrones members how the maiden went.

 

...and Kevin... I'm having fun... so far.

I requested to Chris to be a moderator on DIYDrones site.  All I'm doing is filter new membership approval in order to avoid spamming.... not much... but hey!  it is my contribution.

 

Just a kind remark.  Avoid to tell people what is not for them.

It is a DIY sites and we should help each others to succeed in our adventure.

 

Regards,

Eric

 

 

Comment by Eagle on April 13, 2012 at 8:05pm

Thank you Chris.  I know.  Was launching freeking Bixler in Manual Mode.

 

Comment

You need to be a member of DIY Drones to add comments!

Join DIY Drones

Social Networking

Contests

Season Two of the Trust Time Trial (T3) Contest has now begun. The fourth round is an accuracy round for multicopters, which requires contestants to fly a cube. The deadline is April 14th.

A list of all T3 contests is here

Groups

Advertisement

© 2013   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service