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

gps: publish nmea message #998

Merged
merged 9 commits into from
Jun 19, 2024
Merged

gps: publish nmea message #998

merged 9 commits into from
Jun 19, 2024

Conversation

tajgr
Copy link
Collaborator

@tajgr tajgr commented Jun 18, 2024

This PR is a partial refactoring of the gps driver.
The driver is now publishing nmea_data stream in addition to position and rel_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.

@tajgr tajgr requested a review from m3d June 18, 2024 15:15
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]
Copy link
Member

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)

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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
Copy link
Member

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?

Copy link
Collaborator Author

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 assertt for None in the following code.

Copy link
Collaborator Author

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'}

@tajgr
Copy link
Collaborator Author

tajgr commented Jun 19, 2024

I performed some additional tests. It could be ready to merge from my site.

Copy link
Member

@m3d m3d left a 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

@tajgr
Copy link
Collaborator Author

tajgr commented Jun 19, 2024

I see except Exception - does it have to be so strong? Maybe ValueError would be sufficient?

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.

@tajgr tajgr merged commit b766e80 into master Jun 19, 2024
6 checks passed
@tajgr tajgr deleted the feature/gps-NMEA branch June 19, 2024 21:06
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

Successfully merging this pull request may close these issues.

2 participants