NMEA 0183: Difference between revisions
(Created page with "NMEA-0186 est un format standard de messages de sortie de récepteurs GPS. ==Format== http://www.sparkfun.com/datasheets/GPS/NMEA%20Reference%20Manual1.pdf <pre> $IDMSG,D1,D2,…") |
|||
(24 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Le standard NMEA-0183 est un format texte de messages structurant des données produites (essentiellement) par des récepteurs GPS via une liaison série (Baud rate: 4800 Number of data bits: 8 (bit 7 is 0) Stop bits: 1 (or more) Parity: none Handshake: none). |
|||
NMEA-0186 est un format standard de messages de sortie de récepteurs GPS. |
|||
NMEA-0183 est un format de données textuel des relevés GPS acquis par les terminaux GPS puis retournés à un hôte (par un port série par exemple). Il couvre un large spectre de données de navigation. Ces données sont envoyées par le récepteur en mode ''heartbeat'' à fréquence fixe (0,5 Hz par exemple). |
|||
==Format== |
==Format== |
||
http://www.sparkfun.com/datasheets/GPS/NMEA%20Reference%20Manual1.pdf |
Documentation http://www.sparkfun.com/datasheets/GPS/NMEA%20Reference%20Manual1.pdf |
||
===Syntaxe=== |
|||
Chaque message est structuré de la manière suivante : |
|||
<pre> |
<pre> |
||
$ |
$AABBB,CC,DD,...*CK<CR><LF> |
||
$ marqueur de début du message |
|||
ID: Talker id (GP pour GPS) |
|||
AA pour l'identifiant de l'émetteur (''talker'') |
|||
MSG: Message id |
|||
BBB pour la phrase (''sentence'') |
|||
Di: Msg data fields |
|||
CK ''Checksum'' |
|||
CS: Ckecksum 2 hexa for 8 bits |
|||
* |
|||
<CR> Carriage Return \r |
|||
<LF> Line Feed \n |
|||
</pre> |
</pre> |
||
le code C de la fonction de ''checksum'' |
|||
<pre> |
|||
#define uchar unsigned char |
|||
uchar calcChecksum(uchar checksum, uchar c){ |
|||
if ( c == '$' ) return 0; |
|||
if ( c != '\r' && c != '\n' && c != '*' ) { |
|||
checksum ^= c; |
|||
} |
|||
return checksum; |
|||
} |
|||
</pre> |
|||
le code Arduino de la fonction de ''checksum'' |
|||
<pre> |
|||
byte calcChecksum(byte checksum, byte c){ |
|||
if ( c == '$' ) return 0; |
|||
if ( c != '\r' && c != '\n' && c != '*' ) { |
|||
checksum ^= c; |
|||
} |
|||
return checksum; |
|||
} |
|||
byte calcChecksumBuf(byte checksum, byte buf[], int i, int len){ |
|||
for(;i<len; i++){ |
|||
checksum=calcChecksum(checksum,buf[i]); |
|||
} |
|||
return checksum; |
|||
} |
|||
</pre> |
|||
==Liens== |
|||
* http://www.tronico.fi/OH6NT/docs/NMEA0183.pdf |
|||
====Messages de sortie==== |
|||
Chaque message est une ligne de texte commencant par $ et se terminant par [CR][LF] et contient les champs suivants |
|||
<pre> |
|||
$IDMSG,D1,D2,D3,...Dn*CS[CR][LF] |
|||
</pre> |
|||
<br>ID: Talker id (GP pour GPS) |
|||
<br>MSG: Message id |
|||
<br>Di: Msg data fields |
|||
<br>CS: Ckecksum 2 hexa for 8 bits |
|||
Most common message Ids are |
|||
* GGA : GPS fix data (NMEA Version 2.1) |
|||
* GLL : Geographic position - Latitude/Longitude |
|||
* GSA : GPS DOP and active satellites |
|||
* GSV : GPS satellites in view |
|||
* RMC : Recommended minimum specific GPS/Transit data |
|||
* VTG : Track made good and ground speed |
|||
* ZDA : SiRF Timing Message |
|||
* MSS : MSK Receiver Signal |
|||
* 150 : OkToSend |
|||
* ... |
|||
Line 25: | Line 94: | ||
$GPBOD,,T,,M,,*47 |
$GPBOD,,T,,M,,*47 |
||
</pre> |
</pre> |
||
====Messages d'entrée==== |
|||
$IDMSG,D1,D2,D3,...Dn*CS[CR][LF] |
|||
ID=PSRF |
|||
MSG= |
|||
* 100 : SetSerialPort : Set PORT A parameters and protocol |
|||
* 101 : NavigationInitialization : Parameters required for start using X/Y/Z (Input coordinates must be WGS84) |
|||
* 102 : SetDGPSPort = Set PORT B parameters for DGPS input |
|||
* 103 : Query/Rate Control = Query standard NMEA message and/or set output rate |
|||
* 104 : LLANavigationInitialization = Parameters required for start using Lat/Lon/Alt (Input coordinates must be WGS84) |
|||
* 105 : Development Data On/Off = Development Data messages On/Off |
|||
* 106 : Select Datum = Selection of datum to be used for coordinate transformations. |
|||
* MSK : MSK Receiver Interface = Command message to a MSK radio-beacon receiver. |
|||
===Messages=== |
|||
====Message GLL - Geographic Position - Latitude/Longitude==== |
|||
contains the latitude and longitude of the present vessel position, the time of the position fix and the status. |
|||
<pre>$GPGLL,llll.lll,a,yyyyy.yyy,a,hhmmss.s,A*hh[CR][LF]</pre> |
|||
* 1,2 Latitude, N (North) or S (South) |
|||
* 3,4 Longitude, E (East) or W (West) |
|||
* 5 UTC of position |
|||
* 6 Status: A = Valid, V= Invalid |
|||
* hh Checksum |
|||
====Message GGA - GPS Fix Data==== |
|||
includes time, position and fix related data for the GPS receiver. |
|||
<pre>$GPGGA,hhmmss,llll.lll,a,nnnnn.nnn,b,t,uu,v.v,w.w,M,x.x,M,y.y,zzzz*hh[CR][LF]</pre> |
|||
* 1 UTC of Position |
|||
* 2,3 Latitude, N (North) or S (South) |
|||
* 4,5 Longitude, E (East) or W (West) |
|||
* 6 GPS Quality Indicator: 0 = No GPS, 1 = GPS, 2 = DGPS |
|||
* 7 Number of Satellites in Use |
|||
* 8 Horizontal Dilution of Precision (HDOP) |
|||
* 9, 10 Antenna Altitude in Meters, M = Meters |
|||
* 11, 12 Geoidal Separation in Meters, M=Meters. Geoidal separation is the difference between the WGS-84 earth ellipsoid and mean-sea-level. |
|||
* 13 Age of Differential GPS Data. Time in seconds since the last Type 1 or 9 Update |
|||
* 14 Differential Reference Station ID (0000 to 1023) |
|||
* hh Checksum |
|||
====Message VTG - Track Made Good and Ground Speed==== |
|||
conveys the actual track made good (COG) and the speed relative to the ground (SOG). |
|||
<pre>$GPVTG,x.x,T,x.x,M,x.x,N,x.x,K*hh[CR][LF]</pre> |
|||
* 1 Track made good in degrees true. |
|||
* 2 Track made good in degrees magnetic. |
|||
* 3,4 Speed over the ground (SOG) in knots. |
|||
* 5,6 Speed over the ground (SOG) in kilometer per hour. |
|||
* hh Checksum |
|||
Remark: Velocity is always described as horizontal speed and heading |
|||
==Outils== |
|||
===Mac OS X=== |
|||
Ligne de commande |
|||
<pre> |
|||
screen /dev/tty.usbserial 4800 |
|||
</pre> |
|||
===Linux=== |
|||
<pre> |
|||
awk -F, '/\$GPGGA/ {print strftime("%Y-%m-%d "), $2, (substr($3,0,2) + (substr($3,3) / 60.0)) $4, (substr($5,0,3) + (substr($5,4) / 60.0)) $6, $10; fflush();}' /dev/tty.usbserial |
|||
</pre> |
|||
[[GPSLabel]] |
|||
[[GPSD]] |
|||
===Windows=== |
|||
==Bibliothèques== |
==Bibliothèques== |
||
Line 30: | Line 171: | ||
* http://arduiniana.org/libraries/TinyGPS/ |
* http://arduiniana.org/libraries/TinyGPS/ |
||
* http://www.maartenlamers.com/nmea/ |
* http://www.maartenlamers.com/nmea/ |
||
===MBed=== |
|||
* https://os.mbed.com/users/Sir_Binky/code/TinyGPSplus/ |
|||
* https://os.mbed.com/users/todotani/notebook/gps-nmea-parser/ |
|||
===STM32=== |
|||
* https://github.com/Lora-net/LoRaMac-node/blob/ad7d0824cae91f1dac4978d9c938966a0d4f60c3/src/system/gps.c |
|||
===Java avec RXTX=== |
|||
* http://gpsmap.sourceforge.net |
|||
* http://javagps.sourceforge.net |
|||
===Javascript & [[Node.js]]=== |
|||
* [[Node.js#NMEA_0183_Parsing|Node.js]] |
|||
* [https://github.com/infusion/GPS.js GPS.js] : parser NMEA + serial |
|||
<pre> |
|||
git clone https://github.com/infusion/GPS.js.git |
|||
cd GPS.js/ |
|||
npm install -g |
|||
npm install express --save |
|||
npm install socket.io --save |
|||
npm install sylvester --save |
|||
npm install kalman --save |
|||
npm install serialport --save |
|||
cd examples/ |
|||
cd maps/ |
|||
# Edit server.js for setting port and baudrate |
|||
node server.js |
|||
open http://localhost:3000 |
|||
cd .. |
|||
cd dashboard/ |
|||
# Edit server.js for setting port and baudrate |
|||
node server.js |
|||
open http://localhost:3000 |
|||
</pre> |
|||
==Cartographie== |
|||
==Pour en savoir plus== |
|||
* http://vancouver-webpages.com/peter/idx_faq.html |
|||
* http://home.mira.net/~gnb/gps/nmea.html |
|||
* http://www.grc.nasa.gov/WWW/MAEL/ag/agnmea1.htm |
Latest revision as of 17:44, 17 April 2019
Le standard NMEA-0183 est un format texte de messages structurant des données produites (essentiellement) par des récepteurs GPS via une liaison série (Baud rate: 4800 Number of data bits: 8 (bit 7 is 0) Stop bits: 1 (or more) Parity: none Handshake: none). NMEA-0183 est un format de données textuel des relevés GPS acquis par les terminaux GPS puis retournés à un hôte (par un port série par exemple). Il couvre un large spectre de données de navigation. Ces données sont envoyées par le récepteur en mode heartbeat à fréquence fixe (0,5 Hz par exemple).
Format
Documentation http://www.sparkfun.com/datasheets/GPS/NMEA%20Reference%20Manual1.pdf
Syntaxe
Chaque message est structuré de la manière suivante :
$AABBB,CC,DD,...*CK<CR><LF> $ marqueur de début du message AA pour l'identifiant de l'émetteur (''talker'') BBB pour la phrase (''sentence'') CK ''Checksum'' * <CR> Carriage Return \r <LF> Line Feed \n
le code C de la fonction de checksum
#define uchar unsigned char uchar calcChecksum(uchar checksum, uchar c){ if ( c == '$' ) return 0; if ( c != '\r' && c != '\n' && c != '*' ) { checksum ^= c; } return checksum; }
le code Arduino de la fonction de checksum
byte calcChecksum(byte checksum, byte c){ if ( c == '$' ) return 0; if ( c != '\r' && c != '\n' && c != '*' ) { checksum ^= c; } return checksum; } byte calcChecksumBuf(byte checksum, byte buf[], int i, int len){ for(;i<len; i++){ checksum=calcChecksum(checksum,buf[i]); } return checksum; }
Liens
Messages de sortie
Chaque message est une ligne de texte commencant par $ et se terminant par [CR][LF] et contient les champs suivants
$IDMSG,D1,D2,D3,...Dn*CS[CR][LF]
ID: Talker id (GP pour GPS)
MSG: Message id
Di: Msg data fields
CS: Ckecksum 2 hexa for 8 bits
Most common message Ids are
- GGA : GPS fix data (NMEA Version 2.1)
- GLL : Geographic position - Latitude/Longitude
- GSA : GPS DOP and active satellites
- GSV : GPS satellites in view
- RMC : Recommended minimum specific GPS/Transit data
- VTG : Track made good and ground speed
- ZDA : SiRF Timing Message
- MSS : MSK Receiver Signal
- 150 : OkToSend
- ...
Exemples
$GPGGA,164503.0,4511.636,N,00546.242,E,1,6,3.25,00220,M,048,M,,*66 $GPVTG,000.0,T,002.0,M,000.00,N,000.00,K*4C $GPRMC,214434,A,3753.666,N,12203.162,W,0.0,0.0,270901,15.4,E,A*33 $GPGGA,214616,3753.667,N,12203.167,W,1,04,5.6,121.1,M,-27.4,M,,*79 $GPGSV,3,1,10,01,69,062,47,03,12,106,37,04,12,279,00,08,12,250,00*77 $GPGLL,3753.667,N,12203.167,W,214616,A,A*54 $GPBOD,,T,,M,,*47
Messages d'entrée
$IDMSG,D1,D2,D3,...Dn*CS[CR][LF]
ID=PSRF
MSG=
- 100 : SetSerialPort : Set PORT A parameters and protocol
- 101 : NavigationInitialization : Parameters required for start using X/Y/Z (Input coordinates must be WGS84)
- 102 : SetDGPSPort = Set PORT B parameters for DGPS input
- 103 : Query/Rate Control = Query standard NMEA message and/or set output rate
- 104 : LLANavigationInitialization = Parameters required for start using Lat/Lon/Alt (Input coordinates must be WGS84)
- 105 : Development Data On/Off = Development Data messages On/Off
- 106 : Select Datum = Selection of datum to be used for coordinate transformations.
- MSK : MSK Receiver Interface = Command message to a MSK radio-beacon receiver.
Messages
Message GLL - Geographic Position - Latitude/Longitude
contains the latitude and longitude of the present vessel position, the time of the position fix and the status.
$GPGLL,llll.lll,a,yyyyy.yyy,a,hhmmss.s,A*hh[CR][LF]
- 1,2 Latitude, N (North) or S (South)
- 3,4 Longitude, E (East) or W (West)
- 5 UTC of position
- 6 Status: A = Valid, V= Invalid
- hh Checksum
Message GGA - GPS Fix Data
includes time, position and fix related data for the GPS receiver.
$GPGGA,hhmmss,llll.lll,a,nnnnn.nnn,b,t,uu,v.v,w.w,M,x.x,M,y.y,zzzz*hh[CR][LF]
- 1 UTC of Position
- 2,3 Latitude, N (North) or S (South)
- 4,5 Longitude, E (East) or W (West)
- 6 GPS Quality Indicator: 0 = No GPS, 1 = GPS, 2 = DGPS
- 7 Number of Satellites in Use
- 8 Horizontal Dilution of Precision (HDOP)
- 9, 10 Antenna Altitude in Meters, M = Meters
- 11, 12 Geoidal Separation in Meters, M=Meters. Geoidal separation is the difference between the WGS-84 earth ellipsoid and mean-sea-level.
- 13 Age of Differential GPS Data. Time in seconds since the last Type 1 or 9 Update
- 14 Differential Reference Station ID (0000 to 1023)
- hh Checksum
Message VTG - Track Made Good and Ground Speed
conveys the actual track made good (COG) and the speed relative to the ground (SOG).
$GPVTG,x.x,T,x.x,M,x.x,N,x.x,K*hh[CR][LF]
- 1 Track made good in degrees true.
- 2 Track made good in degrees magnetic.
- 3,4 Speed over the ground (SOG) in knots.
- 5,6 Speed over the ground (SOG) in kilometer per hour.
- hh Checksum
Remark: Velocity is always described as horizontal speed and heading
Outils
Mac OS X
Ligne de commande
screen /dev/tty.usbserial 4800
Linux
awk -F, '/\$GPGGA/ {print strftime("%Y-%m-%d "), $2, (substr($3,0,2) + (substr($3,3) / 60.0)) $4, (substr($5,0,3) + (substr($5,4) / 60.0)) $6, $10; fflush();}' /dev/tty.usbserial
Windows
Bibliothèques
Arduino
MBed
- https://os.mbed.com/users/Sir_Binky/code/TinyGPSplus/
- https://os.mbed.com/users/todotani/notebook/gps-nmea-parser/
STM32
Java avec RXTX
Javascript & Node.js
git clone https://github.com/infusion/GPS.js.git cd GPS.js/ npm install -g npm install express --save npm install socket.io --save npm install sylvester --save npm install kalman --save npm install serialport --save cd examples/ cd maps/ # Edit server.js for setting port and baudrate node server.js open http://localhost:3000 cd .. cd dashboard/ # Edit server.js for setting port and baudrate node server.js open http://localhost:3000