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

Getting hector_SLAM to work with Neato Lidar, tf issues?

asked 2016-06-06 14:40:21 -0500

ateator gravatar image

updated 2016-06-06 15:56:47 -0500

First off, I understand that versions of this question have been asked before, but I have already scoured through ROS wiki, ROS answers, google, etc. and I'm still lost. I am brand new to Linux, and ROS, but have MUCH time to devote to learning this material.

I am running a fresh install of Ubuntu 16.04 and ROS Kinetic. My objective is to use the Neato Lidar and Hector SLAM to create a 2D map of our office. I have the Lidar running and it can create real-time maps on rviz, but I am having issues when trying to implement Hector SLAM. I think my problem stems from a tf issue. In order to get to this point, I used this tutorial: . I had already completed everything to get the Lidar drivers running (as in the tutorial, but from the ROS source), and the tutorial was useful to help me understand how to get the SLAM installed. But, in the very last step when I launch the neato.launch file, I get a repeating error of

 lookupTransform base_footprint to laser timed out. Could not transform laser scan into base_frame

and a one-time error of

No transform between frames /map and /base_link available after 20.002796 seconds of waiting. This warning only prints once.

My launch files are as follows.. neato.launch :

<?xml version="1.0"?>


  <!--<node pkg="xv_11_laser_driver" type="neato_laser_publisher" name="xv_11_node">
    <param name="port" value="/dev/ttyACM0"/>
    <param name="firmware_version" value="2"/>
    <param name="frame_id" value="laser"/>

  <node pkg="tf" type="static_transform_publisher" name="map_to_odom" args="0.0 0.0 0.0 0 0 0.0 /odom /base_link 10"/>

  <node pkg="tf" type="static_transform_publisher" name="base_frame_laser" args="0 0 0 0 0 0 /base_link /laser 10"/>

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

  <node pkg="rviz" type="rviz" name="rviz" args="-d rviz_cfg.rviz"/>
  <include file="$(find hector_geotiff)/launch/geotiff_mapper.launch"/>

mapping_default.launch ...

<?xml version="1.0"?>

  <arg name="tf_map_scanmatch_transform_frame_name" default="/scanmatcher_frame"/>
  <arg name="base_frame" default="base_link"/>
  <arg name="odom_frame" default="base_link"/>
  <arg name="pub_map_odom_transform" default="true"/>
  <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="$(arg base_frame)" />
    <param name="odom_frame" value="$(arg 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)"/>

    <!-- Map size / start point -->
    <param name="map_resolution" value="0.050"/>
    <param name="map_size" value="$(arg map_size)"/>
    <param name="map_start_x" value="0.5"/>
    <param name="map_start_y" value="0.5" />
    <param name="map_multi_res_levels" value="2" />

    <!-- Map update parameters -->
    <param name="update_factor_free" value="0.4"/>
    <param name="update_factor_occupied" value="0.7" />    
    <param name="map_update_distance_thresh" value="0.2"/>
    <param name="map_update_angle_thresh" value="0.9" />
    <param name="laser_z_min_value" value = "-1.0" />
    <param name="laser_z_max_value" value = "1.0" />

    <!-- Advertising config --> 
    <param name ...
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2016-06-06 16:09:43 -0500

updated 2016-06-06 16:52:26 -0500

Ask this to yourself: How could be possible to detect the pose of the base_link frame if the obstacles are being detected in another frame (/laser) that it is totally unrelated?

The SLAM cannot be done because it is not possible to "measure" the distance and layout of the obstacles from the base_link frame.

You can easily solve it using a static transform publisher that relate the /base_link and the /laser frames

Here you will have to define the position and orientation of the sensor in the robot base reference system.

For hector slam without odometry may be enough to consider the /base_link and the /laser frame located in the same place.

edit flag offensive delete link more


Thank you for your reply. I will work on this today and get back to you.

ateator gravatar image ateator  ( 2016-06-07 07:08:28 -0500 )edit

After checking my neato.launch file, you can see that there is a static_transform_publisher between /base_link and /laser. This is also seen in my frames.pdf. I think this is what you are suggesting? Please update me if my interpretations of your suggestions are incorrect.

ateator gravatar image ateator  ( 2016-06-07 08:14:11 -0500 )edit

In reference to my neato.launch file, I changed the static_transform publisher between /odom and /base_link to betwwen /map and /base_link. This solved the one time error asking for that link. I still get the recurring error asking for lookupTransform base_footprint to laser

ateator gravatar image ateator  ( 2016-06-07 08:22:49 -0500 )edit

Yet another update: got it (semi) working! i added yet another static_transform publisher between /laser and /base_footprint and not the map is viewable on rviz, I can see cordinate axes moving, and the map builds as I move! It has problems understanding where exactly I am but thats from the laser

ateator gravatar image ateator  ( 2016-06-07 08:44:35 -0500 )edit

You do not have to provide the transform between map and base_link, that transform is the one provided by hector slam

Pablo Iñigo Blasco gravatar image Pablo Iñigo Blasco  ( 2016-06-07 12:27:55 -0500 )edit

concerning: "No transform between frames /map and /base_link available after 20.002796 seconds of waiting. This warning only prints once." It may appear while the slam is not working properly

Pablo Iñigo Blasco gravatar image Pablo Iñigo Blasco  ( 2016-06-07 12:28:56 -0500 )edit

When I delete that line from neato.launch, everything fails to run. Is there a better way to solve this?

ateator gravatar image ateator  ( 2016-06-07 12:58:48 -0500 )edit

It is hard to say, you will have to study in detail the meaning of the different frames. Another question: why you put in your question a command to launch gmapping?

Pablo Iñigo Blasco gravatar image Pablo Iñigo Blasco  ( 2016-06-07 13:54:44 -0500 )edit

answered 2016-06-06 16:30:07 -0500

billy gravatar image

When I use the neato with Hector SLAM, I use a launch file that came with the tutorial that included the needed TFs published as static transforms. If you are publishing your own TFs with the same names you may be having a conflict. Otherwise, check your launch file and see which TFs start with the launch. The only thing that should be required from you for Hector and neato is the laser scanner. BTW: Even when that launch works for me, I get the 2nd error you show.

edit flag offensive delete link more


I will look into this along with the answer posted above. I couldn't find the launch files applicable, so I was trying to break down the ones I did find so that I could understand and modify them.

ateator gravatar image ateator  ( 2016-06-07 07:10:31 -0500 )edit

Question Tools

1 follower


Asked: 2016-06-06 14:40:21 -0500

Seen: 426 times

Last updated: Jun 06 '16