ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Can't get a tf from two elements of a connected tree

asked 2013-07-15 19:59:46 -0600

madmax gravatar image

updated 2014-01-28 17:17:16 -0600

ngrennan gravatar image

I am not able to get a transformation from "base_laser_link" to the "map" frame Although they are connected in the tf view.
TransformPoint always throws an exception.
Also when I use waitForTransform, it will always return 0. Setting the duration higher won't help either.

Don't know what I could do here...

Here is for example my callback function:

 void markerDetectionCallback(const sensor_msgs::LaserScanConstPtr& msg)
MarkerDetection detector;


    if(listener_.waitForTransform("/map", "/base_laser_link", msg->header.stamp, ros::Duration(1)))
        ROS_INFO("transform OK");
        ROS_ERROR(" Marker node waitForTransform failed");

catch (tf::TransformException ex){

This also fails :

           listener_.transformPoint("map", p1, p1_out);

with Frame id /map does not exist! Frames (1)

tf_monitor returns this information and looks fine:

RESULTS: for /base_laser_link to /map
Chain is: /map -> /central_server/map -> /odom -> NO_PARENT -> /base_link -> /base_link -> /base_link
Net delay     avg = 0.0276587: max = 0.0562334

tf tf_echo /base_laser_link /map

Failure at 1373963487.596705661
Exception thrown:Lookup would require extrapolation into the past.  Requested time 1373963487.580510149 but the earliest data is at time 1373963487.796449639, when looking up transform from frame [/map] to frame [/base_link]

The current list of frames is:
Frame /base_link exists with parent /odom.
Frame /odom exists with parent /map.
Frame /map exists with parent /central_server/map.
Frame /central_server/map exists with parent NO_PARENT.
Frame /base_laser_link exists with parent /base_link.
Frame /ultrasonic_left exists with parent /base_link.
Frame /ultrasonic_right exists with parent /base_link.

At time 1373967822.996
- Translation: [-13.529, -29.468, 0.000]
- Rotation: in Quaternion [-0.000, -0.000, 0.286, 0.958]
            in RPY [-0.000, -0.000, 0.579]

So tf_echo should be fine.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-07-15 20:10:22 -0600

tfoote gravatar image

Your problem is that you are not giving your listener time to fill it's buffer. You need to create the listener in a persistent location and then query it on demand. I recommend reading through the tf and Time tutorial

edit flag offensive delete link more


Well, was a copy and paste mistake. The listener is a member variable. Do I have to start the listener somehow? Because just writing tf::TransformListener listener_; in the private field of the class starts the listener by invoking the constructor of the class?

madmax gravatar image madmax  ( 2013-07-15 20:58:26 -0600 )edit

If you need more help, please provide the exact errors you are getting and an example of you tf tree.

tfoote gravatar image tfoote  ( 2013-07-15 21:14:21 -0600 )edit

with NO_PARENT in the middle of the chain it is not connected.

tfoote gravatar image tfoote  ( 2013-07-15 21:55:20 -0600 )edit

Yes, but why is rviz able to show me the transformation and tf view_frames? And tf echo says it fails because it would require extrapolation into the past... I may have to look how the tf's are generated, but most of them seem to be static transformers. Strange.

madmax gravatar image madmax  ( 2013-07-15 22:35:02 -0600 )edit

The exception you have pasted still has the same problem I noted above that you have not let the transform listener build up it's buffer before you query it. The buffer will not back fill data, it must be receiving data already before you can query it.

tfoote gravatar image tfoote  ( 2013-07-16 22:16:01 -0600 )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: 2013-07-15 19:59:46 -0600

Seen: 863 times

Last updated: Jul 15 '13