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

hector_slam simulation has impredictable result

asked 2018-05-17 06:35:02 -0500

erenaud gravatar image

updated 2018-05-17 08:36:47 -0500

Hi everyone !

I am quite new to ROS and I'm trying to simulate hector_slam witout odom (only with laser scan). So I have this launch file:

<?xml version="1.0"?>


<arg name="geotiff_map_file_path" default="$(find hector_geotiff)/maps"/>

<param name="/use_sim_time" value="true"/>

<node name="static_tf0" pkg="tf" type="static_transform_publisher" args="1 0 0 0 0 0  /world /map 100"/>

<node pkg="tf" type="static_transform_publisher" name="base_frame_to_laser"
    args="0.0 0.0 0.0 0.0 0.0 0.0 /base_footprint /laser 10" />

<!-- hector_mapping part -->

<arg name="tf_map_scanmatch_transform_frame_name" default="scanmatcher_frame"/>
<arg name="base_frame" default="base_footprint"/>
<arg name="odom_frame" default="base_footprint"/>

<arg name="pub_map_odom_transform" default="true"/>
<arg name="scan_subscriber_queue_size" default="5"/>
<arg name="scan_topic" default="scan"/>
<arg name="map_size" default="2048"/>

<node pkg="hector_mapping" type="hector_mapping" name="hector_mapping" output="screen">

    <!-- Frame names -->
    <param name="map_frame" value="map" />
    <param name="base_frame" value="$(arg base_frame)" />
    <param name="odom_frame" value="$(arg odom_frame)" />

    <!-- Tf use -->
    <param name="use_tf_scan_transformation" value="true"/>
    <param name="use_tf_pose_start_estimate" value="false"/>
    <param name="pub_map_odom_transform" value="$(arg pub_map_odom_transform)"/>

    <!-- Map size / start point -->
    <param name="map_resolution" value="0.050"/>
    <param name="map_size" value="$(arg map_size)"/>
    <param name="map_start_x" value="0.5"/>
    <param name="map_start_y" value="0.5" />
    <param name="map_multi_res_levels" value="2" />

    <!-- Map update parameters -->
    <param name="update_factor_free" value="0.4"/>
    <param name="update_factor_occupied" value="0.9" />
    <param name="map_update_distance_thresh" value="0.4"/>
    <param name="map_update_angle_thresh" value="0.06" />
    <param name="laser_z_min_value" value = "-1.0" />
    <param name="laser_z_max_value" value = "1.0" />

    <!-- Advertising config -->
    <param name="advertise_map_service" value="true"/>

    <param name="scan_subscriber_queue_size" value="$(arg scan_subscriber_queue_size)"/>
    <param name="scan_topic" value="$(arg scan_topic)"/>

    <param name="tf_map_scanmatch_transform_frame_name" value="$(arg tf_map_scanmatch_transform_frame_name)" />

<include file="$(find hector_geotiff)/launch/geotiff_mapper.launch">
    <arg name="trajectory_source_frame_name" value="scanmatcher_frame"/>
    <arg name="map_file_path" value="$(arg geotiff_map_file_path)"/>

<node pkg="rviz" type="rviz" name="rviz"
  args="-d $(find hector_slam_launch)/rviz_cfg/mapping_demo.rviz"/>

After launching, I replay this bagfile .

First of all, I always get a couple of errors/warning:

[ INFO] [1526551583.253319323, 1458504886.633710874]: lookupTransform base_footprint to laser timed out. Could not transform laser scan into base_frame.
[ WARN] [1526551583.527549687, 1458504886.905373068]: No transform between frames /map and scanmatcher_frame available after 1458504886.905373 seconds of waiting. This warning only prints once.
[ INFO] [1526551583.756732086, 1458504887.136855208]: lookupTransform base_footprint to laser timed out. Could not transform laser scan into base_frame.
[ INFO] [1526551584.527718873, 1458504887.901146949]: Finished waiting for tf, waited 1458504887.901147 seconds

1) Is there anything I should worry about ?

During the replay, the result on rviz can be impredictable: sometimes, the base return to its starting position but sometimes it gets completely lost. 2) Why is that ? Is is related to the errors on tf ?

Finally, I noticed that no tf is broadcasted before I replay my bag file. I am able to see a tf tree only after, which look like this: image description

3) Why no tf tree is available before playing my bag file ?

edit retag flag offensive close merge delete


Your google drive link requires me to sign in, but could I ask you to please attach images to your question instead? If it's a PDF, just make a screenshot.

gvdhoorn gravatar image gvdhoorn  ( 2018-05-17 08:08:26 -0500 )edit

Sorry I messed up access right on my google drive and I didn't realize I was able to upload images now :)

erenaud gravatar image erenaud  ( 2018-05-17 08:37:41 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-05-22 04:32:52 -0500

How are you starting the bag file? Make sure you use the --clock option:

rosbag play Lecture3SLAM_Tutorial.bag --clock
edit flag offensive delete link more


Thanks for replyng. Yes I used this option. I gave up hector and went back to gmapping eventually.

erenaud gravatar image erenaud  ( 2018-06-13 08:04:18 -0500 )edit

Question Tools

1 follower


Asked: 2018-05-17 06:35:02 -0500

Seen: 201 times

Last updated: May 22 '18