2009년 9월 3일 목요일

GPS NMEA sentence

0. 참고

구문 정리가 잘 되어 있음 : http://aprs.gids.nl/nmea/

구현예제(JAVA) : http://developers.sun.com/mobility/apis/articles/bluetooth_gps/part2/#1

 

1. 종류

 * 하이라이트 된 항목 말고는 어따 써야할지 감이 안옴.

 

   $GPBOD - Bearing, origin to destination
   $GPBWC - Bearing and distance to waypoint, great circle
   $GPGGA - Global Positioning System Fix Data
   $GPGLL - Geographic position, latitude / longitude
   $GPGSA - GPS DOP and active satellites
   $GPGSV - GPS Satellites in view
   $GPHDT - Heading, True
   $GPR00 - List of waypoints in currently active route
   $GPRMA - Recommended minimum specific Loran-C data
   $GPRMB - Recommended minimum navigation info
   $GPRMC - Recommended minimum specific GPS/Transit data
   $GPRTE - Routes
   $GPTRF - Transit Fix Data
   $GPSTN - Multiple Data ID
   $GPVBW - Dual Ground / Water Speed
   $GPVTG - Track made good and ground speed
   $GPWPL - Waypoint location
   $GPXTE - Cross-track error, Measured
   $GPZDA - Date & Time

2. 활용

 2-1. 위도,경도 : $GPGGA or $GPRMC

 2-2. 고도 : $GPGGA

 2-3. 속도 : $GPVTG

 

3. 상세설명

 3-1. $GPGGA

 

$GPGGA,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx

hhmmss.ss = UTC of position
llll.ll = latitude of position
a = N or S
yyyyy.yy = Longitude of position
a = E or W
x = GPS Quality indicator (0=no fix, 1=GPS fix, 2=Dif. GPS fix)
xx = number of satellites in use
x.x = horizontal dilution of precision
x.x = Antenna altitude above mean-sea-level
M = units of antenna altitude, meters

x.x = Geoidal separation
M = units of geoidal separation, meters
x.x = Age of Differential GPS data (seconds)
xxxx = Differential reference station ID


 3-2. $GPRMC

 

$GPRMC,225446,A,4916.45,N,12311.12,W,000.5,054.7,191194,020.3,E*68

225446       Time of fix 22:54:46 UTC
A            Navigation receiver warning A = OK, V = warning
4916.45,N    Latitude 49 deg. 16.45 min North
12311.12,W   Longitude 123 deg. 11.12 min West

000.5        Speed over ground, Knots
054.7        Course Made Good, True
191194       Date of fix  19 November 1994
020.3,E      Magnetic variation 20.3 deg East
*68          mandatory checksum


 3-3. $GPVTG

 

$GPVTG,054.7,T,034.4,M,005.5,N,010.2,K

054.7,T      True track made good
034.4,M      Magnetic track made good
005.5,N      Ground speed, knots
010.2,K      Ground speed, Kilometers per hour


4. 적용예(C#)

   1: public void ParseGPGGA( string rawData ) {
   2:     int start = rawData.IndexOf("$GPGGA");
   3:     int end = rawData.IndexOf("*", start);
   4:     string gprmc = rawData.Substring(start + 6, end);
   5:  
   6:     string[] vals = gprmc.Split(delimiter);
   7:  
   8:     //this.Latitude = vals[3] + " " + vals[2];
   9:     //this.Longitude = vals[5] + " " + vals[4];
  10:     this.Latitude = Convert.ToDouble(vals[2]);
  11:     this.Longitude = Convert.ToDouble(vals[4]);
  12:     this.Altitude = Convert.ToDouble(vals[9]);            
  13: }
  14:  
  15: public void ParseGPVTG(string rawData) {
  16:     int start = rawData.IndexOf("$GPVTG");
  17:     int end = rawData.IndexOf("*", start);
  18:     string gpvtg = rawData.Substring(start + 6, end);
  19:  
  20:     string[] vals = gpvtg.Split(delimiter);
  21:  
  22:     this.Speed = Convert.ToDouble(vals[7]);            
  23: }

 

댓글 1개:

  1. 위도 경도 파싱할때 참고해야 할 페이지

    http://www.csgnetwork.com/gpsdistcalc.html

    답글삭제