visualgps / nmeaparser Goto Github PK
View Code? Open in Web Editor NEWNMEA Parser writen in C++
License: MIT License
NMEA Parser writen in C++
License: MIT License
Hi,
I recently used this parser. I used GGA Sentences to get the Lat and Lon Data, however, i found that the precision was too less. Is there a way to increase the precision?
I've noticed that the uBlox 8 chipset will send multiple GSA sentences. They are doing this because the GSA only allows 12 satellites in the sentence, however the GSA sentence did not have a sequence number associated with it. What happens now is when you do get multiple GSA sentences, the last one out will get preference.
Example:
$GNGSA,A,3,17,28,30,13,19,07,11,15,01,51,,,1.56,0.75,1.37*1A $GNGSA,A,3,81,79,82,78,88,80,69,,,,,,1.56,0.75,1.37*1C
In the NMEASentenceRMC.cpp :
// Speed over ground knots
if (GetField(pData, szField, 6, c_nMaxField) == CNMEAParserData::ERROR_OK) {
m_SentenceData.m_dSpeedKnots = atol(szField);
}
the use of atol() is incorrect, it converts to long int, should be a floating point conversion with atof(), like this:
m_SentenceData.m_dSpeedKnots = atof(szField);
I'm wondering why the function is correctly called in the constructor of the NMEASentenceGSA and NMEASentenceGGA, but it isn't in the NMEASentenceGSV and NMEASentenceRMC ones.
Is it a simple forgetfulness or is there a reason that I don't get?
Hello,
(First of all, thank you for sharing this code!)
The function CNMEAParser::ProcessRxCommand has a printf that can be annoying when used in an application that already has a certain level of verbosity.
Since this function can be overloaded by child classes as described in the documentation, could it be removed from the parent class and be placed in the example's child class instead? Something like :
Parent CNMEAParser class:
CNMEAParserData::ERROR_E CNMEAParser::ProcessRxCommand(char * pCmd, char * pData)
{
/* REMOVE FROM HERE ....
//
// Grab the talker ID
//
uint16_t u16TalkerID = (uint16_t)((uint8_t)pCmd[0]) << 8;
u16TalkerID |= (uint16_t)((uint8_t)pCmd[1]);
//
// Get the sentence ID, --XXX where XXX is the sentence ID
//
char *lpszSentenceID = &pCmd[2];
printf("Cmd: %s, TalkerID:%c%c, Sentence ID: %s\n", pCmd, (u16TalkerID >> 8) & 0xFF, (u16TalkerID) & 0xFF, lpszSentenceID);
... UNTIL HERE */
//-----------------------------------------------------------------------------
// ...
Child example class:
///
/// \brief This method is redefined from CNMEAParserPacket::ProcessRxCommand(char *pCmd, char *pData)
///
/// \param pCmd Pointer to the NMEA command string
/// \param pData Comma separated data that belongs to the command
/// \return Returns CNMEAParserData::ERROR_OK If successful
///
virtual CNMEAParserData::ERROR_E ProcessRxCommand(char *pCmd, char *pData) {
// Grab the talker ID
uint16_t u16TalkerID = (uint16_t)((uint8_t)pCmd[0]) << 8;
u16TalkerID |= (uint16_t)((uint8_t)pCmd[1]);
// Get the sentence ID, --XXX where XXX is the sentence ID
char *lpszSentenceID = &pCmd[2];
// Debug verbosity
printf("Cmd: %s, TalkerID:%c%c, Sentence ID: %s\n", pCmd, (u16TalkerID >> 8) & 0xFF, (u16TalkerID) & 0xFF, lpszSentenceID);
// Call base class to process the command
CNMEAParser::ProcessRxCommand(pCmd, pData);
return CNMEAParserData::ERROR_OK;
}
(Or the verbosity could be embedded in a #define
so it could be turned ON/OFF.)
This way, the example in the documentation would have the very same behavior but the user would be free not to have any verbosity.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.