Disagreement between TransformStamped comment and sendTransformMessage?
The comment in the TransformStamped message states:
This expresses a transform from coordinate frame header.frameid to the coordinate frame childframe_id
While the sendTransformMessage function documentation states:
Broadcast the transformation from tf frame child to parent on ROS topic "/tf".
In my experience the sendTransformMessage
documentation is correct, i.e. the transform is from the child frame to the parent frame, and it appears the comment in the TransformStamped
is backwards. This caused me a lot of confusion and I'm sure I'm not the only one. Is my interpretation correct? Should the TransformStamped
message comment be corrected?
Side note: I know the links above are from different versions of ROS. I'm using noetic but can't seem to find complete documentation for noetic's tf2 python implementation. I'm assuming the documentation given above is true for sendTransform
in noetic, and my own testing has confirmed this.
Asked by specarmi on 2023-07-04 09:54:19 UTC
Answers
I think that both comments are correct, assuming you distinguish a subtle difference between the words "transform" and "transformation".
The pose in the TransformStamped
message describes the pose of the child frame within the parent frame. For example, using standard xy axes and identity quaternion, the msg value transform.translation.x = 1 places the child_frame origin to the right of the parent_frame origin. The TF Tree clearly describes a parent to child relationship.
The terminology gets less clear if your goal is to convert a child pose into the equivalent parent frame pose. You can reformat the TF msg as an equivalent homogeneous 4x4 matrix M and use this linear algebra equation:
pose_in_parent = M * pose_in_child
If you expect to use this equation, then M can be interpreted as providing a "transformation" operation from child_frame to parent_frame, which is what that second comment is describing.
Asked by Mike Scheutzow on 2023-07-05 09:25:17 UTC
Comments
My understanding is that "transform" is just used as a shorthand for "transformation" in ROS. For what it's worth, this foxglove blogpost states this directly. Also, I agree there are subtleties and sometimes ambiguity with phrases like "pose of frame A in/within frame B" or "pose of frame A w.r.t. frame B," but in this case both sources use the phrasing "transform[ation] from frame A to B," which I have always taken to mean that expressing it as a homogeneous 4x4 matrix T_A_to_B the following is satisfied: p_B = T_A_to_B * p_A, where p_A is a homogeneous point coordinate expressed in frame A. Can you clarify again the distinction you view between the phrasing "transform from frame A to B" and "transformation from frame A to B," or point to ROS documentation clarifying this distinction? Apologies if I have just gotten myself turned around somehow
Asked by specarmi on 2023-07-05 10:12:09 UTC
The problem that you're seeing is that the value of the transform depends on what the object is that you are applying the transform, the data in frame A or the frame itself.
The sendTransform documentation is ambiguous and references the data transform, whereas the message is not and fully references the frame. The sentTransform documentation could be made more explicit to do this differentiation.
There's a duplicate question and answer here: https://answers.ros.org/question/194046/the-problem-of-transformerlookuptransform/
People most often encounter this in lookup vs echo: https://github.com/ros/geometry/issues/108
Asked by tfoote on 2023-07-05 19:34:44 UTC
Comments