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

Removing/Deleting/Ignoring odom tf data

asked 2014-06-25 15:45:05 -0500

curranw gravatar image

I've built a custom diff drive robot in gazebo. Everything works great. However, the real version of the simulated robot doesn't have odometry. I get around this by using laser_scan_matcher to simulate odometry, and this also works great.

However, I have issues with the diff drive plugin in gazebo. It pubishes a tf odom frame (gazebo_odom is what I call it), and I can't seem to get rid of it! I try to rename it, but it still has the tf tree connection (gazebo_odom -> base_footprint). If this connection exists, my laser_scan_matcher odom tf frame does't show up when I visualize the tf tree. If I delete the diff drive plugin, my tf tree is built correctly (laser_scan_odom -> base_footprint).

When I run amcl subscribing to my laser_scan_odom tf frame (gazebo_odom ->base_footprint still exists), it localizes correctly, and creates a map -> laser_scan_odom connection in a separate tf tree. Unsure how to connect these trees. A static_transform didn't quite work because the laser_scan_odom tf and gazebo_odom would be connected to base_footprint and conflict with each other. Localization then breaks.

So two questions, one about ROS in general and one about my problem.

  1. In ROS, does the first tf frame created (in this case gazebo_odom), take priority over all other similar tf frames? In other words, why does my laser_scan_odom not appear when gazebo_odom exists, but DOES appear when I remove the gazebo plugin?

  2. How can you get rid of a tf frame? Or completely replace one?

Possible bad or potentially impossible solutions:

  1. Subscribe to the tf tree, erase the tf frame you don't want, and republish?

  2. Re-write the diff drive controller. This seems overkill for making it just not publish a odom tf frame.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2014-06-25 16:35:29 -0500

fergs gravatar image

updated 2014-06-25 16:36:08 -0500

There really isn't a good way to remove a tf frame from the graph as far as I know. And the issue you then see is reparenting. TF supports only a tree, not a generic graph, and thus your robot frame has two parents in the graph, which is illegal and causes headaches. There are two possible fixes:

1) The proper fix is probably to add a ROS parameter to the diff drive controller that disables TF output (honestly, the plugin should support this, since you wouldn't want a TF frame if you were trying to use robot_pose_ekf or similar to merge IMU + odom). I would presume that such a fix could even be merged upstream, making it available to others.

2) The hack I can think of, would be to remap "tf" topic of your plugin to "tf_ignored" (or any topic name that is not "tf"). This would then mean that nobody gets the TF data from the plugin. However -- this will only work if you have no other tf data that you care about being generated by the same node as the plugin (which is all of gazebo I believe). This may not be the case.

edit flag offensive delete link more


Option 1 worked fantastically. Thanks!

curranw gravatar image curranw  ( 2014-06-25 19:06:48 -0500 )edit

answered 2014-06-25 17:00:42 -0500

tfoote gravatar image

If you remap the publisher into a tf_remap node it will then allow you to set parameters to republish the topic with frame_ids selective mapped to unused values so they don't collide with your separately published values.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-06-25 15:45:05 -0500

Seen: 2,100 times

Last updated: Jun 25 '14