Fixing bug where nmea2tfpose would always assume positive coordinates.
Fixed bug
When using the nmea2tfpose
node to produce relative X/Y poses from GGA NMEA messages, all coordinates (regardless of region) were assumed to be positive values. However, coordinate components in S or W directions should be negative in relative X/Y terms.
Steps to reproduce the bug
- Run the
nmea2tfpose
node fromgnss_localizer
. rostopic echo /gnss_pose
- Publish a GGA NMEA sentence to
/nmea_sentence
which contains South or West components (e.g. $GPGGA,0,4807.038,N,01131.000,W,1,08,0.9,545.4,M,46.9,M,,*47 - if publishing withrostopic pub
, make sure to backslash-escape the $). - Publish a GGA NMEA sentence to
/nmea_sentence
which does not contain South or West components (e.g. $GPGGA,0,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47 - if publishing withrostopic pub
, make sure to backslash-escape the $).
Expected behavior
The output pose will be different because the coordinates are in different quadrants.
Actual behavior
The coordinates are the same.
Fix applied
If the 4th component of the GGA sentence is S then convert the longitude to a negative value. If the 6th component of the NMEA sentence is W then convert the latitude to a negative value. Same applied for RMC messages except with the correct sentence component positions.
Props to @shan-astuff for figuring this out and implementing the fix on 1.11.0.
Edited by Joshua Whitley