-
Notifications
You must be signed in to change notification settings - Fork 12
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
gps: publish nmea message #998
Conversation
osgar/drivers/gps.py
Outdated
nmea_data["sats"] = None if nmea_list[7] == "" else int(nmea_list[7]) | ||
nmea_data["hdop"] = None if nmea_list[8] == "" else float(nmea_list[8]) | ||
nmea_data["alt"] = None if nmea_list[9] == "" else float(nmea_list[9]) | ||
nmea_data["a-units"] = None if nmea_list[10] == "" else nmea_list[10] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you use minus here as key? (vs. utc_time, lat_dir, etc)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is actually copied from https://docs.novatel.com/OEM7/Content/Logs/GPGGA.htm
I can replace it by "_". No problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed.
@@ -140,7 +179,8 @@ def process_gen(self, data): | |||
ret = self.process_packet(packet) | |||
if ret is not None: | |||
for k, v in ret.items(): | |||
yield k, v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, the receiver is maybe interested that data from GPS are coming but there is no signal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it follows the original code because there is an assert
t for None in the following code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a sample output without signal:
python -m osgar.logger ../logs_osgar/test-gps-ublox-240619_100528.log --stream gps.nmea_data
0:00:00.158972 3 {'identifier': '$GPGGA', 'lon': None, 'lon_dir': None, 'lat': None, 'lat_dir': None, 'utc_time':'100528.113', 'quality': 0, 'sats': 0, 'hdop': None, 'alt': None, 'a_units': 'M', 'undulation': 0.0, 'u_units': 'M', 'age': None,'stn_id': '0000'}
I performed some additional tests. It could be ready to merge from my site. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, you are the primary user, so if that works for you ... hmm now I see except Exception - does it have to be so strong? Maybe ValueError would be sufficient? Feel free to merge
You are right. The exception shouldn't be so wide. I wonder if there was a reason for this exception in the past (old parser). Probably not. Thanks. |
This PR is a partial refactoring of the gps driver.
The driver is now publishing
nmea_data
stream in addition toposition
andrel_position
. The driver first gets data from nmea sentence and then calculate old position in ms.There is also corresponding modification of gps unit tests.
The code is tested on two logs with different gps receivers for now. In this moment I would like to continue in testing because the reliability of this driver is very important.