Ask Your Question

How to stop gazebo publishing tf

asked 2016-03-21 04:29:25 -0500

updated 2016-03-21 04:30:16 -0500

Hi, all!

Now I'm testing the node /robot_pose_ekf with gazebo simulator. And I have already let /gazebo publish IMU and odometry data to /robot_pose_ekf. Also, /robot_pose_ekf is connected to tf.

However, when I checked the tf tree I found that the transform from odom -> base_footprint was provided by /gazebo but I want it to be /robot_pose_ekf.

I guess it is because both /gazebo and /robot_pose_ekf are publishing /tf. Hence, I think stopping /gazebo publishing /tf can be a possible solution. FYI, I'm using GMapping which subscribes to /tf to provide SLAM functions.

Can anyone tell me how to stop gazebo publishing tf? Or any other solutions to my problem?

Thank you in advance!

edit retag flag offensive close merge delete


An alternative approach is to keep the odom->base_footprint as it is and compensate the odometry drift by adjusting the transform world->odom or map->odom then you just consider the transform world->base_footprint as robot pose. AFAIK this is what happens when you perform localization using i.e AMCL

Mehdi. gravatar imageMehdi. ( 2016-03-21 04:42:24 -0500 )edit

Thanks to your advice, Mehdi. But actually I have a laser scanner used to provide map -> odom. And my goal is to let robot_pose_ekf provide odom -> base_footprint instead of /gazebo itself. The reason why I stick to this is because I have to check if robot_pose_ekf can be used with GMapping.

Clack gravatar imageClack ( 2016-03-21 05:26:13 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted

answered 2016-03-21 06:22:41 -0500

DavidN gravatar image

Use remapping method to map from tf to something like gazebo_tf, just add the remapping tags: <remap from="tf" to="gazebo_tf"/> in the launch file of the empty world.

For example:

<node name="gazebo" pkg="gazebo_ros" type="gzserver" respawn="false" output="screen" args="-e ode worlds/" > <remap from="tf" to="gazebo_tf"/> </node>

edit flag offensive delete link more


Thanks a lot! I'll have a try tomorrow as soon as I get back to my lab :)

Clack gravatar imageClack ( 2016-03-21 09:15:30 -0500 )edit

It works! Thank you so much!

Clack gravatar imageClack ( 2016-03-22 02:26:13 -0500 )edit

answered 2018-08-21 00:54:45 -0500

Subodh Malgonde gravatar image

If your are using a differential drive controller plugin for your robot then you can prevent Gazebo from publishing the odom transfrom by setting publishOdomTF to false

    <plugin name="differential_drive_controller" filename="">
edit flag offensive delete link more

answered 2016-03-22 02:30:23 -0500

updated 2016-03-22 02:31:31 -0500

Thanks to DavidN, my problem is solved :)

Now the node /robot_pose_ekf is providing the transform odom -> base_footprint instead of /gazebo.

FYI, my modification to /opt/ros/indigo/share/gazebo_ros/launch/empty_world.launch is a little bit different than what DavidN has mentioned:

<!-- start gazebo server-->
  <node name="gazebo" pkg="gazebo_ros" type="gzserver" respawn="false" output="screen" 
    args="$(arg command_arg1) $(arg command_arg2) $(arg command_arg3) $(arg world_name)">    
  <remap from="tf" to="gazebo_tf"/> 
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-03-21 04:29:25 -0500

Seen: 2,094 times

Last updated: Aug 21 '18