Ask Your Question

The problem of Transformer::lookupTransform

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

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

1 Answer

Sort by ยป oldest newest most voted

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

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 -0500 )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 -0500 )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 -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: 2014-10-02 10:19:35 -0500

Seen: 1,900 times

Last updated: Oct 02 '14