ros-drivers/nmea_navsat_driver

frame_id pre-appended by a forward slash

Closed this issue · 4 comments

I have been observing that the nmea_serial_driver node pre-appends a forwardslash onto whatever frame_id is specified, even the default of "gps" becomes "/gps". This causes errors in nodes that try to use this transform. I am specifically using robot_lacalization's gps_transform_node which cannot support frame_id's starting with a forwardslash.

Edit:

According to the tf2/Migration Wiki:

Removal of support for tf_prefix
One feature which has never really worked was the tf_prefix parameter. tf_prefix was an attempt to parallel the namespacing capability of ROS but for tf frame_ids. However, without core support built in the tf_prefix languished and required a significant amount of work for all developers to implement it correctly. Only a small fraction of packages implemented tf_prefix correctly and for tf_prefix to work correctly it requires all packages interacting with the data to be fully implemented. Thus tf_prefix was only useful for very limited use cases.

tf2 does not support tf_prefix. To avoid confusion tf2 asserts that all frame_ids do not start with /. To make this work tf::resolve will still work to join a tf_prefix and a frame_id, but it will no longer support escaping a frame_id which starts with '/'. tf2 will treat all frame_ids as string literals. All pass throughs from tf to tf2 will strip the leading slash.

To support multiple homogeneous tf trees. As multiple master techniques develop for ROS it is expected that there will be tools developed which will expose subsets of tf data onto foreign masters.

I'm having the same problem! I posted it as an issue, I hope to find a solution since I'm stuck with my research work!

EDIT: Didn't see this earlier. Check out this pull request: ---> Removed automatic prefixing of forward slash to frame_id #33

Any news/changes yet? What is the preferred method to fix this as I need this to work as well and just have been using a "dirty hack" by assuming the user inputs the frame_id they desire and thus comment out these sections of code inside nmea_navsat_driver/src/libnmea_navsat_driver/driver.py :

def get_frame_id():
    frame_id = rospy.get_param('~frame_id', 'gps')
    if frame_id[0] != "/":
        """Add the TF prefix"""
        prefix = ""
        prefix_param = rospy.search_param('tf_prefix')
        if prefix_param:
            prefix = rospy.get_param(prefix_param)
            if prefix[0] != "/":
                prefix = "/%s" % prefix
        return "%s/%s" % (prefix, frame_id)
    else:
        return frame_id

Changed to:

def get_frame_id():
        frame_id = rospy.get_param('~frame_id', 'gps')
#        if frame_id[0] != "/":
#            """Add the TF prefix"""
#           prefix = ""
#            prefix_param = rospy.search_param('tf_prefix')
#           if prefix_param:
#                prefix = rospy.get_param(prefix_param)
#               if prefix[0] != "/":
#                    prefix = "/%s" % prefix
#           return "%s/%s" % (prefix, frame_id)
#        else:
    return frame_id ```

This will be fixed shortly by #33. See the comments on that PR for more details.

Closed as fixed by #33.