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

TransformListener not working in nodelet

asked 2012-09-14 00:29:15 -0500

torstenfiolka gravatar image

updated 2012-09-14 00:29:42 -0500


I am porting a node to a nodelet and having trouble with the TransformListener. In the node it works, but not in the nodelet.


  1. TransformListener is a member variable of the nodelet class
  2. after receiving the first pointcloud the TransformListener is tested:

if( !tfListener->waitForTransform(target_frame_id, cloud->header.frame_id, cloud->header.stamp, ros::Duration(10.0), ros::Duration(0.1), error) ) ...

No exception is thrown, it does simply fail. If I try a tfListener->lookupTransform afterwards it will throw an exception: Unable to lookup transform, cache is empty, when looking up transform from frame [/velodyne] to frame [/world] A call to tfListener->getCacheLength() return 10 seconds, a tfPrefix is not set, an tfListener->getAllFrames() also returns all frames correctly.

The things I tried so far:

  1. making the tfListener a boost shared pointer initialized in onInit() with different NodeHandles an Cache lengths.

  2. Inserting a sleep() for 5-10 seconds after creating the Listener and before testing the Listener

  3. Making a loop with intermitting ros::spinOnce()-Calls for 5-10 seconds
  4. Different Durations for timeout and polling intervall in the waitForTransform()

As stated above, a node with a TransformListener() running parallel to the nodelets has no problem looking up the transform an all calls of getCacheLength(), getAllFrames() give identical results to the nodelet-TransformListener.

Anyone any suggestions?

Regards, Torsten Fiolka

edit retag flag offensive close merge delete



Try setting the time stamp to 0 instead of using cloud->header.stamp to check if there is any transform between your source frame and target frame.

Lorenz gravatar image Lorenz  ( 2012-09-14 02:47:05 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2012-09-17 00:01:59 -0500

torstenfiolka gravatar image

With ros::Time(0) it works.

edit flag offensive delete link more

Question Tools



Asked: 2012-09-14 00:29:15 -0500

Seen: 520 times

Last updated: Sep 14 '12