ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

How to stop gazebo publishing tf

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

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

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 image Mehdi.  ( 2016-03-21 04:42:24 -0600 )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 image Clack  ( 2016-03-21 05:26:13 -0600 )edit

4 Answers

Sort by » oldest newest most voted

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

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 image Clack  ( 2016-03-21 09:15:30 -0600 )edit

It works! Thank you so much!

Clack gravatar image Clack  ( 2016-03-22 02:26:13 -0600 )edit

What confused me is that although I add <remap from="tf" to="gazebo_tf"/> as you mentioned, tf odom still exist.

<include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="$(find autonomus_transport_industrial_system)/worlds/"/>
    <arg name="paused" value="false"/>
    <arg name="use_sim_time" value="true"/>
    <arg name="gui" value="true"/>
    <arg name="headless" value="false"/>
    <arg name="debug" value="false"/>
    <remap from="tf" to="gazebo_tf"/>

rostopic info tf display:

    Type: tf2_msgs/TFMessage

 * /robot_state_publisher (http://localhost:46447/)
 * /camera_front (http://localhost:35855/)
 * /camera_right (http://localhost:43249/)
 * /camera_left (http://localhost:33375/)
 * /gazebo (http://localhost:37939/)

 * /rviz (http://localhost:33813/)
lifuguan gravatar image lifuguan  ( 2020-08-03 00:56:23 -0600 )edit

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

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 -0600

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

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


请问一下老哥最后是怎么解决的呀,我碰到一模一样的问题 谢谢~ 修改完后之后 tf的确去除掉了,但是 gazebo小车模型在不停的抖动

stevekung gravatar image stevekung  ( 2020-12-23 01:53:18 -0600 )edit

In most cases, the robot model shaking because you are providing more than one odometry.

SeanZ gravatar image SeanZ  ( 2021-01-12 02:09:46 -0600 )edit

answered 2020-09-24 08:54:36 -0600

Beft9 gravatar image

Acctually, odom is published by diff_control_drive. you can check in here . if you make its enable_odom_tf parameter false, it wont publish odom no more. if you are using husky it is in the control.yaml.

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 -0600

Seen: 4,571 times

Last updated: Aug 21 '18