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

Build map with hector_slam and SICK laser

asked 2016-05-18 06:35:50 -0600

Marcus Barnet gravatar image

updated 2016-05-19 05:23:20 -0600

Hi to all,

I'm trying to build a map in RVIZ by using hector_slam and my SICK laser, but I'm having lots of problems. What I would like to do is to move around the laser inside my room and build a map in real-time. For this reason, I won't have a robot with odometry topic since I'll physically move the laser around the environment.

I've already read the hector_slam tutorial ( ) and I think I should use tips at point (2), but I don't know in which launch file I have to insert this code. The problem is that I don't know which launch file I should use and how to modify it in order to specify the correct frame to use. For example, if I run roslaunch hector_slam_launch mapping_box.launch, I get this error:

[INFO] [1463570714.703498474]: lookupTransform base_frame to laser timed out. Could not transform laser scan into base_frame.

Can you suggest me what kind of launch file I need to use and how I have to modify it, please? I could not find any good tutorial on how to do this..

EDIT: I've already tried to understand the source code of mapping_default.launch but it comes with no comments or explanations inside and so I really can't understand what it does.

     <arg name="tf_map_scanmatch_transform_frame_name" default="scanmatcher_frame"/>
      <arg name="base_frame" default="base_footprint"/> # what is the meaning of base_footprint?
      <arg name="odom_frame" default="nav"/>  # what I have to specify here?
      <arg name="pub_map_odom_transform" default="true"/> # this has to be set to false?
      <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="base_frame" />
        <param name="odom_frame" value="base_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)"/>
<node pkg="tf" type="static_transform_publisher" name="map_nav_broadcaster" args="0 0 0 0 0 0 base_frame laser 100" />
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-05-19 07:37:40 -0600

gp gravatar image

You have to publish a static transform between scan and base_frame to solve that error. Have a look at this project hector_slam_example . This project uses Hokuyo UTM-30LX with Hector_slam. You can use the launch file "hector_hokuyo.launch" in the launch folder. You will have to replace the hokuyo related parts with SICK i.e. initialising SICK sensor related node. Both of these sensors publish their laser scans on /scan topic so that should not be a problem.

edit flag offensive delete link more

answered 2016-05-18 20:29:55 -0600

panda gravatar image

hector_mapping\launch\mapping_default.launch you can look into the src code to understand all the param meaning

edit flag offensive delete link more


I added an EDIT to my previous topic. I already had a look at that file but I'm not able to understand what it does since there are no comments inside. Do I have to change base_frame and odom_frame? I think yes, but I dont know how. Can you help me please?

Marcus Barnet gravatar image Marcus Barnet  ( 2016-05-19 04:03:46 -0600 )edit

I modified the launch file by setting base_frame to base_frame and odom_frame to base_frame and now I get this error: could not transform laser scan into base_frame. My tf view_frames says that no tf data is received. Why this happen?

Marcus Barnet gravatar image Marcus Barnet  ( 2016-05-19 04:42:08 -0600 )edit

check more info here and add the code below to your launch file

<node pkg="tf" type="static_transform_publisher" name="link1_broadcaster" args="1 0 0 0 0 0 base_link laser 100"/>

notice the args

panda gravatar image panda  ( 2016-05-19 21:49:11 -0600 )edit

Question Tools



Asked: 2016-05-18 06:35:50 -0600

Seen: 1,026 times

Last updated: May 19 '16