3D Robotics

3689452959?profile=originalOne 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.3689452984?profile=original
  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:

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • My experience with longer arms is that you get better stability, but you need stronger motors depending on how much longer the arms are.  The extra means more leverage that the motors have to work against to drive the copter.

  • To my knowledge, CF does not block/attenuate mag fields. There is no ferrous stuff in it to do this.

    One idea might be to mix in a lot of high mu filings into the epoxy when the matte is poured. That would be a method if one were making a molded part to fit around the motor. The problem would be mircoscopic 'gaps' in the coverage of the filing bits.

    The sheet iron I mentioned previously is very thin and cuts with tin snips. To affect the 'shim' of a quad might not take that much material if placed strategically. We would just want to shape the mag field from the motor in way that is does not influence the APM magnetometer (we could not eliminate it entirely).

    I am more concerned with the 'E' (voltage) field produced by the ESC and the motor drive cables. Running them inside the arms can help though it would take some nice instrumentation to sense/plot those fields. There is excellent (read that as very $$) software to plot these fields when modelled accurately.

    All of these fields are subject to the inverse square law and Gauss's Law. In short, the farther way the motor is from the magnetometer, the less affect it will have. We could put the ESC closer to the motor but then we have to run the DC lines and control lines farther. This also increases the moment arm at the distance we strap all this together. Physics and Engineering are often fighting each other.

    With that said, I wonder how folk with fare if their quad arms are longer that Arducopter stock?

    Is there a optimum distance where motor mag fields are negligable?

  • Does carbon fibre shield magnetic fields?  If so, a few shrouds around the motors should be light enough.

  • Eagle, going round in circles (as I did when young) was what built skills to do what we are doing now. I may still build a UC plane -- electric this go round.

    Nice post/comment Chris. I work on MRI systems and we have to shim out the environment mag fields or the image quality of the MRI suffers. In some cases the room contractor has to install high mu sheets in the walls/floors/ceilings to contain the field of the MRI magnet and suppress outside influences.

    Though no one wants to add unneeded weight to a bird, some motor shielding might be an interesting experiment to see how it affects the system.

  • Eric: Looks like my other post got lost, but I was just joking you know; crashes are unavoidable, might as well have a laugh. I crashed my copter (again) this morning, and would probably crash a plane even harder.

    At any rate, thanks for your contribution to the community.

    BTW that setup does look fun!

  • Moderator

    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

     

  • 3D Robotics

    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. 

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

  • 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.

  • 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.

This reply was deleted.