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

tf2 listener transform has child_frame_id as the source and frame_id as the target

asked 2019-08-12 23:05:48 -0500

cgauss gravatar image

When using tfBuffer/tfListener to get a transform, is there a good reason that the source ends up as the child frame id and the target as the frame id? See for example this documentation from Jade (although I am seeing the same thing in melodic. When publishing transforms, in, for example, the tf tutorial, the convention seems to be the opposite.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2019-08-13 03:14:38 -0500

Parent/Child frame relationship and Source/Target frame relationship are different concepts and would not be expected to be ordered the same way all the time.

The Parent/Child relationship is concerned with how a frame is defined. The child frame is defined in terms of the parent frame, so that any changes to the parent or the chain of its parents will effect the location of the child frame (as well as all of its children).

The Source/Target relationship is concerned with looking up the transformation between any two connected frames. In this case the lookup is converting some geometry that is originally defined in the source frame so that it becomes defined in the target frame. These lookups can be between parent/child or child/parent or two different branches, anything as long as the TF frames are connected somehow.

Hope this helps.

edit flag offensive delete link more


Thanks for your response. However, I am still confused as the parent/child of the transform switches when changing the source/target in the tfBuffer lookup call. Thus, it seems it can go either way despite the "tree" (as seen in rosrun tf view_frames) not changing.

cgauss gravatar image cgauss  ( 2019-08-13 19:14:09 -0500 )edit

I see your confusion, the Transform returned when you lookup a TF uses the parent and child frames to represent the source and target frames. Those frames are not referring to the parent/child of the original tree. In fact they could even be child/child in the original tree. So we would not expect the parent/child of a looked up transform to match the original TF tree.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-08-14 06:06:59 -0500 )edit

answered 2021-10-17 01:02:28 -0500

Let's first denote the Euclidean transform by T_AB which transforms a point's coordinates in B frame p_B to the point's coordinates in A frame, p_A,

p_A = T_AB p_B.

Then let's clarify parent, child, target, and source frames.

Parent and child frames

If T_AB is phrased in terms of a ROS geometry_msgs/TransformStamped.msg, then the {A} frame is the parent frame and the {B} frame is the child frame. In ROS schematics, this means

$A \rightarrow B$

Target and source frames

To put T_AB in the context of a ROS Transformer, the {A} frame is the target frame and {B} the source frame in accordance with the lookupTransform API which transforms data from the source frame into the target frame.

edit flag offensive delete link more

Question Tools



Asked: 2019-08-12 23:05:48 -0500

Seen: 1,926 times

Last updated: Aug 13 '19