Getting heading information from GPS

Thread Starter

wannaBinventor

Joined Apr 8, 2010
180
I'm trying to understand how to get heading information from NMEA strings. I understand that one has to be moving to get a reading (IE: the gps is not a compass), but I still don't know which string actually puts out the info.

$GPVTG has "track made good" and "magnetic track made good," but I don't know what that really means.

$GPGSV has "azimuth" in degrees, which I normally take to mean direction, but I'm not 100% sure here.

$GPRMC has "track angle in degrees true" and "Magnetic variation," but I'm once again lost of the meaning of those.

Thanks.
 

Papabravo

Joined Feb 24, 2006
22,116
Magnetic Variation(Declination) is the difference between "True North", the direction you would have to travel to reach the north pole (90° N Latitude), and "Magnetic North", the direction you would have to travel to reach the magnetic north pole.

You do know that the Magnetic North Pole is moving about 40 km./year to the west.

http://www.ngdc.noaa.gov/geomag/declination.shtml

http://www.ngdc.noaa.gov/geomag/img/DeclinationMap_NorthAmerica.png

Geez. SE Michigan used to be 4 degrees West(1978), now its almost 7 degrees West
 

Thread Starter

wannaBinventor

Joined Apr 8, 2010
180
Do you mean the GPS actually knows the declination for any one position?

I'm in the military reserve and I've done my fair share of land nav. We always have to apply to LARS rule based on the declination diagram for the maps we've been given.

Are you saying that that actually gives me the degrees of declination for the particular part of the earth I'm standing on? Does that 40km/yr get accounted for when the satellite beams down the data?

Which one actually gives me my heading? Azimuth? I think some of this depends on waypoints that the user enters with more advanced GPS systems, which kind of adds to my confusion here in trying to understand them.
 

nanovate

Joined May 7, 2007
666
Do you mean the GPS actually knows the declination for any one position?
Your GPS receiver would have a look-up table to give you that information.

Which one actually gives me my heading? Azimuth? I think some of this depends on waypoints that the user enters with more advanced GPS systems, which kind of adds to my confusion here in trying to understand them.
The azimuth given in the GSV sentence is for the satellite's location.

There is a NMEA 0183 sentence for Heading but it is usually comes from a compass or is calculated by the GPS receiver.
 

spinnaker

Joined Oct 29, 2009
7,830
If you can get velocity for two directions then both speed and heading can be calculated.

Here is a sample for calculating heading:

Rich (BB code):
double heading = atan2(velEast, velNorth);     // Returns the angle, in radians, between -pi and pi.
    heading *= 180.0 / M_PI;                      // Convert from radians to degrees.  Now heading is in the range [-180, 180]
    if (heading < 0.0)
        heading += 360.0;
Here is sample code for calculating speed:
Rich (BB code):
double v2 = (velEast*velEast) + (velNorth*velNorth) + (velUp*velUp);
 
Top