Rosanswers logo

Hello !

I try to get the situation of my robot using the following code:

tf::TransformListener listener;
tf::StampedTransform transform;
listener.lookupTransform("/move_base/local_costmap/global_frame", "/move_base/local_costmap/robot_base_frame", ros::Time::now(), transform);

and use it using the following methods:


My problem is when I run this code, I get the the following error:

[ERROR] [..., ...]: "move_base/local_costmap/global_frame" passed to lookupTransform argument target_frame does not exist.

But when I check the "move_base/local_costmap/global_frame" parameter existence (the same with the "move_base/local_costmap/robot_base_frame" parameter), I find that it exists well and is settled to 'odom' value (respectively 'base_link').

I also tried to write directly "odom" and "base_link" instead of "move_base/local_costmap/global_frame" and "move_base/local_costmap/robot_base_frame" but I have the same error:

[ERROR] [..., ...]: "odom" passed to lookupTransform argument target_frame does not exist.

However, when I do:

rosrun tf view_frames

I have the following tree: image description
The first and the third frames are those which interest me.

Moreover, when I use the command:

rosrun tf tf_monitor odom base_link

I have this:

RESULTS: for odom to base_link
Chain is: odom -> base_footprint -> base_link
Net delay     avg = 0.00599856: max = 0.016

Frame: base_footprint published by unknown_publisher Average Delay: 0.000963 Max Delay: 0.005
Frame: base_link published by unknown_publisher Average Delay: -0.500052 Max Delay: 0

All Broadcasters:
Node: unknown_publisher 146.156 Hz, Average Delay: -0.102412 Max Delay: 0.005

If someone can help me, I will be very grateful,

Originally posted by lfr on ROS Answers with karma: 201 on 2016-05-26

Post score: 0

Original comments

Comment by NEngelhard on 2016-05-27:
Check my update with waitforTransform


1 Answer 1


Rosanswers logo

You have to pass the frame name directly to lookupTransform and not the name of a parameter that contains the frame name. You can't expect such a function to decide if you passed the name of a frame or of a parameter.

Next, you should add a listener.waitForTransform before you try to look up. You just created the listener so it had no time to collect any transformations on the /tf-topic.

BTW: You should have a look at TF2. It reduces the used bandwidth and gets rid of the republishing of static transformations.

Originally posted by NEngelhard with karma: 3519 on 2016-05-26

This answer was ACCEPTED on the original site

Post score: 2

Original comments

Comment by lfr on 2016-05-27:
Thank you for answering me.
I already tried to use 'odom' instead of "move_base/local_costmap/global_frame" and 'base_link' instead of "move_base/local_costmap/robot_base_frame" but it generates the same error with 'odom'.

Comment by NEngelhard on 2016-05-27:
What is published on /tf and /tf_static?

Comment by lfr on 2016-05-27:
On /tf, a lot of things are published non-stop but nothing is published on /tf_static.
This is a sample of data published on /tf:

  • header: seq: 0 stamp: secs: 77 nsecs: 129000000 frame_id: odom child_frame_id: base_footprint

Comment by lfr on 2016-05-27:

    x: 0.000368870873302
    y: 0.000194895575539
    z: 0.0839691068639
    x: -3.22346543618e-07
    y: 4.25625394189e-07
    z: 0.000436463216874
    w: 0.99999990475

Comment by lfr on 2016-05-27:
Thank you, it works successfully !!
Really thank you.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.