John Erickson's Posts (2)

Sort by

3689394590?profile=original(image from http://www.ngdc.noaa.gov/geomag/WMM/image.shtml)

 

Hi folks!

I decided to implement an on-board declination calculator based on geographic location and I'd love to get some feedback.  It takes up about 1400 flash bytes in total for a 3 degree declination error anywhere that people live (permanently - sorry Vostok!) and using a compass is reasonable.  It's not going to be flight tested until it stops raining here, so use at your own risk!  See the paper for more details :)

-John

 

Paper:

Lightweight%20Computation%20of%20the%20Earths%20Magnetic%20Field.pdf

 

APM Code - check under AP_GPS for AP_Declination_Lookup.*

ArduPilot.zip

 

LUT/IDW C# Calculator:

Geomag.zip

 

Footprint:

COMPASS_DECLINATION_LUT == DISABLED

113268 bytes, Free RAM: 1351, using 2061 bytes of memory

 

COMPASS_DECLINATION_LUT == ENABLED, COMPASS_DECLINATION_LUT_ACCURACY_LEVEL == 0

114692 bytes, Free RAM: 1351, using 2061 bytes of memory

 

Accuracy:
Scalable with table size

Table size: 89 entries (COMPASS_DECLINATION_LUT_ACCURACY_LEVEL == 0)
-------------------------------
Error   0 percentile: 0

Error  10 percentile: 0.1098926

Error  20 percentile: 0.2223369

Error  30 percentile: 0.3377705

Error  40 percentile: 0.4542923

Error  50 percentile: 0.5770731

Error  60 percentile: 0.7134132

Error  70 percentile: 0.8671622

Error  80 percentile: 1.072514

Error  90 percentile: 1.401104

Error  91 percentile: 1.447367

Error  92 percentile: 1.495352

Error  93 percentile: 1.551685

Error  94 percentile: 1.611044

Error  95 percentile: 1.676226

Error  96 percentile: 1.764013

Error  97 percentile: 1.864101

Error  98 percentile: 1.988347

Error  99 percentile: 2.208701

Error 100 percentile: 2.987068

 

Read more…

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

 

 

 

 

Read more…