ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Empty frame_id in `geometry_msgs/PoseStamped`

asked 2021-03-16 03:39:49 -0500

jacka122 gravatar image

updated 2022-05-28 16:57:15 -0500

lucasw gravatar image

I am working on a problem where rosbag files are the benchmarking datasets provided by an external research group. I would like to visualize the 6-DoF pose of the robot which is in the bag. Unfortunately, the topic over which the geometry_msgs/PoseStamped is published has empty frame_id field in the header. And rviz complains that's not a valid name.

How can I visualize the pose? What is the work around for this issue?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-03-16 04:12:37 -0500

gvdhoorn gravatar image

updated 2021-03-16 04:18:49 -0500

How can I visualize the pose?

I don't believe you can. header.frame_id is used to determine in which frame the poses are expressed.

Without that information, RViz would not be able to determine relative to what those poses are supposed to be placed in the 3D space it manages (ie: the render volume).

What is the work around for this issue?

Off the top of my head, two options:

  1. use the rosbag API to fix the .bags. Iterate over all messages and correct header.frame_id, then write them back
  2. use topic_tools/transform to fix the header at runtime: <remap> the original topic coming out of rosbag (while playing) to something (say /bad_poses), now make transform subscribe to that and then have it do something like this:

    rosrun topic_tools transform \
      /bad_poses \
      /original_topic_in_the_bag \
      geometry_msgs/PoseStamped \
      'geometry_msgs.msg.PoseStamped( \
        header=std_msgs.msg.Header(
          seq=m.header.seq,stamp=m.header.stamp, \
          frame_id="my_new_frame") \
        ,pose=m.pose)' \
      --import geometry_msgs std_msgs
    

    note: I've chopped this up for readability, check whether the syntax is still valid, it's all a single line.

    This will publish the fixed poses on /original_topic_in_the_bag (you'd use the correct topic name here of course). You could have it publish on anything, I don't know whether there are other components in your node graph which expect those poses to be published on the topic in the bag.

Suggestion 2 is actually the last example on the topic_tools/transform wiki page.

Suggestion 1 would of course be a permanent fix.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-03-16 03:39:49 -0500

Seen: 754 times

Last updated: Mar 16 '21