3689392686?profile=originalHi folks - this is by first blog post here, so let me know if I'm commiting a faux pas in any manner :)

I've decided that the compass support on ArduPilotMega needs beefing up.  I'm working on this in a few ways:

1. Added MicroMag3 support - this is accomplished, though I still need to refactor to make things part of a better OO-design.

2. Added a LUT for both magnetic declination and inclination so that these values are populated by the GPS.

3. Looking to improve the drift correction algorithm.  I like in an area where the inclination of the magnetic field is about 70 degrees from horizontal.  Many people assume that the magnetic runs tagent to the earth's surface - this is significantly untrue.  Becuase the magnetic field vector is so close to vertical here, it actually provides a much better estimator for pitch and roll than yaw if the plane is horizontal.  Thus, I intend to modify the drift correction in the DCM to use the magnetic vector as a truly 3D vector.  This means that depending on the orientation of the plane, it will correct for pitch, roll, and/or yaw with varying levels of accracy.  Has anyone already looked into this?

4. Make a calibration wizard in "setup" and have it store the values in the EEPROM.

 

Cheers,

John

 

 

 

 

E-mail me when people leave their comments –

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

Join diydrones

Comments

  • Developer

    Hi John,

     

    A couple points:

     

    We do not do automatic detection of declination (Sorry Chris).  What we do is automatic detection of the magnetometer offsets.  A LUT might be nice, but we are getting a little tight on code space.  How big is it?  And what kind of geographic resolution?  I live in an area with significant changes in declination over relatively short distances, so I have not been a fan of a LUT.

     

    You have a bit of a point on the magnetic field angle w.r.t horizontal.  However, using the mag vector as a 3d vector doesn't really help us with drift correction.  To correct 3 gyro axis you need two independent vector references.  The closer to orthogonal they are the better.  The first we use is acceleration due to gravity - this corrects for pitch and roll drift.  The second if the magnetometer vector which we use only to correct for drift in yaw.  I have previously tried to use the magnetic vector as a 3d vector for drift correction and found two things.  First it provides no improvement in yaw drift correction, and second, using two vectors to simultaneously try to correct the same set of axis is difficult as the two drift correction processes tend to fight each other and oscillate.

  • Thanks for the pointer, Chris! I'm sync'd into the SVN repository now. (Still have to figure out the build process, but I'm getting closer! :)

    Bill's paper was very interesting.  I had originally assumed that I would have to dynamically compensate for the servos and the motor, but emperically, that doesn't look to be necessary.

    I'll have to read Bill's paper a couple more times, but it looks like he's able to dynamically compute the offsets for calibration, but not the declination or inclination of the magnetic field.  His work would take care of #4 - in terms of offsets.  MicroMag3 doesn't have the same built-in scaling calibration that his algorithm needs.

  • 3D Robotics
    John,

    Have you been following the development of APM 2.0? There is a totally different magnetometer configuration process in it, taken from Bill Premerlani's automatic detection of declination algorithm. Basically, it all happens automatically in the air now.
This reply was deleted.