6.3.4. Coordinate Transformations in 2-D¶
See also
This video by Peter Corke discusses transformation matrices to apply both translation and rotation.
We transform coordinate frames to specify the locations of points relative to different coordinate frames. For example, we might know the location of an object in the world coordinate frame (\(\{W\}\)), but we need to know its location relative to coordinate frame \(\{B\}\), which is the end effector of the two-arm serial-link robot shown in Fig. 6.17.
Transformations of coordinate frames work differently from transformations of points. As shown in figure Fig. 6.15, each coordinate frame transformation starts with a rotation of the frame and then a translation relative to the rotated frame. Building a compound coordinate frame describing one frame relative to another, as shown in figure Fig. 6.16 and figure Fig. 6.17, requires a sequence of matrix multiplications. We start with the previous coordinate frame and multiply each sequential transform matrix until we reach the desired coordinate frame position. We write the order of transformation multiplications from left to right.
>> R
R =
0.9651 -0.2619 0
0.2619 0.9651 0
0 0 1.0000
>> Tx
Tx =
1 0 2
0 1 0
0 0 1
A_frame = R*Tx;

Fig. 6.15 A transformation that traverses a straight rigid body to a new coordinate frame at the other end of the rigid body. It rotates the frame and then translates the frame along the \(x\) axis.¶

Fig. 6.16 The pose of the coordinate frame represents the end effector \(\{E\}\), which is defined relative to the world frame by the homogeneous coordinate transformation \({}^W\mathbf{T}_E = \mathbf{R}(\theta) \mathbf{Tx}(a)\).¶
Consider the pose at the end of a single robotic arm as shown in figure Fig. 6.16. Since the rotation changes the orientation of the coordinate frame, the translation is only along the \(\bm{x}\) axis. If a rigid body also has a displacement in the direction of the \(\bm{y}\) axis, we can use a second translation matrix, or specify the translation matrix as having both \(x\) and \(y\) components.
We read the nomenclature of the coordinate frame transformation \({}^W\mathbf{T}_E\) as the transformation with respect to the world frame, \(\{W\}\), yielding frame \(\{E\}\). The reference frame is a prescript to the transformation symbol \(\mathbf{T}\), while the label of the resulting frame is a subscript.

Fig. 6.17 A coordinate frame for each joint is created by multiplying transform matrices.¶
We define a coordinate frame for each joint of serial-link robot arms. As shown in figure Fig. 6.17, the composite coordinate frames are products of the transformation matrices from the world coordinate frame to each joint.
If we know the position of a point relative to a transformed coordinate frame. Then, the point’s location in the world coordinate frame is the product of the transformation matrices and the point location in the transformed coordinate frame. However, if we know a point location in the world coordinate frame and want its location in another coordinate frame. Then, we multiply the point location by the inverse of the transformation.
>> q1 = 30; q2 = -15; % degrees
>> a = 8; b = 3.5;
>> RA
RA =
0.8660 -0.5000 0
0.5000 0.8660 0
0 0 1.0000
>> TA
TA =
1 0 8
0 1 0
0 0 1
>> WTA = RA*TA % transform: world to A
WTA =
0.8660 -0.5000 6.9282
0.5000 0.8660 4.0000
0 0 1.0000
>> RB
RB =
0.9659 0.2588 0
-0.2588 0.9659 0
0 0 1.0000
>> TB
TB =
1.0000 0 3.5000
0 1.0000 0
0 0 1.0000
>> ATB = RB*TB % transform: A to B
ATB =
0.9659 0.2588 3.3807
-0.2588 0.9659 -0.9059
0 0 1.0000
>> B_frame = WTA*ATB % transform: world to B
B_frame =
0.9659 -0.2588 10.3089
0.2588 0.9659 4.9059
0 0 1.0000
% point in B to World
>> p1_B = [1;1;1]; % homogeneous
>> p1_W = B_frame*p1_B
p1_W =
11.0161
6.1306
1.0000
% point in World to B
>> p2_W = [12;7;1];
>> p2_B = inv(B_frame)*p2_W
p2_B =
2.1754
1.5851
1.0000