Rosanswers logo


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

Originally posted by Tirjen on ROS Answers with karma: 808 on 2013-10-29

Post score: 0


1 Answer 1


Rosanswers logo

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.

Originally posted by Stefan Kohlbrecher with karma: 24361 on 2013-10-29

This answer was ACCEPTED on the original site

Post score: 1

Original comments

Comment by Tirjen on 2013-10-29:
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! :)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.