Revision history [back]

Hmm, that is weird. Looking at the python documentation it looks like you're correct:

lookupTransform(target_frame, source_frame, time) -> (position, quaternion)


Then, looking at the cpp documentation, the order is the same:

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


But for some reason, the code for the tf_echo tool has this:

echoListener.tf.lookupTransform(source_frameid, target_frameid, ros::Time(), echo_transform);


So it looks like that will definitely provide the inverse of what your python function is providing.

I suppose that was on purpose though? The documentation for lookupTransform (in the python documentation) says it

Returns the transform from source_frame to target_frame

I read this as "the target_frame, with respect to the source_frame".

And the documentation for the tf_echo tool says:

tf_echo <source_frame> <target_frame>- Print information about a particular transformation between a source_frame and a target_frame. For example, to echo the transform between /map and /odom: rosrun tf tf_echo /map /odom

This is worded vaguely, the word "between" doesn't indicate direction. If this is the way tf_echo is suppose to work, it should really say something like "the source_frame, with respect to the target_frame", but why would you want the source_frame described in the target_frame? I wonder if this is an error.

Hmm, that is weird. Looking at the python documentation it looks like you're correct:

lookupTransform(target_frame, source_frame, time) -> (position, quaternion)


Then, looking at the cpp documentation, the order is the same:

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

Get the transform between two frames by frame ID.
Parameters:
target_frame The frame to which data should be transformed
source_frame The frame where the data originated
time The time at which the value of the transform is desired. (0 will get the latest)
transform The transform reference to fill.


I read that to mean it returns the source_frame described with respect to the target_frame.

But for some reason, the code for the tf_echo tool has this:

echoListener.tf.lookupTransform(source_frameid, target_frameid, ros::Time(), echo_transform);


So it looks like that will definitely provide the inverse of what your python function is providing.

I suppose that was on purpose though? The documentation for lookupTransform (in the python documentation) says it

Returns the transform from source_frame to target_frame

I read this as "the target_frame, with respect to the source_frame".

And the documentation for the tf_echo tool says:

tf_echo <source_frame> <target_frame>- Print information about a particular transformation between a source_frame and a target_frame. For example, to echo the transform between /map and /odom: rosrun tf tf_echo /map /odom

This is worded vaguely, the word "between" doesn't indicate direction. If this is the way tf_echo is suppose to work, it should really say something like "the source_frame, "this prints the target_frame described with respect to the target_frame", but why would you want the source_frame described in the target_frame? source_frame". I wonder if this is an error.

At a minimum the description should be made more clear.