Rosanswers logo

Hello, I am trying to get work with hector_slam using SICK Laser. I want to map a room with SICK laser only. I will carry my notebook with the SICK Laser.

What I have tried :

  1. Record the /scan topic with rosbag record.

  2. Play it again with rosbag play <filename.bag> --clock

  3. Launch this file :

     <node pkg="hector_mapping" type="hector_mapping" name="hector_mapping" output="screen">
         <param name="base_frame" value="base_link"/>
         <param name="odom_frame" value="base_link"/>
         <param name="pub_map_odom_transform" value="true"/>
         <param name="scan_subscriber_queue_size" value="25"/>
         <!-- Map size / start point -->
         <param name="map_resolution" value="0.050"/>
         <param name="map_size" value="2048"/>
         <param name="map_start_x" value="0.5"/>
         <param name="map_start_y" value="0.5" />
         <param name="map_multi_res_levels" value="2" />
     <include file="$(find hector_geotiff)/launch/geotiff_mapper.launch"> </include>
     <node pkg="tf" type="static_transform_publisher" name="map_nav_broadcaster" args="0 0 0 0 0 0 base_link laser 100"/>

But, I got this error :

[ INFO] [1372396116.210768520, 1372324835.547738080]: lookupTransform base_link to laser timed out. Could not transform laser scan into base_frame.
[ERROR] [1372396116.373757080, 1372324835.710765040]: Trajectory Server: Transform from /map to /base_link failed: Frame id /map does not exist! Frames (3): Frame /laser exists with parent /base_link.
Frame /base_link exists with parent NO_PARENT.

I am afraid that my launch file is wrong. Do anyone has .launch for hector_slam that can be use for handheld mapping only. Thank you :)

Update :

Here,it is my result from rosrun tf view_frames :


remove the _ for link

And my .bag file :


Sorry my karma isn't enough to post the picture & link.

Originally posted by pseudobot on ROS Answers with karma: 18 on 2013-06-27

Post score: 0

Original comments

Comment by Procópio on 2013-06-27:
please, post the output of the command "rosrun tf view_frames", so we can see how your frames are configured.

Comment by pseudobot on 2013-06-27:
Here it is : https://dl.dropboxusercontent.com/u/32191086/Public%20Media/Selection_001.png

Comment by goetz.marc on 2013-06-27:
try putting into your launch file

Comment by Procópio on 2013-06-28:
when you start hector_slam it prints a bunch of stuff in the initialization phase, can you also post that, please? If your bag file is not too big I can try to process it here and tell you what you are missing.

Comment by pseudobot on 2013-06-28:
@goetz.marc I have try that but still error :(

@Procopio : here it is my bag file, it contains LaserScan /scan topic only : https://dl.dropboxusercontent.com/u/32191086/Public%20Media/pioneer_laser_1.bag


1 Answer 1


Rosanswers logo

So, it is actually quite simple, just add this line to your launch file:

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

and play your bag file with the --clock argument:

rosbag play pioneer_laser_1.bag --clock

this modifications will make the clock of your bag file to be used, instead of the current system time. Without them, you would have a large difference in time between the time you got your laser scans and the current time of your static transformation. Then the system would disregard your static transform because your scans were too old.

If you had recorded the static transformation together with the scan in the bag file, you would probably have it working in the first try.


Originally posted by Procópio with karma: 4402 on 2013-06-28

This answer was ACCEPTED on the original site

Post score: 1

Original comments

Comment by pseudobot on 2013-06-28:
Thanks, I can play that now & the map coming in the rviz. Btw, if I am using with realtime scanner, I must set that param value to "false" ?

Comment by Procópio on 2013-06-29:
I'm not sure, but I think it would work even if you left it as "true".


Your Answer

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