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

run hector_slam with LaserScan topic only

asked 2013-06-27 19:14:20 -0500

pseudobot gravatar image

updated 2014-01-28 17:17:05 -0500

ngrennan gravatar image

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.

edit retag flag offensive close merge delete


please, post the output of the command "rosrun tf view_frames", so we can see how your frames are configured.

Procópio gravatar image Procópio  ( 2013-06-27 22:46:48 -0500 )edit

Here it is :

pseudobot gravatar image pseudobot  ( 2013-06-27 23:46:48 -0500 )edit

try putting <param name="map_frame" value="base_link"/> into your launch file

goetz.marc gravatar image goetz.marc  ( 2013-06-27 23:52:52 -0500 )edit

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.

Procópio gravatar image Procópio  ( 2013-06-28 00:17:19 -0500 )edit

@goetz.marc I have try that but still error :(

@Procopio : here it is my bag file, it contains LaserScan /scan topic only :

pseudobot gravatar image pseudobot  ( 2013-06-28 06:16:45 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2013-06-28 06:51:56 -0500

Procópio gravatar image

updated 2013-06-28 06:55:30 -0500

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.


edit flag offensive delete link more


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" ?

pseudobot gravatar image pseudobot  ( 2013-06-28 20:02:14 -0500 )edit

I'm not sure, but I think it would work even if you left it as "true".

Procópio gravatar image Procópio  ( 2013-06-29 06:31:53 -0500 )edit

Question Tools

1 follower


Asked: 2013-06-27 19:14:20 -0500

Seen: 2,710 times

Last updated: Jun 28 '13