Ask Your Question

TF tree : incoherent info between tf_monitor and rqt_tf_tree leading to impossible SLAM in gazebo

asked 2017-10-23 02:48:48 -0600

GuillaumeHauss gravatar image

Hi all,

I'm facing some weird issues trying to map a simulated environment in Gazebo with hector mapping. First of all, as you can see in the screenshot besides, tf_monitor and rqt_tf_tree are outputting incoherent data on tf trees. Who should I trust more? And why? image description

Secondly, here is my launch file


<!-- these are the arguments you can pass this launch file, for example paused:=true -->
<arg name="paused" default="false"/>
<arg name="use_sim_time" default="true"/>
<arg name="extra_gazebo_args" default=""/>
<arg name="gui" default="true"/>
<arg name="recording" default="false"/>
<!-- Note that 'headless' is currently non-functional.  See gazebo_ros_pkgs issue #491 (-r arg does not disable
 rendering, but instead enables recording). The arg definition has been left here to prevent breaking downstream
 launch files, but it does nothing. -->
<arg name="headless" default="false"/>
<arg name="debug" default="false"/>
<arg name="physics" default="ode"/>
<arg name="verbose" default="false"/>
<arg name="world_name" default="Parking_resized_processed/model.sdf"/> <!-- Note: the world_name is with respect to GAZEBO_RESOURCE_PATH environmental variable -->
<arg name="respawn_gazebo" default="false"/>
<arg name="use_clock_frequency" default="false"/>
<arg name="pub_clock_frequency" default="100"/>

<!-- set use_sim_time flag -->
<group if="$(arg use_sim_time)">
    <param name="/use_sim_time" value="true" />

<!-- set command arguments -->
<arg unless="$(arg paused)" name="command_arg1" value=""/>
<arg     if="$(arg paused)" name="command_arg1" value="-u"/>
<arg unless="$(arg recording)" name="command_arg2" value=""/>
<arg     if="$(arg recording)" name="command_arg2" value="-r"/>
<arg unless="$(arg verbose)" name="command_arg3" value=""/>
<arg     if="$(arg verbose)" name="command_arg3" value="--verbose"/>
<arg unless="$(arg debug)" name="script_type" value="gzserver"/>
<arg     if="$(arg debug)" name="script_type" value="debug"/>

<!-- start gazebo server-->
<group if="$(arg use_clock_frequency)">
    <param name="gazebo/pub_clock_frequency" value="$(arg pub_clock_frequency)" />
<node name="gazebo" pkg="gazebo_ros" type="$(arg script_type)" respawn="$(arg respawn_gazebo)" output="screen"
args="$(arg command_arg1) $(arg command_arg2) $(arg command_arg3) -e $(arg physics) $(arg extra_gazebo_args) $(arg world_name)">
    <!-- Added to prevent TF collision with Hector mapping-->
    <!--<remap from="tf" to="gazebo_tf"/>-->

<!-- start gazebo client -->
<group if="$(arg gui)">
    <node name="gazebo_gui" pkg="gazebo_ros" type="gzclient" respawn="false" output="screen"/>

<!-- fetch the robot model -->
<arg name="model" default="$(find rover)/urdf/rover_fixed.urdf"/>

<!-- Parse urdf file -->
<param name="robot_description" command="$(find xacro)/xacro --inorder $(arg model)" />

<!-- Spawn the robot into Gazebo -->
<node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-param robot_description -urdf -model rover -x 9 -y 0 -z 0" />

<!-- Start rviz display -->
<arg name="rvizconfig" default="$(find rover)/rviz/urdf.rviz" />
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
<node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rvizconfig)" required="true" />

<!-- Start turtlebot teleop key -->
<node name="teleop_key" pkg="turtlebot_teleop" type="turtlebot_teleop_key">
    <remap from="teleop_key/cmd_vel" to="cmd_vel"/>

<!-- start hector_mapping node -->
<arg name="scan_topic" default="scan" />
<node pkg="hector_mapping" type="hector_mapping" name="hector_mapping" output="screen">
    <param name="map_frame" value="map" /><!-- map -->
    <param name="base_frame" value="base_link" /><!-- base_link -->
    <param name="odom_frame" value="odom" /><!--odom-->
    <param name="scan_topic" value="$(arg scan_topic)" />
    <param name="use_tf_scan_transformation" value="true" />
    <param name="use_tf_pose_start_estimate" value="true" /> <!-- false -->
    <param name="map_resolution" value="0.05" />
    <param name ...
edit retag flag offensive close merge delete


I've narrowed down the issue to the Map->Odom TF broadcast. It's 1sec late compared to the gazebo TFs. So, the full link cannot be done between laser and map. But I'm not able to solve this issue either. See for more

GuillaumeHauss gravatar image GuillaumeHauss  ( 2017-10-23 08:07:24 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2020-04-03 12:45:42 -0600

LukeBowersox gravatar image

The reason your seeing disagreement is probably because the topic is available but your not actually publishing it consistently. rqt_tf_tree in my experience is more realistic, if you dont see your transforms there, then your robot wont either. I would try

rosnode info hector_mapping

or replace hector_mapping with whatever is supposed to be generating that transform because it likely isn't getting what it needs. Take a look at your publish speeds and frame ids on your odometery sources and make sure they match.

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



Asked: 2017-10-23 02:48:48 -0600

Seen: 34 times

Last updated: Apr 03 '20