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

Hector slam with turtlebot in Gazebo

asked 2013-10-29 00:37:13 -0500

Tirjen gravatar image

updated 2013-10-29 01:30:22 -0500


I'm trying to properly use Hector slam in simulation using a turtlebot. I'm using ROS hydro and Gazebo 1.9 on ubuntu 12.04. Once I spawned in Gazebo the turtlebot and the world I created, I use this launch file to start hector slam:


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

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

  <include file="$(find hector_mapping)/launch/mapping_default.launch">
    <arg name="odom_frame" value="odom"/>

   <arg name="trajectory_source_frame_name" value="scanmatcher_frame"/>
   <arg name="trajectory_update_rate" default="4"/>
   <arg name="trajectory_publish_rate" default="0.25"/>

 <node pkg="hector_trajectory_server" type="hector_trajectory_server" name="hector_trajectory_server" output="screen">
    <param name="target_frame_name" type="string" value="map" />
    <param name="source_frame_name" type="string" value="$(arg trajectory_source_frame_name)" />
    <param name="trajectory_update_rate" type="double" value="$(arg trajectory_update_rate)" />
    <param name="trajectory_publish_rate" type="double" value="$(arg trajectory_publish_rate)" />

  <node pkg="hector_geotiff" type="geotiff_node" name="hector_geotiff_node" output="screen" launch-prefix="nice -n 15">
    <remap from="map" to="/dynamic_map" />
    <param name="map_file_path" type="string" value="$(find hector_geotiff)/maps" />
    <param name="map_file_base_name" type="string" value="hector_slam_map" />
    <param name="geotiff_save_period" type="double" value="0" />
    <param name="draw_background_checkerboard" type="bool" value="true" />
    <param name="draw_free_space_grid" type="bool" value="true" />


The slam seems to work when I navigate the robot around, but I'm very surprised by the bad result compared to gmapping. It get lost very easily and the map is very bad. I would like to know if I set up something in the wrong way, or if it depends from the fact that I'm using a fake laser from kinect or maybe that the world in gazebo I created is challenging for hector slam.


If I move the robot only forward/backward the map is correctly reconstructed, but if I make the robot rotate on itself it prints 'SearchDir angle change too large' and it gets totally lost (sometimes it makes position jumps up to 1 meter and more!!).

This is the world I'm using in gazebo: image description

Many thanks!!

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2013-10-29 01:36:25 -0500

It´s recommended to use gmapping if you´re using a Kinect and have a robot that provides odometry. hector_mapping does not work very well with the narrow FOV of the Kinect. See also this Q/A.

edit flag offensive delete link more


Thank you for your answer! Actually I was using hector slam as first step in simulation, but the final purpose was to try to use it for localization (in place of amcl) on a corobot (which has bad odometry and xtion sensor). I think I will search for another solution! thank you! :)

Tirjen gravatar image Tirjen  ( 2013-10-29 02:55:03 -0500 )edit

Question Tools



Asked: 2013-10-29 00:37:13 -0500

Seen: 2,674 times

Last updated: Oct 29 '13