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

ValueError for NMEA sentences without nanoseconds in timestamp #135

Open
ctampier opened this issue Aug 27, 2021 · 2 comments
Open

ValueError for NMEA sentences without nanoseconds in timestamp #135

ctampier opened this issue Aug 27, 2021 · 2 comments

Comments

@ctampier
Copy link

Hello!

I'm using ROS Melodic and got this error when working with the nmea_topic_driver node.
Value error, likely due to missing fields in the NMEA message. Error was: invalid literal for int() with base 10: ''

I tracked the error to the parser.py script. Specifically on line 128:
nanosecs = int(nmea_utc[7:]) * pow(10, 9 - len(nmea_utc[7:]))

My GPS reports NMEA strings in the RMC format, the first field in the sentence is the timestamp, which in my case only has a length of 6 digits, causing the aforementioned line to fail.

A possible fix would be changing the line to:
nanosecs = int(nmea_utc[7:]) * pow(10, 9 - len(nmea_utc[7:])) if len(time_str) > 6 else 0

Cheers

@evenator
Copy link
Collaborator

Thanks for reporting this. I may have a chance to address it this week, but I'd welcome a PR from anyone who wants to fix it.

@aristow1
Copy link

i also came across this problem and thankfully this helped me fix it. please update this :)

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

No branches or pull requests

3 participants