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

What exactly does it mean to "send a transformation from the child to the parent frame"?

asked 2018-04-12 05:04:34 -0500

nbro gravatar image

updated 2018-04-12 05:10:15 -0500

First of all, I would like to say that I have some background in computer graphics (e.g., I know what homogenous transformations, etc., are). So, please, do not explain to me what matrix multiplications are.


I have a question regarding the sendTransform method of the class TransformBroadcaster.

The documentation says:

Broadcast the transformation from tf frame child to parent on ROS topic "/tf".

So, e.g., suppose we subscribe to the topic /turtle1/pose and, in the callback, we use sendTransform, for example

def _send_pose_transform(self, pose):
    br = tf.TransformBroadcaster()

    translation = (pose.x, pose.y, 0)
    rotation = tf.transformations.quaternion_from_euler(0, 0, pose.theta)

    br.sendTransform(translation, rotation, rospy.Time.now(),
                        self.turtle_name, self.parent_frame)

I have at least two questions.

The last two arguments of sendTransform are the child and parent frames. Can either the child or the parent frames be different than the frame of the object associated with the topic I subscribed to (i.e. /turtle1/pose), i.e. can the child or the parent frames be a frame which is not the local frame of turtle1? I suppose the answer is "yes", given that I don't see why this use case should be "forbidden".

Now, my actual questions/doubts.

What exactly does it mean to send a transformation from the child to the parent frame, in this case? Let's now assume that tf keeps track of the local frames of the child and the parent objects. Does "send a transformation from the child to the parent frame" actually mean that tf sends e.g. a homogenous matrix representing the transformation (i.e. rotation and orientation) of a point in the local frame of the child to a point in the local frame of the parent, or is it vice-versa, or something else?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-04-12 05:12:00 -0500

gvdhoorn gravatar image

updated 2018-04-12 05:34:26 -0500

Edit:

Does "send a transformation from the child to the parent frame" actually mean that tf sends e.g. a homogenous matrix representing the transformation (i.e. rotation and orientation) of a point in the local frame of the child to a point in the local frame of the parent, or is it vice-versa, or something else?

I would say this is more what the various transformX(..) methods in TF do. The TransformBroadcaster really only updates the transformation matrices that you refer to (but they're not encoded as matrices, but as separate Vector3 and Quaternion).

re-reading your question you might actually be saying the same as I was. The TransformBroadcaster is not about points, but the transformation matrices themselves. If that is what you were describing, then yes, that is what it is doing. The transformX(..) methods in TF(2) then use those to do the actual transformation of points between those frames.


Could this be a misinterpretation / misquote of the docs? "Broadcasting" is the word used in the docs. This just means: sending a msg to all who are/will listen. "Sending to" implies there is some unidirectional transfer going on. TF does not send anything "from X to Y" (well, the TransformBroadcaster does, but at a different level perhaps).

The example you show just broadcasts a single message that contains the information about a single transform "from the child to the parent frame". It's a piece of information that TF listeners will use to update their tree of transforms.

The "child" and "parent" are just labels (ie: names for humans), not entities in a ROS node graph (ie: nodes or similar active constructs) that receive or send any messages.

From the same docs on TransformBroadcaster:

TransformBroadcaster is a convenient way to send transformation updates on the "/tf" message topic.

All the methods in this class do is send out messages (geometry_msgs/TransformStamped) that inform listeners about a single or multiple edge(s) in the TF tree. Between each node a transformation matrix exists. For new transforms, an edge is added and the matrix attached. For existing transforms, the matrix is updated.

edit flag offensive delete link more

Comments

Sorry, I am asking about the transformation itself which is sent, not to whom or to which topic it is sent.

nbro gravatar image nbro  ( 2018-04-12 05:18:48 -0500 )edit

I believe I touched on that with the last paragraph.

You ask about TransformBroadcaster. That class inherently has to do with topics and msgs, because that is what is used to broadcast this information.

"a transformation" is not a thing in TF. Transforms are broadcast, those contain ..

gvdhoorn gravatar image gvdhoorn  ( 2018-04-12 05:20:05 -0500 )edit

.. translations and rotations in separate fields (but conceptually the same as the matrix you're referring to).

So to broadcast a transform is to publish a msg that contains that information. That is then used by listeners to insert or update edges in their local view of the tree.

gvdhoorn gravatar image gvdhoorn  ( 2018-04-12 05:22:39 -0500 )edit

@gvdhoorn Ok, thanks, it starts to make more sense. I think we should add this "verbose" but, IMHO, helpful description/explanation to the documentation of those methods so that we don't have to click a few times to infer what those methods do.

nbro gravatar image nbro  ( 2018-04-12 05:26:39 -0500 )edit

It's all open-source. There is a good chance an update to the documentation submitted in a PR would be accepted. For TF, the sources are here. For TF2 here.

Note that TF (not TF2) is deprecated.

gvdhoorn gravatar image gvdhoorn  ( 2018-04-12 05:29:06 -0500 )edit

You're saying that TransformStampeds, which are sent, already exist, and we only update them using sendTransform . However, in this tutorial, http://wiki.ros.org/tf/Tutorials/Addi... , a new local frame is created using sendTransform...

nbro gravatar image nbro  ( 2018-04-12 05:37:27 -0500 )edit

TransformStamped is just the msg containing the information. The internal data structure may be different. Doesn't matter, as long as the information (ie: transform) is retained.

re: new or existing: doesn't matter. Both can be done. Each broadcaster notifies listeners that it has ..

gvdhoorn gravatar image gvdhoorn  ( 2018-04-12 05:39:29 -0500 )edit

.. (potentially) new information. If the listener already knew about the transform (ie: received msgs about it earlier), then it updates its internal view of the tree. If it's new, it incorporates the new info (ie: add edge(s)).

gvdhoorn gravatar image gvdhoorn  ( 2018-04-12 05:40:56 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-04-12 05:04:34 -0500

Seen: 1,585 times

Last updated: Apr 12 '18