ros / geometry2

A set of ROS packages for keeping track of coordinate transforms.
189 stars 273 forks source link

Treating a frame and a transform as the same is unclear without digging into source code #557

Open roshambo919 opened 6 months ago

roshambo919 commented 6 months ago

It is my understanding that tf2's use of PyKDL to do transformations means that the position and orientation construct a classic transformation matrix:

T = [[ M,  p],
     [ 0,  1]]

When this type of transformation is applied to a point, the rotation of the point happens first, then the point is translated in the new rotated frame. It took me several hours of digging in the source code to determine this behavior. My personal definition of a reference frame is that it is the opposite order -- translation first then rotation -- as opposed to frame being synonymous with transform.

This is not necessarily a problem with tf2 BUT caused great headaches trying to understand how to define a frame because the ros2 tf2 tutorials only use translations when defining the frame and use the identity quaternion making it ambiguous which order the operations are applied from just the tutorials.

Moreover, this same behavior is evident when using the function do_transform_pose. That function treats the pose as a transform/frame. This means that a transform's position is defined IN THE ROTATED COORDINATE FRAME i.e. AFTER applying the pose's rotation. Personally, I dislike this definition since now the position is coupled with the orientation. Defining pose as first a translation then a rotation would decouple the two. But since that path is unlikely to ever be realized, I would greatly appreciate some enhanced documentation and/or clarification on my misunderstandings.