Ask Your Question

How to solve tf problem for hector slam

asked 2014-01-06 18:55:12 -0500

saunders gravatar image

updated 2014-01-16 14:02:32 -0500


I am using hokuyo UTM-30lx to do mapping using hector slam and i am facing a problem when running the hector slam. It shows the following message below:

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

"Trajectory Server: Transform from /map to /base_link failed: Frame id /map does not exist! Frames (4): Frame /base_link exists with parent /base_stabilized. Frame /base_stabilized exists with parent NO_PARENT. Frame /laser exists with parent /base_link."


edited: laser scan cannot be seen if fixed frame is set to base_stabilized in rviz can be seen if fixed frame is set to base_link. target frame: laser

<node name="hokuyo" pkg="hokuyo_node" type="hokuyo_node" respawn="false" output="screen">

    <param name="calibrate_time" type="bool" value="true"/> 

    <!-- Set the port to connect to here -->
    <param name="port" type="string" value="/dev/ttyACM0"/> 

    <param name="intensity" type="bool" value="false"/>
    <param name="min_ang" value="-2.356194437"/>   
    <param name="max_ang" value="2.35619443"/>    
    <param name="cluster" value="1"/>

  #### publish an example base_link -> laser transform ###########

  <node pkg="tf" type="static_transform_publisher" name="base_link_to_laser" 
    args="0.0 0.0 0.0 0.0 0.0 0.0 /base_link /laser 40" />
  <node pkg="hector_imu_attitude_to_tf" type="imu_attitude_to_tf_node" name="imu_attitude_to_tf_node" output="screen">
    <remap from="imu_topic" to="thumper_imu" />
    <param name="base_stabilized_frame" type="string" value="base_stabilized" />
    <param name="base_frame" type="string" value="base_link" />

<node pkg="hector_mapping" type="hector_mapping" name="hector_mapping" output="screen">
 <param name="pub_map_odom_transform" value="true"/>
 <param name="map_frame" value="map" />
 <param name="base_frame" value="base_stabilized" />
 <param name="odom_frame" value="base_stabilized" />
 <param name="output_timing" value="false"/>
 <param name="use_tf_scan_transformation" value="true"/>
 <param name="use_tf_pose_start_estimate" value="false"/>
 <param name="scan_topic" value="scan"/>
<!-- Map size / start point -->
<param name="map_resolution" value="0.025"/>
<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_update_distance_thresh" value="0.1" />
<param name="map_update_angle_tresh" value="0.3" />
<param name="laser_z_min_value" value="-1.0" />
<param name="laser_z_max_value" value="1.5" />
<!-- 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.06" />
<param name="pub_map_odom_transform" value="true"/>
<param name="pub_drawings" value="true"/>
<param name="pub_debug_output" value="true"/>
<param name="hector_mapping/pub_map_odom_transform" value="true"/>
<include file="$(find hector_geotiff)/launch/geotiff_mapper.launch" />


How do i solve this problem? Thanks in advance

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2014-01-06 21:14:56 -0500

If this is happening only once or twice shortly after startup, this should not be a problem (and I´ll have to look into suppressing the message, as a few people got confused by this already, for example here). If the problem persists and you don´t get a map out of the system, your tf setup most likely is not correct. It seems you try to use the "/thumper_imu" topic to publish the roll and pitch angle of the robot to tf (a setup that I used on one of our robots some time ago). Is that intended? If not, you should have a look at the hector_slam setup tutorial and the links there to see how a proper tf setup can be done.

edit flag offensive delete link more


Hi, i am not sure what does the "<remap from="imu_topic" to="thumper_imu">" does but whether i include it or not the problem still persist. I understand that the tf relation as (map->odom->base_footprint->base_stabilized->base_link->laser). For my case i am using hector slam for quadrotor which does not have any odometry thus i presume that the tf relation is (map->base_stabilized->base_link->laser).

saunders gravatar imagesaunders ( 2014-01-07 13:22:31 -0500 )edit

You have to have some way of providing the roll/pitch angles of your platform via tf. I did that in the example launch file by publishing IMU data on the "thumper_imu" topic. This probably is not published on your system.

Stefan Kohlbrecher gravatar imageStefan Kohlbrecher ( 2014-01-08 04:29:43 -0500 )edit

For the imu data, i am using the imu_attitude_to_tf_node. The problem i have is that i my imu data does not contain linear_acceleration_covariance and angular_velocity_covariance as my imu provides the euler angle x,y,z. What i did is i convert it to quaternion in order for me to use the imu_attitude_to_tf_node. So the imu data is a "customized" imu data but i had no idea what do i need to do for the angular_velocity_covariance and linear_acceleration_covariance so i basically set the first index of the two arrays to -1. Could that be the source of the problem?

saunders gravatar imagesaunders ( 2014-01-08 13:40:19 -0500 )edit

No the imu_attitude_to_tf just uses the quaternion and publishes roll/pitch to tf, see code:

Stefan Kohlbrecher gravatar imageStefan Kohlbrecher ( 2014-01-08 21:27:39 -0500 )edit

I did manage to get the imu_attitude_to_tf_node working and it successfully publish the base_stabilized. Since i am using hector mapping for odom and mapping itself, according to the setup the base_frame and odom_frame will be base_stabilized right? if it is correct i have no idea why hector mapping itself is not running correctly.

saunders gravatar imagesaunders ( 2014-01-09 15:29:23 -0500 )edit

Yes, that should be correct. Can you update the original post with more information on what is not working?

Stefan Kohlbrecher gravatar imageStefan Kohlbrecher ( 2014-01-09 19:55:18 -0500 )edit

From tf viewframe it shows "base_stabilized->base_link->laser" It seems that the problem lies between the transform from map to base_stabilized.

saunders gravatar imagesaunders ( 2014-01-14 13:14:32 -0500 )edit

So you are still getting the original error message posted in the original question, or something else?

Stefan Kohlbrecher gravatar imageStefan Kohlbrecher ( 2014-01-14 20:42:04 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2014-01-06 18:55:12 -0500

Seen: 4,024 times

Last updated: Jan 16 '14