Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TinyGPS not decoding RMC & CGA sentences from some GPS receivers #25

Open
heidnerd opened this issue Aug 10, 2023 · 1 comment
Open

Comments

@heidnerd
Copy link

In the defines for TinyGPS we see:

#define _GPRMC_TERM "GPRMC"
#define _GPGGA_TERM "GPGGA"

the issue is that not all GPS receivers respond with the RMC data by preceding with GP. The same is true for the GCA data.

Thus using a defined term which includes the full GPRMC results in no valid sentences being found.

The first two characters after the $ sentence start, may be:

BD BDS - Chinese GPS system
GP GPS - Original USA GPS
GL GLOSNASS - Russian GPS system
GA Galileo - European GPS
GN GNSS (Global Navigation Satellite System)

The data following the identifiers are still in the NMEA 0183 format

The defines are found by using this TinyGPS code snippet.

int TinyGPS::gpsstrcmp(const char *str1, const char *str2)
{
while (*str1 && *str1 == *str2)
++str1, ++str2;
return *str1;
}

If the original defines are change to

#define _GPRMC_TERM "RMC"
#define _GPGGA_TERM "GGA

the TinyGPS software would then work with more receivers.

An alternative might be to include two new defines:

#define _GNRMC_TERM "GNRMC"
#define _GNGGA_TERM "GNGGA"

and then look for those strings and take action -- it's more cumbersome...

Sample data from the GPS receiver:

$GNZDA,201846.000,10,08,2023,00,004B
$GPTXT,01,01,01,ANTENNA OK
35
$GNGGA,201847.990,4743.25572,N,12211.02802,W,6,08,2.4,77.8,M,-21.2,M,,4F
$GNGLL,4743.25572,N,12211.02802,W,201847.990,A,E
53
$GNGSA,A,3,10,18,23,27,32,,,,,,,,5.7,2.4,5.2,13F
$GNGSA,A,3,27,33,41,,,,,,,,,,5.7,2.4,5.2,4
37
$GPGSV,3,1,11,02,09,305,,08,38,295,,10,80,315,29,15,11,045,,067
$GPGSV,3,2,11,18,30,121,26,21,17,305,,23,53,063,35,24,21,076,,0
6B
$GPGSV,3,3,11,27,49,244,30,32,38,189,41,194,06,291,,063
$BDGSV,2,1,05,14,25,055,,27,65,274,32,28,48,170,,33,53,056,31,0
71
$BDGSV,2,2,05,41,71,227,32,044
$GNRMC,201847.990,A,4743.25572,N,12211.02802,W,2.75,113.84,100823,,,E,V
19
$GNVTG,113.84,T,,M,2.75,N,5.09,K,E*24

@heidnerd
Copy link
Author

TinyGPSPlus uses a different method for the string compare (strcmp term, _GPRMC). Not sure if makes much difference for the final solution which and how it is solved.

One suggestion is that the GPS sentences have a format something like:

"${BD,GP,GL,GA,GN} {RMC, GGA, GSV,GSA,VTG},raw data

After the sentence start "$" is seen, it might be of use to look for the satellite system identifier one of (BD,GP,GL,GA,GN), if not seen, it's not likely to be a valid sentence, simply skip until sentence start "$" is seen again.

Once you've seen the satellite identifier and skipped to the next term in the sentence, that would be data format identifier (RMC, GGA, GSV,GSA,VTG) which you could then do a string compare before decoding.

If you identify the satellite, that might allow for library user to provide a mask of the satellite systems that they are willing to use... and if and AND results in no matches - ignore the sentence.

It could also be useful to set a bit map to describe which satellite systems were used to compile the data for the output from TinyGPS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant