Ask Your Question

Setting up tf for Hector SLAM

asked 2012-08-02 00:38:28 -0500

BenMa gravatar image

updated 2012-08-02 03:56:58 -0500

Hi, all,

I am trying to get my hokuyo laser node to work with hector_slam to produce realtime SLAM. I have installed hokuyo_node and the laser seems working properly. I also completed the hector_slam tutorial using the "Team_Hector_..bag" file. However, when I rosrun hokuyo_node and hector_slam(through a launch file), I just can't get it right. My launch file settings are as follows:

Then I went back to rerun the hector_slam tutorial, I use rxgraph to check what the nodes/topics are. Then, I found that a "/play node" (play back of the *.bag file in the tutorial) publish a '/tf' topic and "/hector_mapping" node subscribe to it. If I just rosrun hokuyo_node, then the "/hokuyo_node" just publish the '/scan' topic. I guess the problem is here. Can anyone elaborate a little more on this '/tf' and how to resolve it when using real laser scanners? THANKS A LOT.

edit retag flag offensive close merge delete


please share your launch file, i have a same problem too.

Messi gravatar image Messi  ( 2013-06-08 05:15:12 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2012-08-02 03:47:50 -0500

updated 2012-08-02 22:23:39 -0500

Yes, the problem is related to tf not being available. To get an overview of how tf works you can have a look at the following links:

TF tutorials

Hector SLAM setup tutorial

The easiest option to make it work is manually starting a tf publisher that publishes the needed transform from the base_link that you want to have localized to the laser scanner frame. This can be done by adding the following to a launch file:

  <node pkg="tf" type="static_transform_publisher" name="base_to_laser_broadcaster" args="0 0 0 0 0 0 base_link laser 50" />

/edit: This is assuming you have set the hector_mapping parameters like this:

  <param name="pub_map_odom_transform" value="true"/>
  <param name="map_frame" value="map" />
  <param name="base_frame" value="base_link" />
  <param name="odom_frame" value="base_link" />
edit flag offensive delete link more

answered 2012-08-02 16:35:13 -0500

BenMa gravatar image

I added

<node pkg="tf" type="static_transform_publisher" name="base_to_laser_broadcaster"
      args="0 0 0 0 0 0 base_link laser 50"/>

into my launch file. But I always get the error "lookupTransform base_frame to laser timed out.... Frame /laser exists with parent /base_link. Frame /base_link exists with parent NO_PARENT." Is there something else missing? Really appreciate your help.

edit flag offensive delete link more


Hi, updated my answer above. Please comment on answers if you have further questions, as further questions being added as answers tend to confuse people.

Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2012-08-02 22:24:28 -0500 )edit

please share the launch file discussed above.

Messi gravatar image Messi  ( 2013-06-08 05:49:42 -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: 2012-08-02 00:38:28 -0500

Seen: 5,947 times

Last updated: Aug 02 '12