World Magnetic Model needs to be updated (after January 30)
« on: January 13, 2019, 06:24:40 pm »
This amount of mag angle error may or may not be important to the operation of LibrePilot GPS flight modes.

GPS flight modes use the GPS to know where the aircraft is, but they use the mag to know what direction it is pointed in.  If it thinks it is pointed north and it wants to go north it issues a "go forward" command.  If it was actually pointed east when it thought it was pointed north, it will now be farther away than it was to start with and you have a "fly away".  That is for very large errors.  For smaller errors you get oscillations.  For errors below some limit (probably a few degrees) it handles it and all you get is a slightly curved deviation from straight flight.  That is why (in 16.09) we require a green mag to arm in GPS flight modes.

The LibrePilot code's 2015 World Magnetic Model (apparently the WMM is updated every 5 years) was supposed to last until 2020 but magnetic north has drifted and according to the articles:
"The magnetic pole is moving so quickly that it has forced the world's geomagnetism experts into a rare move."
"They realized that it was so inaccurate that it was about to exceed the acceptable limit for navigational errors."

"... the release of the corrected World Magnetic Model, which should restore accuracy through the end of 2019, has now been postponed from January 15th to January 30th -- 'due to the ongoing US government shutdown.' "

There is a small chance that this is related to some LibrePilot GPS mode aircraft oscillations.

I have convinced myself that simply making a small angle change to aux mag settings (Attitude->Magnetometer->Orientation) will not work to fix this because that rotation is in the model's frame of reference, not the earth's frame of reference.

World Magnetic Model has been updated, needs to be updated in LP code
« Reply #1 on: February 06, 2019, 05:25:26 am »
The World Magnetic Model has been updated.  The update was apparently published Monday Feb 4.
It might fix some GPS mode oscillation issues.
It might be useful to backport it (and some other fixes?) into 16.09 so that people could get these fixes with no settings changes (without starting setup over from scratch)?


  • ****
  • 494
Re: World Magnetic Model needs to be updated (after January 30)
« Reply #2 on: February 16, 2019, 02:00:04 am »
One of the articles mentioned that the planet's magnetic north wanders in the direction of Siberia at a rate of more than 34 miles per year (55 km), so in 5 years has now become 275 km. Maybe not much? But will the effect of this be greater and greater as moving your location from north pole towards the equator? (as distances between longditudes becomes greater)

And, How to use the new updated magnetic model in GPS units?
What do you mean by  "backport it into LP 16.09"

Re: World Magnetic Model needs to be updated (after January 30)
« Reply #3 on: February 16, 2019, 09:11:35 am »
My understanding of the (16.09 and a fairly recent next) code:

GCS code uses WMM 2010 (!) and firmware uses WMM 2015.

The firmware (and GCS) use the date to know where the moving north pole is and calculate a vector to it (it's 3D direction and strength).

And, How to use the new updated magnetic model in GPS units?
GPS's and mag sensors don't need to know anything about this.  They just return raw data (magnetic north pole is getting closer to Siberia) and the code corrects that to true north.

It seems to me the largest error would occur if the north (or south) pole was to your left one day and had moved to your right by the next day but the code thought it was still to your left (an oversimplification).  I think that means that the equator has roughly a smaller error because it is far away from this.

Musings: I think that the great circle that goes through where the mag north (/south) is and where our current code thinks it should be would have low error (outside of the short segment between is and should be) just like a compass on the great circle from mag north to true north always points true north (except in the short segment between mag north and true north).  Roughly a great circle from the magnetic north pole to Siberia might have low error away from the poles.

You have problems when your mag sensor says magnetic north is "there" and so true north is "there" so it banks your quad toward true north, but the GPS coordinates coming in say that you are moving northeast, not north (an exaggeration).  Another problem is that the strength of Earth's magnetic field has been decreasing about 5% per decade recently.  The code uses the direction of the field to determine true north, but it also uses the strength of the field as an error check.  5% error gives yellow mag and 15% gives red mag.  I think the field strength difference is less of an issue than it looks like because this is compensated for during mag sensor calibration as if it were a mag sensor sensitivity issue?  You would have to have done your last mag cal back in 2016 for mag field strength difference to be much of an issue?

34 miles per year is a huge amount!  :)  In less than 400 years the poles would be reversed.  In geologic time, this happens all the time.  Pole reversal (geomagnetic reversal) is overdue.  During a reversal, the strength of Earth's magnetic field decreases a lot.  Last time it was down to 5% of the current strength.  That leaves us less protected from solar flare issues.  Fun fact: Mars' lack of magnetic field is one reason Mars doesn't have much of an atmosphere.  :)

My understanding of the reason for this out-of-band / unplanned WMM update is that vehicles that depend on WMM were found to be at the edge of their safety limits; not actually unsafe, but needing correction.

What do you mean by  "backport it into LP 16.09"
Backport generally means to take a code change from some new, incompatible version (for us that is 'next') and put it back into an old version (for us that is 16.09) without breaking compatibility with the old version.  It is easy to take the old 16.09 code and make changes that don't require running setup again.  Generally, changes that don't change UAVO's are trivial to backport.  I am guessing that there are people with 16.09 who are not upgrading to the latest next, but who would gladly upgrade to "16.09.01" if they don't have to run setup.  There are quite a few things I could imagine being in a 16.09.01.

The WMM is an array of numbers that allows you to predict where the magnetic north pole is.  That array of numbers is in the source code and in the compiled GCS and firwmare.  This new model is just a new array of numbers that better predict where magnetic north is and is a simple ( :) ) change to this array.  The new WMM could easily be one of the things put in 16.09.01.  I should note that it would probably be a good idea (might be required) to redo mag calibration after updating WMM.

This gets into LP procedures, because we have never done this before.  Is something like 16.09+newWMM worth doing so we can ask people with certain kinds of GPS mode oscillations to try it with no other changes to see if it fixes issues?  Does "dev" think the idea of 16.09.01 is reasonable or that it should be avoided at all cost?  Does LP have easy ways of building "private" code sets?  For instance, I don't have a way of building for OSX, and my Windows environment would need a complete do over.

It might fix some GPS mode oscillation issues.
Let me clarify that.  There will always be areas on Earth where GPS modes oscillate.  Generally this is worst close to the mag poles.  Earth's mag field is strangely shaped too and that might cause issues away from the poles if the WMM is too inaccurate?  A better WMM will make these bad areas smaller.
« Last Edit: February 16, 2019, 05:37:04 pm by TheOtherCliff »