Ask Your Question
2

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

Comments

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 -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 image Clack  ( 2016-03-21 05:26:13 -0500 )edit

4 Answers

Sort by » oldest newest most voted
3

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/empty.world" > <remap from="tf" to="gazebo_tf"/> </node>

edit flag offensive delete link more

Comments

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 -0500 )edit

It works! Thank you so much!

Clack gravatar image Clack  ( 2016-03-22 02:26:13 -0500 )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/obstacle_map.world"/>
    <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"/>
</include>

rostopic info tf display:

    Type: tf2_msgs/TFMessage

Publishers: 
 * /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/)

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

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"/> 
</node>
edit flag offensive delete link more

Comments

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

stevekung gravatar image stevekung  ( 2020-12-23 01:53:18 -0500 )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 -0500 )edit
1

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

<gazebo>
    <plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
        ...
        <publishOdomTF>false</publishOdomTF>
        ...
    </plugin>
</gazebo>
edit flag offensive delete link more
0

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

Beft9 gravatar image

Acctually, odom is published by diff_control_drive. you can check in here http://wiki.ros.org/diff_drive_contro... . 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

Stats

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

Seen: 3,894 times

Last updated: Aug 21 '18