Robotics StackExchange | Archived questions

tf fixed transforms

Hello ROS users,

I'm slightly confused about how TF handles transforms.

I'm using the tf::TransformBroadcaster class in a node called tf_broadcaster_node for publishing transforms to TF, resulting in the following TF tree:

image description

These frames have fixed transforms (only rotations), represented below as RPY(in degrees) :

I also have a tf_listener_node which is used to query and print these transforms from TF. My expectation was that the fixed-value transforms will be printed exactly as defined above. However, I was surprised to note that they were different:

image description

Question : Why do the fixed transform values differ from their definitions?

I'd appreciate any assistance in helping me understand TF better. Thanks!

Asked by Venkat Ganesh on 2016-11-09 20:23:56 UTC

Comments

Answers

Hi Venkat,

As you might be aware, a rotation can be expressed in several different representations. RPY is often used as it is fairly easy to visualize and recognize what the rotation is, but it has some problems with regards to singularities. Under the hood, TF uses quaterions, which means that if you are broadcasting and listening to a transform in euler angles like RPY, it will have to translated to and from quaternions. A single rotation can be expressed in several different set of RPY angles, for instance, a Pitch of 180 degrees is identical to first a roll of 180 degrees and then a yaw of 180 degrees (Like your camera_frame --> bundler_camera_frame) For your base_link --> camera_frame, it also works out.

An easy way to check that the transforms are what you intend for them is to use the TF plugin in RVIZ. If they are not what you intended, there is another problem, but I suspect this was the root cause.

Asked by rbbg on 2016-11-10 01:10:44 UTC

Comments

Thanks! The rotation convention I've followed is:

  • (yaw around Z, then pitch around new Y, then roll around new X)

I assume you are talking about rotating around fixed X, Y, Z axes?

Asked by Venkat Ganesh on 2016-11-10 18:12:01 UTC

Please view this link to get a better idea of my API usage.

Asked by Venkat Ganesh on 2016-11-10 18:12:19 UTC

I don't know which convention you are using, but this is the reason for the difference. The quaternion api mentions RPY around fixed axis for the setRPY function.

Asked by rbbg on 2016-11-11 00:59:46 UTC