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

The problem of Transformer::lookupTransform

asked 2014-10-02 10:19:35 -0600

fboris gravatar image

Recently, I follow the tf tutorial and try to understand the frame transformation in ROS. But I'm confusing about the API Transformer::lookupTransform and tf_echo First, the usage of tf_echo is shown below.

Usage: tf_echo source_frame target_frame

This will echo the transform from the coordinate frame of the source_frame to the coordinate frame of the target_frame.

So it is clear, I will get the transform that from source_frame to target_frame. I also confirmed it in turtlesim. However, when I saw the tutorial for tf_echo. They say the tf_echo will return "the transform of the turtle2 frame with respect to turtle1 frame". In other words, I should get the transform from target frame to source frame. It is not correct since I verified from the turtlesim.

I wen to see how to get transform. It is clear that in tf_echo.cpp. Everything is fine except this line., target_frameid, ros::Time(), echo_transform);

I compare this line with the API document.

void Transformer::lookupTransform ( const std::string & target_frame, const std::string & source_frame, const ros::Time & time, StampedTransform & transform )

With my inspection, Transformer::lookupTransform will get the transform that from target_frame to source_frame(API naming). However, for some reason, tf_echo swap the these frames. My questions are:

1)What is the meaning of source frame and target frame?

2)Why the usage of tf_echo is different from tutorial

3)Why tf_echo swap the arguments?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2014-10-02 16:55:21 -0600

tfoote gravatar image

The lookup API is named with respect to transforming data from the source frame into the target frame.

When referring to transform between coordinate frames (transforming the frames, it is the inverse of the transform of data between the two frames)

Depending on the documentation if you're referring to the transform value for the data, or the transform value of the coordinate frames you get the inverse value.

edit flag offensive delete link more


According to tf_echo tutorial and command line usage, tf_echo should return me the transform that transformed the source frame to target frame. But the direction of transform is opposite. Do I misunderstand something?

fboris gravatar image fboris  ( 2014-10-03 06:37:13 -0600 )edit

Moreover, can I expect the transformation like this ( ) that will be returned by lookup API?

fboris gravatar image fboris  ( 2014-10-04 00:13:45 -0600 )edit

That is what the lookup API gives you. The tf_echo give you the inverse, which is the transform to move the coordinate frames as a parallel to the published transforms for easier publishing debugging.

tfoote gravatar image tfoote  ( 2014-10-04 18:38:20 -0600 )edit

answered 2022-02-06 14:51:23 -0600

ticotico gravatar image

updated 2022-02-06 15:42:28 -0600

Unfortunately, the documentation of the API is missing one important aspect: It does not explicitely state, which of these transforms are active or passive (see here). This is often one root cause for lots of headache when dealing with transforms. A clear and concise notation would definitively help.

PS: Interesting post that also mentions the inconsistencies.

edit flag offensive delete link more

Question Tools



Asked: 2014-10-02 10:19:35 -0600

Seen: 2,944 times

Last updated: Feb 06 '22