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

Fix #115: Decoding errors #116

Merged

Conversation

evenator
Copy link
Collaborator

@evenator evenator commented Oct 10, 2020

Handle decoding errors when reading from a serial port. NMEA sentences should be ASCII-encoded, but if malformed data comes in from the serial port, it won't decode properly.

If the exception isn't handled, the node will crash. This commonly happens on startup.

When tested with a BU-353S4 receiver, I reproduced the error reported in #115 and now it prints the following warning and does not crash:

[WARN] [1602352879.808924]: Skipped reading a line from the serial device because it could not be decoded as an ASCII string. The bytes were b'f\x06\x16&\x06\xe6\x06\x06\x06\xc6F\x06&v\xe6&\x86Fv\xc6\xe6c\x06v\x96V\x86\xe6\x96\x06f\x16\xc6v\x8dY\xc6\x06v\xc6\x16\xe6\x16\xc6&Vv\xe6v\xc6\xd6c\xd666\xe6\x06\xc6\xd6c\xc6\x06\x06\x06\x06\xa6f6k'

Also a couple of codestyle fixes.

@evenator evenator added bug Fix in Review A fix has been created. Awaiting original reporter's review. labels Oct 10, 2020
@evenator evenator self-assigned this Oct 10, 2020
Handle decoding errors when reading from a
serial port. NMEA sentences should be ASCII-
encoded, but if malformed data comes in
from the serial port, it won't decode properly.
If the exception isn't handled, the node will
crash. This commonly happens on startup.

Also a couple of codestyle fixes.

Signed-off-by: Ed Venator <evenator@gmail.com>
@evenator evenator force-pushed the fix-115-handle-decoding-errors branch from e278b0b to 9749351 Compare October 10, 2020 18:20
Copy link

@donkikos donkikos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested the nmea_serial_driver node after this fix. No crashes as of now.

Used GlobalSat BU-353-S4.

@evenator evenator merged commit 92a799c into ros-drivers:master Oct 12, 2020
@evenator evenator deleted the fix-115-handle-decoding-errors branch October 12, 2020 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fix in Review A fix has been created. Awaiting original reporter's review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants