This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
sdk:gps-udp-client-gnsstogps [2019/11/28 11:10] fachet |
sdk:gps-udp-client-gnsstogps [2021/10/08 10:22] (current) dodenhoeft [SDK Script gps-udp-client-GNSStoGPS.are] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Background ====== | ====== Background ====== | ||
- | GPS was the first Global Navigation Satellite System (GNSS) and the termt GPS is often used as a synonym for GNSS. | + | GPS was the first Global Navigation Satellite System (GNSS) and the term GPS is often used as a synonym for GNSS. |
+ | |||
+ | Older software often only checks for NMEA 0183 sentences starting with <nowiki>"$GP"</nowiki> (= GPS only) instead of looking for all GNSS systems. | ||
+ | |||
+ | Newer GNSS receivers often use multiple GNSS systems and therefore <nowiki>"$GN"</nowiki> is used (<nowiki>"$GNRMC..."</nowiki>) if it recives a combination of GPS, Galileo and GLONASS signals. | ||
- | Because of this older software only check for NMEA 0183 sentences starting with <nowiki>"$GP"</nowiki> (= GPS only) instead of looking for the different GNSS systems (e.g. <nowiki>"$GPRMC..."</nowiki>). | ||
- | Unfortunately with newer GNSS receiver often multiple GNSS systems are used and therefore <nowiki>"$GN"</nowiki> is used (<nowiki>"$GNRMC..."</nowiki>). | ||
It would be better to us instead of <nowiki>"$GPRMC"</nowiki> either <nowiki>"$G.RMC"</nowiki> ("." = anychar) for using GPS, Galileo and/or GLONASS (GNSS) or even <nowiki>"$..RMC"</nowiki> which means any source. | It would be better to us instead of <nowiki>"$GPRMC"</nowiki> either <nowiki>"$G.RMC"</nowiki> ("." = anychar) for using GPS, Galileo and/or GLONASS (GNSS) or even <nowiki>"$..RMC"</nowiki> which means any source. | ||
- | <nowiki>"$"</nowiki> = Start | + | <code> |
+ | NMEA 0183 sentence "$XXYYY..." explanation: | ||
+ | |||
+ | "$" = Start | ||
"XX" = Source device (https://de.wikipedia.org/wiki/NMEA_0183#Ger%C3%A4te-IDs) | "XX" = Source device (https://de.wikipedia.org/wiki/NMEA_0183#Ger%C3%A4te-IDs) | ||
BD = Beidu | BD = Beidu | ||
Line 12: | Line 17: | ||
GL = GLONASS | GL = GLONASS | ||
GP = GPS | GP = GPS | ||
- | GN = GNSS(multiple sources e.g. GPS "GP", Galileo "GA" and Glonass "GL") | + | GN = GNSS position fix from more than one constellation (eg. GPS + GLONASS) |
"YYY" = Record | "YYY" = Record | ||
- | RMC = Recommended Minimum Sentence C | + | RMC = Recommended Minimum Sentence C (used in most cases) |
- | GGA = Global Positioning System Fix Data | + | GGA = Global Positioning System Fix Data |
- | GNS = GNSS fixed data | + | GNS = GNSS fixed data |
- | GLL = Geographic Position - Latitude/Longitude | + | GLL = Geographic Position - Latitude/Longitude |
+ | ... | ||
+ | |||
+ | Source: https://de.wikipedia.org/wiki/NMEA_0183 | ||
+ | </code> | ||
====== SDK Script gps-udp-client-GNSStoGPS.are ====== | ====== SDK Script gps-udp-client-GNSStoGPS.are ====== | ||
Line 43: | Line 52: | ||
nb_config_set("gpsd.0.status=0"); | nb_config_set("gpsd.0.status=0"); | ||
- | sleep(3); | + | do { |
+ | sleep(3); | ||
+ | } while ( nb_config_done() != 0) | ||
+ | |||
nb_config_set("gpsd.0.status=1"); | nb_config_set("gpsd.0.status=1"); | ||
- | sleep(5); | + | do { |
+ | sleep(5); | ||
+ | } while ( nb_config_done() != 0) | ||
return 0; | return 0; | ||
} | } | ||
- | |||
int gpsd_connect () | int gpsd_connect () | ||
{ | { | ||
Line 59: | Line 71: | ||
exit(-1); | exit(-1); | ||
} | } | ||
- | for (attempt = 0; attempt <= 5; attempt++) { | + | for (attempt = 0; attempt <= 15; attempt++) { |
- | sleep(3); | + | sleep(15); |
if (connect(gpsd, local_ip, local_port) < 0) { | if (connect(gpsd, local_ip, local_port) < 0) { | ||
nb_syslog("Could not connect to daemon"); | nb_syslog("Could not connect to daemon"); | ||
- | if (attempt == 3) { | + | if (attempt == 12) { |
nb_syslog("Unable to connect, restarting daemon"); | nb_syslog("Unable to connect, restarting daemon"); | ||
gpsd_restart(); | gpsd_restart(); |