Chapter 2
RIGID MOTIONS AND HOMOGENEOUS TRANSFORMATIONS A large part of robot kinematics is concerned with the establishment of various coordinate systems to represent the positions and orientations of rigid rigid objects objects and with transf transform ormatio ations ns amo among ng these these coordin coordinate ate system systems. s. Indeed, the geometry of three-dimensional space and of rigid motions plays a centra centrall role role in all aspects aspects of robotic robotic manipula manipulation tion.. In this chapter chapter we study the operations of rotation and translation and introduce the notion of homogeneous homogeneous transformatio transformations. ns.1 Homogeneous transformations combine the operations of rotation and translation into a single matrix multiplication, and are used in Chapter 3 to derive the so-called forward kinematic equations of rigid manipulators. manipulators. We begin by examining representations of points and vectors in a Euclidean space equipped with multiple coordinate frames. Following this, we develop the concept of a rotation matrix, which can be used to represent relative relative orientations orientations between between coordinate coordinate frames. frames. Finally, Finally, we combine these two concepts to build homogeneous transformation matrices, which can be used to simultaneou simultaneously sly represent represent the position and orientation orientation of one coordinate frame relative relative to another. another. Furthermore urthermore,, homogeneous homogeneous transformation transformation matrices matrices can be used to perform coordinate transformat transformations. ions. Such Such transformations allow us to easily move between different coordinate frames, a facility that we will often exploit in subsequent chapters. 1
Since we make extensiv extensivee use of element elementary ary matrix theory theory, the reader may wish to review Appendix A before beginning this chapter.
37
TRANSFORMATIONS 38CHAPTER 2. RIGID MOTIONS AND HOMOGENEOUS TRANSFORMATIONS
Figure 2.1: Two coordinate frames, a point p , and two vectors v1 and v2 .
2.1
Repres Represen entin ting g Posit Position ionss
Before developing representation schemes for points and vectors, it is instructive to distinguish between the two fundamental approaches to geometric reasoning: the synthetic the synthetic approach approach and the analytic the analytic approach. approach. In the former, one reasons directly about geometric entities (e.g., points or lines), while in the latter, one represents these entities using coordinates or equations, and reasoning reasoning is performed performed via algebraic algebraic manipulations manipulations.. Consider Consider Figure 2.1. Using the synthetic synthetic approach, approach, without ever assigning coordinates to points or vectors, one can say that x0 is perpendicular to y0 , or that v1 v2 defines a vector that is perpendicular to the plane containing v1 and v2 , in this case pointing out of the page. In robotics, one typically uses analytic reasoning, since robot tasks are often often defined defined in a Cartes Cartesian ian workspa workspace, ce, using using Cartes Cartesian ian coordinate coordinates. s. Of course, in order to assign coordinates it is necessary to specify a coordinate frame. frame. Consider Consider again Figure 2.1. We could specify the coordinates coordinates of the point p with respect to either frame o0 x0 y0 or frame o1 x1 y1 . In the former case, we might assign to p the coordinate vector (5, 6)T , and in the latter case ( 3, 4)T . So that the refere reference nce frame frame will will alway alwayss be clear, clear, we will adopt adopt a notation notation in which which a superscript superscript is used to denote the reference reference frame. frame. Thus, Thus, we would write 5 3 p0 = , p1 = (2.1) 6 4
×
−
−
Geometricall Geometrically y, a point corresponds corresponds to a specific location in space. space. We 0 1 stress here that p = p and p = p , i.e., p is a geometric entity, a point in space, while both p0 and p1 are coordinate vectors that represent the
39
2.1. REPRESENTI REPRESENTING NG POSITIONS POSITIONS
location of this point in space with respect to coordinate frames o 0 x0 y0 and o1 x1 y1 , respectively. Since the origin of a coordinate system is just a point in space, we can assign coordinates that represent the position of the origin of one coordinate system with respect to another. In Figure 2.1, for example, o01 =
10 5
,
o10 =
− 10 5
.
(2.2)
In cases where there is only a single coordinate frame, or in which the reference frame is obvious, we will often omit the superscript. This is a slight abuse of notation, and the reader is advised to bear in mind the difference between the geometric entity called p and any particular coordinate vector that is assigned to represent p. The former former is invari invarian antt with respect respect to the choice of coordinate systems, while the latter obviously depends on the choice of coordinate frames. While a point corresponds to a specific location in space, a vector a vector specifies specifies a direction and a magnitude. magnitude. Vectors ectors can be used, for example, to represen representt displacemen displacements ts or forces. forces. Therefore, Therefore, while the point p is not equivalent to the vector v1 , the displacement from the origin o0 to the point p is given by the vector v1 . In this text, text, we will use the term term vector to to refer to what are sometimes called free called free vectors , i.e., vectors that are not constrained to be located at a particular particular point in space. Under Under this convention convention,, it is clear that points and vectors vectors are not equivalen equivalent, t, since points refer to specific locations in space, space, but a vecto vectorr can be moved moved to any any location location in space. space. Under Under this convention, two vectors are equal if they have the same direction and the same magnitude. When assigning coordinates to vectors, we use the same notational convention vention that we used when assigning assigning coordinates to points. Thus, Thus, v1 and v2 are geometric entities that are invariant with respect to the choice of coordinate systems, but the representation by coordinates of these vectors depends directly on the choice of reference coordinate frame. In the example of Figure 2.1, we would obtain v10 =
5 6
,
v11 =
8 1
,
v20 =
− 5 1
v21 =
− 3 4
. (2.3)
In order to perform algebraic manipulations using coordinates, it is essential that all coordinate vectors be defined with respect to the same coordinate frame. For example, an expression of the form v11 + v22 would make no sense geometrically. Thus, we see a clear need, not only for a representation
TRANSFORMATIONS 40CHAPTER 2. RIGID MOTIONS AND HOMOGENEOUS TRANSFORMATIONS
system that allows points to be expressed with respect to various coordinate nate system systems, s, but also for a mechan mechanism ism that allows allows us to transf transform orm the coordinates of points that are expressed in one coordinate system into the appropriate coordinates with respect to some other coordinate frame. Such coordinate transformations and their derivations are the topic for much of the remainder of this chapter.
2.2
Repres Represen entin ting g Rotati Rotations ons
In order to represent the relative position and orientation of one rigid body with respect to another, we will rigidly attach coordinate frames to each body, and then specify the geometric relationships between these coordinate frames. In Section 2.1 we have already seen how one can represent the position position of the origin of one frame frame with respect respect to anothe anotherr frame. frame. In this section, we address the problem of describing the orientation of one coordinate frame relative relative to another another frame. We begin with the case of rotations rotations in the plane, and then generalize our results to the case of orientations in a three dimensional space.
2.2.1 2.2.1
Rotat Rotation ion in the the pla plane ne
Figure 2.2 shows two coordinate frames, with frame o1 x1 y1 being obtained by rotating frame o0 x0 y0 by an angle θ. Perhaps Perhaps the most obvious obvious way to represent the relative orientation of these two frames is to merely specify the angle of rotation, θ. There There are two two immediate disadvanta disadvantages ges to such such a represen representation. tation. First, First, there is a discontinu discontinuity ity in the mapping from relative relative orientation to the value of θ in a neighborhood of θ = 0. In particu particular lar,, for θ = 2π ǫ , small changes in orientation can produce large changes in the θ (i.e., a rotation by ǫ causes θ to “wrap around” to zero). Second, value of θ this choice of representation does not scale well to the three dimensional case, with which we shall be primarily concerned in this text. A slightly less obvious way to specify the orientation is to specify the coordinate vectors for the axes of frame o1 x1 y1 with respect to coordinate frame o0 x0 y0 . In particular, we can build a matrix of the form:
−
R10 = [x10 y10 ] .
|
(2.4)
A matrix in this form is called a rotation a rotation matrix. matrix. Rotation matrices have a number of special properties, which we will discuss below.
41
2.2. REPRESENTING ROTA ROTATIONS y0 y1
x1
sin θ
θ x0
o0 , o 1 cos θ
Figure Figure 2.2: Coordinate Coordinate frame o1 x1 y1 is oriented at an angle θ with respect to o0 x0 y0 In the two dimensional case, it is straightforward to compute the entries of this matrix. As illustrated in Figure 2.2, x10 =
cos θ sin θ
,
R10 =
cos θ sin θ
y10 =
− sin θ cos θ
,
(2.5)
which gives
− sin θ cos θ
.
(2.6)
Note that we have continued to use the notational convention of allowing the superscript superscript to denote denote the reference reference frame. frame. Thus, Thus, R01 is a matrix whose column vectors are the coordinates of the axes of frame o1 x1 y1 expressed relative to frame o0 x0 y0 . Although we have derived the entries for R01 in terms of the angle θ, it is not necessa necessary ry that we do so. An alternat alternativ ivee approa approach ch,, and one that scales nicely to the three dimensional case, is to build the rotation matrix by projecting the axes of frame o1 x1 y1 onto the coordinate axes of frame o0 x0 y0 . Recalling that the dot product of two unit vectors gives the projection of one onto the other, we obtain x10 =
· ·
x1 x0 x1 y0
,
y10 =
· ·
y1 x0 y1 y0
,
(2.7)
TRANSFORMATIONS 42CHAPTER 2. RIGID MOTIONS AND HOMOGENEOUS TRANSFORMATIONS
which can be combined to obtain the rotation matrix R10 =
· ·
x1 x0 x1 y0
· ·
y1 x0 y1 y0
.
(2.8)
Thus the columns of R R 10 specify the direction cosines of the coordinate axes of o1 x1 y1 relative to the coordinate axes of o0 x0 y0 . For example, example, the first T 0 column (x1 x 0 , x1 y 0 ) of R1 specifies the direction of x1 relative to the frame o0 x0 y0 . Note that the right hand sides of these equations are defined in terms of geometric entities, and not in terms of their coordinates. Examining Figure 2.2 it can be seen that this method of defining the rotation matrix by projection gives the same result as was obtained in equation (2.6). If we desired instead to describe the orientation of frame o0 x0 y0 with respect to the frame o1 x1 y1 (i.e., if we desired to use the frame o1 x1 y1 as the reference frame), we would construct a rotation matrix of the form
·
·
R01 =
· ·
x0 x1 x0 y1
· ·
y0 x1 y0 y1
.
(2.9)
Since the inner product is commutative, (i.e. xi y j = y j xi ), we see that
·
R01 = (R01 )T .
·
(2.10)
In a geometric sense, the orientation of o o 0 x0 y0 with respect to the frame o1 x1 y1 is the inverse of the orientation of o1 x1 y1 with respect to the frame o0 x0 y0 . Algebraically, using the fact that coordinate axes are always mutually orthogonal, it can readily be seen that (R10)T = (R01 )−1 .
(2.11)
Such a matrix is said to be orthogonal. orthogonal. The The column column vect vector orss of R01 are of unit unit length length and mutua mutually lly orthogon orthogonal al (Probl (Problem em 2-1). It can also be 0 shown (Problem 2-2) that det R1 = 1. If we restrict restrict ourselv ourselves es to rightright0 handed coordinate systems, as defined in Appendix A, then det R1 = +1 (Problem 2-3). All rotation matrices have the properties of being orthogonal matrices matrices with determinant determinant +1. It is customary to refer to the set of all 2 all 2 2 2 rotation matrices by the symbol SO (2) . The properti properties es of such such matric matrices es are summarized in Figure 2.3. To provide further geometric intuition for the notion of the inverse of a rotation matrix, note that in the two dimensional case, the inverse of the
±
×
2
The notation
SO (2)
stands for Special Orthogonal group of order 2.
43
2.2. REPRESENTING ROTA ROTATIONS
Every n
× n rotation matrix R has the following properties (for n = 2, 3): • R ∈ S O(n) • R− ∈ S O(n) • R− = R • The columns (and therefore the rows) of R are mutually orthogonal. • Each column (and therefore each row) of R is a unit vector. • det{R} = 1 1
T
1
Figure 2.3: Properties of Rotation Matrices rotation matrix corresponding to a rotation by angle θ can also be easily computed simply by constructing the rotation matrix for a rotation by the angle θ:
−
cos( θ) sin( θ)
2.2.2 2.2.2
− −
− sin(−θ) cos(−θ)
=
−
cos θ sin θ sin θ cos θ
=
cos θ sin θ
− sin θ cos θ
T
.
(2.12)
Rotat Rotation ionss in thre three e dimen dimensio sions ns
The projection technique described above scales nicely to the three dimensional case. In three dimensions, dimensions, each axis of the frame o 1 x1 y1 z1 is projected onto coordinate frame o0 x0 y0 z0 . The resulting rotation matrix is given by R10 =
· · ·
x1 x0 x1 y1 x1 z1
· · ·
y1 x0 y1 y0 y1 z0
· · ·
z1 x0 z1 y0 z1 z0
.
(2.13)
As was the case for rotation matrices in two dimensions, matrices in this form are orthogonal, orthogonal, with determinan determinantt equal to 1. In this case, 3 3 rotation rotation matrices belong to the group S O(3). The properties listed in Figure 2.3 also apply to rotation matrices in SO (3).
×
Example 2.1 Suppose Suppose the frame o1 x1 y1 z1 is rotated through an angle θ z 0 -axis, and it is desired to find the resulting transformation matrix about the z
TRANSFORMATIONS 44CHAPTER 2. RIGID MOTIONS AND HOMOGENEOUS TRANSFORMATIONS R10 . Note Note that that by convent onvention ion the positiv ositivee sense sense for the angle θ is given by the right hand rule; that is, a positive rotation of θ degrees about the z -axis would advance a right-hand threaded screw along the positive z -axis. From
Figure 2.4 we see that z 0 , z 1
cos θ
y1
θ
x0
sin θ
sin θ
cos θ
x1
y0
Figure 2.4: Rotation about z0 . x1 x0 = cos θ
· x · y = sin θ z · z 1
y1 x0 = y1
0
0
1
· − sin θ · y = cos θ
(2.14)
0
= 1
and all al l other dot prod products ucts are zero. Thus the transfo transformatio rmation n R10 has a particularly simple form in this case, namely R10
⋄
=
cos θ sin θ 0
− sin θ cos θ 0
0 0 1
.
(2.15)
The Basic Rotation Matrices The transformation (2.15) is called a a basic basic rotation rotation matrix matrix (about the z -ax -axis). is). In this this case case we find it useful useful to use the more more descri descriptiv ptivee notatio notation n
2.3. COORDINATE COORDINATE TRANSFORMATIONS: TRANSFORMATIONS: ROTA ROTATIONS
45
Rz,θ , instead of R10 to denote the matrix (2.15). It is easy to verify that the basic rotation matrix Rz,θ has the properties Rz,0 Rz,θ Rz,φ
= I
(2.16)
= Rz,θ+φ
(2.17)
= Rz, θ .
(2.18)
which which together together imply Rz,θ −1
−
Similarly the basic rotation matrices representing rotations about the x and y -axes are given as (Problem 2-5) Rx,θ
Ry,θ
=
=
1 0 0 cos θ 0 sin θ
0 sin θ cos θ
−
cos θ 0 sin θ 0 1 0 sin θ 0 cos θ
−
(2.19)
(2.20)
which also satisfy properties analogous to (2.16)-(2.18). Example 2.2 Consider the frames o0 x0 y0 z0 and o1 x1 y1 z1 shown in Figure ure 2.5. Proje Projecting cting the unit vectors vectors x1 , y1 , z1 onto x0 , y0 , z0 gives the coordinates of x1 , y1 , z1 in the o0 x0 y0 z0 frame. frame. We see that the coor coordinat dinates es of
1 1 x1 are √ , 0, √ 2
2
T
1 √ 1 , 0, − , the coordinates of y1 are √ 2 2
T
and the coordi-
nates of z1 are (0, 1, 0)T . The rotation matrix R10 specifying the orientation of o1 x1 y1 z1 relative to o0 x0 y0 z0 has these as its column vectors, that is, 1
√ √
2
R10
=
2.3
2
0
0
1
−1 √
2
⋄
√ 1
2
0 1 0
.
(2.21)
Coordin Coordinate ate Transfo ransforma rmatio tions: ns: Rotati Rotations ons
Figure 2.6 shows a rigid object S to which a coordinate frame o1 x1 y1 z1 is attached. attached. Given Given the coordinates coordinates p1 of the point p (i.e., given the coordinates of p with respect to the frame o1 x1 y1 z1 ), we wish to determine the coordinates coordinates of p relative to a fixed reference frame o0 x0 y0 z0 .
TRANSFORMATIONS 46CHAPTER 2. RIGID MOTIONS AND HOMOGENEOUS TRANSFORMATIONS z 0 x1
45
◦
x0
y0 , z 1 y1
Figure 2.5: Defining the relative orientation of two frames. z 0
S y1
p
z 1
x1 o
y0
x0
Figure 2.6: Coordinate frame attached to a rigid body. The coordinates coordinates p1 = (u , v , w)t satisfy satisfy the equation equation p = ux 1 + vy 1 + wz 1 .
(2.22)
In a simila similarr way way, we can obtain obtain an expres expressio sion n for the coordin coordinate atess p0 by projecting the point p onto the coordinate axes of the frame o 0 x0 y0 z0 , giving
p0 =
· · ·
p x0 p y0 p z0
Combining these two equations we obtain
.
(2.23)
47
2.3. COORDINATE COORDINATE TRANSFORMATIONS: TRANSFORMATIONS: ROTA ROTATIONS
p0
=
=
=
(ux1 + vy 1 + wz 1 ) x0 (ux1 + vy 1 + wz 1 ) y0 (ux1 + vy 1 + wz 1 ) z0
· · ·
(2.24)
ux1 x0 + vy 1 x0 + wz 1 x0 ux1 y0 + vy 1 y0 + wz 1 y0 ux1 z0 + vy 1 z0 + wz 1 z0
· · ·
· · ·
x1 x0 x1 y0 x1 z0
· · ·
· · ·
y1 x0 y1 y0 y1 z0
· · ·
z1 x0 z1 y0 z1 z0
· · ·
u v w
(2.25)
.
(2.26)
But the matrix in this final equation is merely the rotation matrix R 01 , which leads to (2.27) p0 = R 01 p1 . Thus, Thus, the rotati rotation on matrix matrix R01 can be used not only to represent the orientation of coordinate frame o 1 x1 y1 z1 with respect to frame o 0 x0 y0 z0 , but also to transform the coordinates of a point from one frame to another. Thus, if a given point is expressed relative to o1 x1 y1 z1 by coordinates p 1, then R 01 p1 represents the same the same point expressed relative to the frame o0 x0 y0 z0 . We have now seen how rotation matrices can be used to relate the orientation of one frame to another frame, and to assign coordinate representations tations to points points and vecto vectors. rs. For example, example, given given a point point p in space, we have shown how a rotation matrix can be used to derive coordinates for p with respect to different coordinate frames whose orientations are related by a rotation matrix. We can also use rotation matrices to represent represent rigid motions that correspond to pure rotation. Consider Figure 2.7. One corner of the block in Figure 2.7(a) is located at the point pa in in space. space. Figure Figure 2.7(b) shows the same block after it has been rotated about z 0 by the angle π . In Figure 2.7(b), the same corner of the block is now located at point p b in space. It is possibl p ossiblee to derive derive the coordinates for p b given only the co ordinates for p a and the rotation matrix that corresponds to the rotation about accomplished,, imagine that a coordinate coordinate frame is z0 . To see how this can be accomplished rigidly attached to the block in Figure 2.7(a), such that it is coincident with the frame o0 x0 y0 z0 . After After the rotation rotation by π, the block’s coordinate frame, which is rigidly attached to the block, is also rotated by π . If we denote this rotated frame by o1 x1 y1 z1 , we obtain R10 = R z,π =
−
1 0 0
−
0 0 1 0 0 1
.
(2.28)
TRANSFORMATIONS 48CHAPTER 2. RIGID MOTIONS AND HOMOGENEOUS TRANSFORMATIONS
In the local coordinate frame o1 x1 y1 z1 , the the point point pb has the coordin coordinate ate 1 representation p b . To obtain its coordinates with respect to frame o 0 x0 y0 z0 , we merely apply the coordinate transformation equation (2.27), giving pb0 = R z,π pb1 .
(2.29)
The key thing to notice is that the local coordinates, pb1 , of the corner of the block do not change as the block rotates, since they are defined in terms of the block’s block’s own own coordin coordinate ate frame. frame. Theref Therefore ore,, when when the block’s block’s frame frame is aligned with the reference frame o0 x0 y0 z0 (i.e., (i.e., before before the rotation rotation is 1 0 performed), the coordinates p b = p a , since before the rotation is performed, the point pa is coincident coincident with the corner of the block. Therefore, Therefore, we can 0 substitute pa into the previous equation to obtain pb0 = R z,π pa0 .
(2.30)
This equation shows us how to use a rotation matrix to represent a rotational motion. In particular, if the point p b is obtained by rotating the point p a as p b with respect to defined by the rotation matrix R , then the coordinates of p the reference frame are given by pb0 = R pa0 .
(2.31)
This same approach can be used to rotate vectors with respect to a coordinate frame, as the following example illustrates. Example 2.3 The vector v with coordinates v v 0 = (0, 1, 1)T is rotated about y0 by π2 as shown in Figure 2.8. The resulting vector v1 has coordinates given by v10
= Ry, π v 0 =
⋄
(2.32)
2
−
0 0 1 0 1 0 1 0 0
0 1 1
=
1 1 0
.
(2.33)
Thus, as we have now seen, a third interpretation of a rotation matrix R is as an operator acting on vectors in a fixed frame. In other words, instead of relating the coordinates of a fixed vector with respect to two different coordinate frames, the expression (2.32) can represent the coordinates in o0 x0 y0 z0 of a vector v1 which is obtained from a vector v by a given rotation.
49
2.3. COORDINATE COORDINATE TRANSFORMATIONS: TRANSFORMATIONS: ROTA ROTATIONS
z 0
z 0
pa
pb y0
y0
x0
x0
(a)
(b)
Figure Figure 2.7: The block block in (b) is obtained obtained by rotating rotating the block block in (a) by π about z0 .
z 0 v 0
π
2
y0
v 1 x0
Figure 2.8: Rotating a vector about axis y 0 .
TRANSFORMATIONS 50CHAPTER 2. RIGID MOTIONS AND HOMOGENEOUS TRANSFORMATIONS
2.3. 2.3.1 1
Summ Su mmar ary y
We have seen that a rotation matrix, either R be interpreted in three distinct ways:
∈ S O(3) or R ∈ S O(2), can
1. It represents represents a coordinate transforma transformation tion relating the coordinates coordinates of a point p in two different frames. 2. It gives the orientation orientation of a transforme transformed d coordinate frame with respect respect to a fixed coordinate frame. 3. It is an operator taking a vector vector and rotating rotating it to a new vector vector in the same coordinate system. system. The particular interpretation of a given rotation matrix R that is being used must then be made clear by the context.
2.4 2.4
Compo Composi siti tion on of Rota Rotati tion onss
In this section we discuss discuss the composition of rotations. rotations. It is important for subsequen subsequentt chapters chapters that the reader understand understand the material material in this section thoroughly before moving on.
2.4.1 2.4.1
Rotation Rotation with with respect respect to the the curren currentt coordinate coordinate frame frame
Recall that the matrix R01 in Equation (2.27) represents a rotational transformation between the frames o 0 x0 y0 z0 and o 1 x1 y1 z1 . Suppose we we now add a third coordinate frame o 2 x2 y2 z2 related to the frames o 0 x0 y0 z0 and o 1 x1 y1 z1 by rotational rotational transformations transformations.. As we saw above, a given point p can then be represented by coordinates specified with respect to any of these three frames: p0, p 1 and p 2. The relationship between these representations of p p is p0
(2.34)
p1
= R01 p1 = R12 p2
p0
= R02 p2 = R 10R21 p2
(2.36)
(2.35)
where each each Rji is a rotatio rotation n matrix matrix,, and equatio equation n (2.36) (2.36) follow followss direct directly ly 0 by substitu substitutin tingg equatio equation n (2.35) (2.35) into equatio equation n (2.34). (2.34). Note Note that R1 and 0 R2 represent rotations relative to the frame o0 x0 y0 z0 while R12 represents a rotation relative to the frame o1 x1 y1 z1 . From equation (2.36) we can immediately infer the identity R20 = R 01 R21 .
(2.37)
51
2.4. COMPOSITION COMPOSITION OF ROT ROTA ATIONS
z 1
z 0
z 1 , z 2
z 1 , z 2
z 0
φ +
=
x0
y2
x1 x1
x0 φ
θ
y 0 , y1
y1
x2
y2 θ
x1
x2
y0 , y1
Figure 2.9: Composition of rotations about current axes. Equatio Equation n (2.37) (2.37) is the compositio composition n law law for rotationa rotationall transf transform ormati ations ons.. It states states that, in order order to transf transform orm the coordin coordinate atess of a point point p from its 2 representation p in the frame o 2 x2 y2 z2 to its representation p 0 in the frame o0 x0 y0 z0 , we may first transform to its coordinates p 1 in the frame o 1 x1 y1 z1 using R21 and then transform p1 to p0 using R 01 . We ma may y also also inter interpre prett Equatio Equation n (2.37) (2.37) as follow follows. s. Suppose Suppose initially initially that all three of the coordinate frames frames coincide. coincide. We first rotate the frame Then,, o2 x2 y2 z2 relative to o0 x0 y0 z0 according to the transformation R10 . Then with the frames o1 x1 y1 z1 and o2 x2 y2 z2 coincident, we rotate o2 x2 y2 z2 relative to o1 x1 y1 z1 according to the transformation R21. In each each case we call call the frame relative to which the rotation occurs the current the current frame. frame. Example 2.4 Hencefort Henceforth, h, whenever convenient convenient we use the shorthand shorthand notation cθ = cos θ, sθ = sin θ for trigonometric functions. Suppose a rotation R represents a rotation of φ φ degrees about the current y y -axis followed matrix R by a rotation of θ degree degreess about about the current current z -axis. -axis. Refer efer to Figur Figuree 2.9. 2.9. Then the matrix R is given by R
= Ry,φ Rz,θ
−
cφ
=
0 sφ
=
cφ cθ sθ sφ cθ
−
0 sφ 1 0 0 cφ
−c s
φ θ
cθ sφ sθ
−s
cθ sθ
cθ
0 sφ
0 cφ
0
.
θ
(2.38) 0 0 1
TRANSFORMATIONS 52CHAPTER 2. RIGID MOTIONS AND HOMOGENEOUS TRANSFORMATIONS
⋄
It is important to remember that the order in which a sequence of rotations are carried out, and consequently the order in which the rotation matric matrices es are multipl multiplied ied together, together, is crucia crucial. l. The reason reason is that that rotatio rotation, n, unlike position, is not a vector quantity and is therefore not therefore not subject to the laws of vector addition, and so rotational transformations do not commute in general. Example 2.5 Suppose that the above rotations are performed in the reverse order, that is, first a rotation about the current z -axis followed by a rotation about the current y -axis. Then the resulting rotation matrix is given by R′
= Rz,θ Ry,φ =
=
cθ sθ
−s
0
0
cθ cφ sθ cφ sφ
−
0 0 1
φ
cθ
−s cθ
0
θ
−
cφ
0 sφ
cθ sφ sθ sφ cφ
0 sφ 1 0 0 cφ
(2.39)
.
Comparing (2.38) and (2.39) we see that R = R ′ .
⋄ 2.4.2 2.4.2
Rotat Rotation ion with with respe respect ct to a fixed fixed frame frame
Many times it is desired to perform a sequence of rotations, each about a given fixed coordinate frame, rather than about successive current frames. For example we may wish to perform a rotation about x0 followed by a rotation about the y0 (and not y1!). We will refer to o0 x0 y0 z0 as the fixed the fixed frame. frame. In this case the composition composition law given given by equation equation (2.37) (2.37) is not valid. alid. It turns out that the correc correctt com composi position tion law in this case case is simply to multiply the successive rotation matrices in matrices in the reverse order from order from that given given by (2.37). (2.37). Note Note that that the rotations rotations themsel themselve vess are not perform performed ed in reverse reverse order. order. Rather Rather they are performed performed about the fixed frame instead instead of about the current frame. To see why this is so, consider the following argument. Let o0 x0 y0 z0 be the referen reference ce frame. frame. Let the frame frame o1 x1 y1 z1 be obtained by performing a rotation with respect to the reference frame, and let this rotation be denoted by R01 . Now let let o2 x2 y2 z2 be obtained by performing a rotation of frame o1 x1 y1 z1 with respect to the reference frame (not ( not with with respect to o1 x1 y1 z1
53
2.4. COMPOSITION COMPOSITION OF ROT ROTA ATIONS
itself). We will, for the moment, denote this rotation about the fixed frame by the matrix R . Finally Finally,, let R02 be the rotation matrix that denotes the orientation of frame o 2 x2 y2 z2 with respect to o 0 x0 y0 z0 . We know that R 20 = R10 R , since this equation applies for rotation about the current frame. Thus, we now seek to determine the matrix R12 such that R20 = R 01 R21. In order to find this matrix, matrix, we shall shall proceed proceed as follo follows. ws. First, First, we will rotate frame o 1 x1 y1 z1 to align it with the reference frame. This can be done by postmultiplication of R10 by its inve inverse rse.. No Now, w, since since the curren currentt frame frame is aligned with the reference frame, we can postmultiply by the rotation corresponding to R (i.e., now that the fixed reference frame coincides with the current frame, rotation about the current frame is equivalent to rotation about the fixed reference reference frame). frame). Finally Finally, we must undo the initial rotation, which corresponds to a postmultiplication of R10. When When we conca concate tena nate te these operations, we obtain the following:
R02
= R10R12
R02
= R10 (R01 )−1 RR 10
R02
= RR 01
(2.40)
(2.41) (2.42)
This procedure is an instance of a classical technique in engineering problem solving. When confronte confronted d with a difficult problem, if one can transform transform the problem into an easier problem, it is often possible to transform the solution to this easier problem into a solution to the original, more difficult proble problem. m. In our curren currentt case, case, we didn’t didn’t know how to solve solve the problem problem of rotating with respect to the fixed reference reference frame. Therefore, Therefore, we transformed the problem to the problem of rotating about the current frame (by using the rotation (R10 )−1 ). We then transformed transformed the solution for this simpler problem by applying the inverse of the rotation that we initially used to simplify the problem (i.e., we postmultiplied by R01 ). Example 2.6 Suppose Suppose that a rotatio rotation n matrix R represents a rotation of efer to φ degrees about y0 followed by a rotation of θ about the fixed z0 . Refer 0 1 2 Figure Figure 2.10. Let p , p , and p be representations of a point p. Initia Initially lly the fixed and current axes are the same, namely o0 x0 y0 z0 and therefore we can write as before p0
= Ry,φ p1
(2.43)
where Ry,φ is the basic rotation matrix about the y -axis. -axis. Now, Now, since since the second rotation is about the fixed frame o0 x0 y0 z0 and not the current frame
TRANSFORMATIONS 54CHAPTER 2. RIGID MOTIONS AND HOMOGENEOUS TRANSFORMATIONS
z 1
z 0
z 0
z 1
φ
z 2 +
x0
=
x0 y0
x0 φ
y1
θ x1
z 0
y0
x1
x1
y2
θ
x2
y0 , y1
Figure 2.10: Composition of rotations about fixed axes. o1 x1 y1 z1 , we cannot conclude that p1
= Rz,θ p2
(2.44)
since this would require that we interpret Rz,θ as being a rotation about z1 . Applying the same process as above, we first undo the previous rotation, then rotate about z0 and finally reinstate the original transformation, that is,
p1 = Ry,
−φ
Rz,θ Ry,φ p2 .
(2.45)
This is the correct expression, and not (2.44). Now, substituting (2.45) into (2.43) we obtain p0
= Ry,φ p1 = Ry,φ Ry, φ Rz,θ Ry,φ p2 = Rz,θ Ry,φ p2 .
−
(2.46)
It is not necessary to remember the above derivation, only to note by comparing (2.46) with (2.38) that we obtain the same basic rotation matrices, but in the reverse order.
⋄ 2.4. 2.4.3 3
Summ Su mmar ary y
We can summarize the rule of composition of rotational transformations by the following following recipe. Given Given a fixed frame frame o 0 x0 y0 z0 a current frame o 1 x1 y1 z1 , 0 together with rotation matrix R1 relating them, if a third frame o2 x2 y2 z2
55
2.5. PARAMETERIZATIONS ARAMETERIZATIONS OF ROT ROTATIONS
is obtained by a rotation R performed relative to the current the current frame then frame then 0 1 postmultiply R1 by R = R 2 to obtain R20
= R10R21.
(2.47)
If the second rotation is to be performed relative to the fixed the fixed frame then frame then 1 it is both confusing and inappropriate to use the notation R2 to represent this rotation. Therefore, if we represent the rotation by R , we premultiply we premultiply 0 R1 by R to obtain R02
= RR 01 .
(2.48)
In each case R 20 represents the transformation between the frames o0 x0 y0 z0 and o2 x2 y2 z2 . The The fram framee o2 x2 y2 z2 that results in (2.47) will be different from that resulting from (2.48).
2.5
Param Parameter eteriza izatio tions ns of Rotati Rotations ons
The nine elements r ij in a general rotational transformation R are not independent pendent quantities. quantities. Indeed Indeed a rigid body possesses possesses at most three rotational rotational degrees-of-freedom and thus at most three quantities are required to specify its orientation. orientation. This can be easily seen by examining examining the constraints constraints that govern the matrices in SO (3):
2 rij
= 1, j
i
r1i r1 j + r2i r2 j + r3i r3 j
= 0,
∈ {1, 2, 3} i = j .
(2.49) (2.50)
Equation (2.49) follows from the fact the the columns of a rotation matrix are unit vectors, and (2.50) follows from the fact that columns of a rotation matrix are mutually orthogonal. Together, these constraints define six independent equations with nine unknowns, which implies that there are three free variables. In this section we derive three ways in which an arbitrary rotation can be represen represented ted using only three independen independentt quantities quantities:: the the Euler Euler Angle representation, gle representation, the roll-pitch-yaw the roll-pitch-yaw representation, representation, and the axis/angle the axis/angle representation.
2.5. 2.5.1 1
Eule Eu lerr Angl Angles es
A common method of specifying a rotation matrix in terms of three independent quantities is to use the so-called Euler Angles. Angles. Consid Consider er again again
TRANSFORMATIONS 56CHAPTER 2. RIGID MOTIONS AND HOMOGENEOUS TRANSFORMATIONS
z 0 , z a
z a z b , z 1
z b
ψ
φ ya , yb
ya x0
y0
xa
y1 yb
θ
xa xb
(1)
xb
x1
(2)
(3)
Figure 2.11: Euler angle representation.
the fixed coordinate frame o0 x0 y0 z0 and the rotated frame o1 x1 y1 z1 shown in Figure 2.11. We can specify the orientation of the frame o1 x1 y1 z1 relative to the frame o0 x0 y0 z0 by three angles (φ,θ,ψ ), known as Euler Angles, and obtained by three successiv successivee rotations as follows: follows: First rotate about the z -axis by the angle φ . Next rotate about the current y -axis by the angle θ . Finally rotate about the current z -axis by the angle ψ . In Figur Figuree 2.11, 2.11, fram framee oa xa ya za represents the new coordinate frame after the rotation by φ, frame o b xb yb zb repres represen ents ts the new coordin coordinate ate frame frame after after the rotatio rotation n by θ, and and fram framee o1 x1 y1 z1 represents the final frame, after the rotation by ψ . Frames oa xa ya za and o b xb yb zb are shown in the figure only to help you visualize the rotations. In terms of the basic rotation matrices the resulting rotational transformation R 10 can be generated as the product R10
= Rz,φ Ry,θ Rz,ψ =
=
cφ sφ
−s
0
0
φ
cφ
−
0 0 1
−
cφ cθ cψ sφ sψ sφ cθ cψ + cφ sψ sθ cψ
−
cθ
0 sθ
0 sθ 1 0 0 cθ
−c c s − s −s c s + c
φ θ ψ
φ cψ
φ θ ψ
φ cψ
s θ sψ
(2.51) cψ sψ
−s
ψ
cψ
0
0
cφ s θ sφ sθ cθ
.
0 0 1
(2.52)
Consider now the problem of determining the angles φ, θ, and ψ , given
57
2.5. PARAMETERIZATIONS ARAMETERIZATIONS OF ROT ROTATIONS
the rotation matrix R =
r11 r21 r31
r12 r22 r32
r13 r23 r33
.
(2.53)
Suppose that not both of r13 , r23 are zero. Then Then the above above equatio equations ns show that sθ = 0, and hence that not both of r31 , r32 are zero. If not both 2 r13 and r23 are zero, then r33 = 1, and we have cθ = r 33 , sθ = 1 r33 so
± −
±
−
= A tan r33 ,
θ
or
2 r33
1
− −
= A tan r33 ,
θ
2 r33 .
1
(2.54)
(2.55)
The function function θ = A tan(x, y) computes the arc tangent function, where x and y are the cosine and sine, respectively, of the angle θ . This This function function uses the signs of x and y to select the appropriate quadrant for the angle θ . Note that if both x and y are zero, A tan is undefined. If we choose the value for θ given by Equation (4.33), then sθ > 0, and φ = A tan(r13 , r23 ) ψ
= A tan( r31 , r32 ).
(2.56) (2.57)
−
If we choose the value for θ given by Equation (4.34), then sθ < 0, and φ = A tan( r13 , ψ
=
− −r ) A tan(r , −r ). 31
(2.58)
23
32
(2.59)
Thus there are two solutions depending on the sign chosen for θ. r13 = r 23 = 0, then the fact that If r that R is orthogonal implies that r 33 = and that r 31 = r 32 = 0. Thus R has the form R
=
r11 r21
r12 r22
0
0
0 0 1
0 0 1.
±
±1,
(2.60)
r 33 = 1, then c θ = 1 and s θ = 0, so that θ = 0. In this case (2.52) becomes If r
−
cφ cψ sφ sψ sφ cψ + cφ sψ
0
−c s − s −s s + c φ ψ
φ ψ
0
φ cψ φ cψ
=
cφ+ψ sφ+ψ
0
−s
φ+ψ
cφ+ψ
0
0 0 1
=
r11 r21
0
r12 0 r22(2.61) 0
0
1
TRANSFORMATIONS 58CHAPTER 2. RIGID MOTIONS AND HOMOGENEOUS TRANSFORMATIONS
Thus the sum φ + ψ can be determined as φ + ψ
= A tan(r11 , r21 )
(2.62)
= A tan(r11 , r12 ).
−
Since only the sum φ + ψ can be determined in this case there are infinitely many solutions. We may take φ = 0 by convention, and define ψ by (4.39). If r33 = 1, then cθ = 1 and sθ = 0, so that θ = π . In this this case case (2.52) (2.52) becomes
−
−
− − −
cφ ψ sφ ψ
−s −
φ ψ
cφ−ψ
0
0
The solution is thus φ
− ψ
0 0 1
=
r11 r21
r12 r22
0
0
0 0 1
−
.
= A tan( r11 , r12 ) = A tan( r21 , r22 ).
− −
− −
(2.63)
(2.64)
As before there are infinitely many solutions.
2.5.2 2.5.2
Roll, Roll, Pitc Pitch, h, Yaw Angles Angles
A rotation matrix R can also be described as a product of successive rotations about the principal coordinate axes x0 , y0 , and z0 taken in a specific order. order. These These rotations rotations define define the roll the roll,, pitch, pitch, and yaw yaw angles, which we shall also denote φ, which are shown shown in Figure Figure 2.12. We specify specify φ, θ, ψ , and which z 0
Roll
Yaw
y0
Pitch x0
Figure 2.12: Roll, pitch, and yaw angles. the order of rotation as x
− y − z , in other words, first a yaw about x
0
59
2.5. PARAMETERIZATIONS ARAMETERIZATIONS OF ROT ROTATIONS
through an angle ψ, then pitch about the y0 by an angle θ, and finally roll about the z0 by an angle φ. Since Since the successi successive ve rotation rotationss are relativ relativee to the fixed frame, the resulting transformation matrix is given by R10
= Rz,φ Ry,θ Rx,ψ =
=
0 0 1
cφ sφ
−s
0
0
cφ cθ sφ cθ sθ
−s c
φ
cφ
−
−
cθ
0 sθ
0 sθ 1 0 0 cθ
φ ψ + cφ sθ sψ cφ cψ + sφ sθ sψ
cθ sψ
(2.65) 1 0 0 cψ 0 sψ
sφ sψ + cφ sθ cψ cφ sψ + sφ sθ cψ c θ cψ
−
0
−s
ψ
cψ
.
Of course, instead of yaw-pitch-roll relative to the fixed frames we could also interpret the above transformation as roll-pitch-yaw, in that order, each taken with respect to the current frame. The end result is the same matrix (2.65). The three angles, φ,θ,ψ , can be obtained for a given rotation matrix using a method that is similar to that used to derive the Euler angles above. We leave this as an exercise for the reader.
2.5.3 2.5.3
Axis/An Axis/Angle gle Represe Represent ntatio ation n
Rotations are not always performed about the principal coordinate axes. We are often interested in a rotation about an arbitrary axis in space. This provides provides both a conven convenien ientt way way to describe describe rotations, rotations, and an alternativ alternativee T parameteriza parameterization tion for rotation rotation matrices. Let k = (kx , ky , kz ) , expressed in the frame o 0 x0 y0 z0 , be a unit vector defining an axis. We wish to derive the rotation rotation matrix Rk,θ representing a rotation of θ degrees about this axis. There are several ways in which the matrix R k,θ can be derived. Perhaps the simplest way is to rotate the vector k into one of the coordinate axes, say z0, then rotate about z0 by θ and finally rotate k back to its original position position.. This is similar similar to the method that we emplo employe yed d above above to deriv derivee the equation for rotation with respect to a fixed reference frame. Referring to Figure 2.13 we see that we can rotate k into z0 by first rotating about z0 by α, then rotating about y0 by β . Since all rotations rotations are performed relative to the fixed frame o0 x0 y0 z0 the matrix Rk,θ is obtained as
−
−
Rk,θ
= Rz,α Ry,β Rz,θ Ry, β Rz, −
−α
.
(2.66)
TRANSFORMATIONS 60CHAPTER 2. RIGID MOTIONS AND HOMOGENEOUS TRANSFORMATIONS z 0 kz θ
β k
ky y0
α
kx x0
Figure 2.13: Rotation about an arbitrary axis. From Figure 2.13, since k is a unit vector, we see that sin α = cos α = sin β =
ky
(2.67)
kx2 + ky2 kx
(2.68)
kx2 + ky2
kx2 + ky2
cos β = kz .
(2.69)
(2.70)
Note that the final two equations follow from the fact that k is a unit vector. vector. Substituting Substituting (2.67)-(2.70) (2.67)-(2.70) into (2.66) we obtain after some lengthy lengthy calculation (Problem 2.10)
Rk,θ =
kx2 vθ + cθ kx ky vθ + kz sθ kx kz vθ ky sθ
− vers ers θ = 1 − c .
−
kx ky vθ k z sθ ky2 vθ + cθ ky kz vθ + kx sθ
kx kz vθ + ky sθ ky kz vθ k x sθ kz2 vθ + cθ
−
(2.71)
where v θ = θ In fact, any rotation matrix R S 0(3) 0(3) can be represented by a single rotation about a suitable axis in space by a suitable angle,
∈
R
= Rk,θ
(2.72)
where k is a unit vector defining the axis of rotation, and θ is the angle of rotation about k . Equation Equation (2.72) is called called the axis/angle the axis/angle representation representation
61
2.5. PARAMETERIZATIONS ARAMETERIZATIONS OF ROT ROTATIONS
of R . Given Given an arbitrar arbitrary y rotation rotation matrix matrix R with components (rij ), the equivalent angle θ and equivalent axis k are given by the expressions T r (R ) − 1 θ = cos−1
− 1
= cos
2 r11 + r22 + r33 2
(2.73)
− 1
where T r denotes the trace of R , and
k
1 2sin θ
=
r 32 r 13 r 21
−r −r −r
23 31 12
.
(2.74)
These equations can be obtained by direct manipulation of the entries of the matrix given given in equation equation (2.71). The axis/angle axis/angle representa representation tion is not θ about unique since a rotation of θ about k is the same as a rotation of θ k, that is,
− −
−
Rk,θ
= R k, θ . −
−
(2.75)
If θ = 0 then R is the identity matrix and the axis of rotation is undefined. R is generated by a rotation of 90 z 0 followed Example 2.7 Suppose R 90 ◦ about z ◦ ◦ by a rotation of 30 about y0 followed by a rotation of 60 about x0 . Then R
= Rx,60Ry,30 Rz,90
√ − √ 23
√ 0
1 2 3 2
=
−
3 4 1 4
−√ 1 2 3 4 3 4
(2.76)
.
We see that T r (R ) = 0 and hence the equivalent angle is given by (2.73) as θ = cos−1
1 = 120◦ . 2
−
(2.77)
The equivalent axis is given from (2.74) as k
⋄
=
1 1 , 3 2 3
√
√ −
1 1 1 + , 2 2 3 2
√
T
.
(2.78)
TRANSFORMATIONS 62CHAPTER 2. RIGID MOTIONS AND HOMOGENEOUS TRANSFORMATIONS yC
p3 xC
(v 1) (v 2) yA
v 3
yB p1
p2
v 2 xB
v 1
θ xA
Figure 2.14: Homoge Homogeneous neous transformations transformations in two two dimensions. dimensions. The above axis/angle representation characterizes a given rotation by four quantities, namely the three components of the equivalent axis k and the equivalent angle θ. Ho Howe weve ver, r, since since the equiv equivalen alentt axis axis k is given as a unit unit vecto vectorr only only two two of its com compone ponent ntss are independ independen ent. t. The third third is constrained by the condition that k is of unit length. Therefore, only three independent quantities are required in this representation of a rotation R . We can represent the equivalent angle/axis by a single vector r as r
= (rx , ry , rz )T = (θk x , θky , θkz )T .
(2.79)
Note, since k is a unit vector, that the length of the vector r is the equivalent angle θ and the direction of r r is the equivalent axis k.
2.6
Homoge Homogeneo neous us Transfo ransforma rmatio tions ns
We have seen how to represent both positions and orientations. In this section we combine these two concepts to define homogeneous transformations. Consider Consider Figure 2.14. In this figure, frame o 1 x1 y1 is obtained by rotating frame o0 x0 y0 by angle θ, and frame o2 x2 y2 is obtained obtained by subsequently subsequently translating frame o 1 x1 y1 by the displacement v2 . If we consider the point p 1 as being rigidly attached to coordinate frame o0 x0 y0 as these transformations are perfor p erformed, med, then p2 is the location of p1 after the rotation, and p 3 is the location of p1 after the translati translation. on. If we are given given the coordin coordinate atess of the point p3 with respect to frame o2 x2 y2 , and if we know the rotation and translation that are applied to obtain frame o2 x2 y2 , it is straightforward to
63
2.6. HOMOGENEOUS TRANSFORMATIONS TRANSFORMATIONS
compute the coordinates of the point p 3 with respect to o 0 x0 y0 . To see this, note the point p3 is displaced by the vector v3 from the origin of o0 x0 y0 . Further, we see that v3 = v1 + v2 . Therefore, to solve our problem, we need only find coordinate assignments for the vectors v1 and v2 with respect to frame o 0 x0 y0 . Once we have these coordinate assignments, we can compute the coordinates for v3 with respect to o 0 x0 y0 using the equation v 30 = v 10 + v20 . We can obtain coordinates for the vector v1 by applying the rotation matrix to the coordinates that represent p2 in frame o1 x1 y1 , v10
= R10 p21
(2.80)
= R20 p32 ,
(2.81)
where the second equality follows because the orientations of o1 x1 y1 and o2 x2 y2 are the same and because p21 = p32 . If we denote denote the the coordin coordinat atee 0 assignment for v2 by d2 (which denotes the displacement of the origin of o2 x2 y2 , expressed relative to o0 x0 y0 ), we obtain p30 = R 20 p32 + d20 .
(2.82)
Note that no part of the derivation above was dependent on the fact that we used a two-dimensi two-dimensional onal space. This same derivation derivation can be applied applied in three dimensions to obtain the following rule for coordinate transformations. o 1 x1 y1 z1 is obtained from frame o o 0 x0 y0 z0 by first applying a rotation If frame o 0 specified by R1 followed by a translation given (with respect to o0 x0 y0 z0 ) by d10 , then the coordinates p0 are given by p0 = R 10 p1 + d 10 .
(2.83)
In this text, we will consider only geometric relationships between two coordinate systems that can be expressed as the combination of a pure rotation and a pure translation. Definition 1 A transformat transformation ion of the form given in Equation Equation (2.83) is said to define a rigid rigid motion if R is orthogonal. Note that the definition of a rigid motion includes reflections includes reflections when det R = 1. In our case we will never never have have need for the most general general rigid motion, so we assume always that R S O(3). If we have the two rigid motions
−
∈
p0
= R01 p1 + d10
(2.84)
TRANSFORMATIONS 64CHAPTER 2. RIGID MOTIONS AND HOMOGENEOUS TRANSFORMATIONS
and p1
= R12 p2 + d21
(2.85)
then their composition defines a third rigid motion, which we can describe by substituting the expression for p1 from (2.85) into (2.84) p0
= R01 R21 p2 + R01 d21 + d10 .
(2.86)
Since the relationship between p 0 and p2 is also a rigid motion, we can equally describe it as p0
= R20 p2 + d20 .
(2.87)
Comparing Equations (2.86) and (2.87) we have the relationships R02
= R10R21
0
0
0 1
1
= d1 + R d2 .
d2
(2.88)
(2.89)
Equation (2.88) shows that the orientation transformations can simply be multip multiplie lied d togethe togetherr and Equatio Equation n (2.89) (2.89) shows shows that that the vecto vectorr from from the o d 1 (the vector origin o 0 to the origin o 2 has coordinates given by the sum of d 0 1 from o 0 to o 1 expressed with respect to o 0 x0 y0 z0 ) and R 1 d2 (the vector from o1 to o2 , expressed in the orientation of the coordinate system o0 x0 y0 z0 ). A comparison of this with the matrix identity
R10
d10
0
1
R21
d12
0
1
=
R10 R21
R10 d12 + d10
0
1
(2.90)
where 0 denotes the row vector (0, 0, 0), shows that the rigid motions can be represented by the set of matrices of the form H =
R
d
0
1
;R
∈ S O(3).
(2.91)
Using the fact that R is orthogonal it is an easy exercise to show that the inverse transformation H −1 is given by H −1
=
R
T
0
−R
T
1
d
.
(2.92)
Transformation matrices of the form (2.91) are called homogeneous transformations. transformations. In order to represen representt the transfo transforma rmation tion (2.83) (2.83) by a
65
2.6. HOMOGENEOUS TRANSFORMATIONS TRANSFORMATIONS
matrix multiplication, one needs to augment the vectors p0 and p1 by the addition of a fourth component of 1 as follows. Set P 0
=
1
=
P
p0
1
p1
1
(2.93)
.
(2.94)
The vectors P 0 and P 1 are known as homogeneou as homogeneouss representations representations of 0 1 the vectors p and p , respect respectiv ively ely.. It can now now be seen seen direct directly ly that the transformat transformation ion (2.83) is equivalen equivalentt to the (homogeneou (homogeneous) s) matrix equation P 0
= H 10P 1
(2.95)
The set of all 4 4 matrices H of the form (2.91) is denoted by E (3). (3).3 A set of basic homogeneous transformations generating E (3) (3) is given by
×
Transx,a =
Transy,b =
Transz,c =
1 0 0 0
0 1 0 0
0 0 1 0
a
1 0 0 0
0 1 0 0
0 0 1 0
0
1 0 0 0
0 1 0 0
0 0 1 0
0 0
0 0 1
b
0 1
c
1
; Rotx,α =
; Roty,β =
; Rotx,γ =
−
1 0 0 cα 0 sα 0 0
0 0 sα 0 cα 0 0 1
−
cβ 0 sβ 0
0 1 0 0 sβ 0 cβ 0 0 0 0 1
cγ sγ
0 0
0 cγ 0 0 1 0 0
−s
γ
0 0 0 1
(2.96)
(2.97)
(2.98)
for translation and rotation about the x, x, y , z -axes, respectively. The most general homogeneous transformation that we will consider may be written now as H 10
3
The notation
=
E (3) (3)
nx ny nz
sx sy sx
ax ay az
dx dy dz
0
0
0
1
=
n
s a
d
0
0
1
stands for Euclidean group of order 3.
0
.
(2.99)
TRANSFORMATIONS 66CHAPTER 2. RIGID MOTIONS AND HOMOGENEOUS TRANSFORMATIONS
In the above equation n = (nx , ny , nz )T is a vector representing the direction of x1 in the o0 x0 y0 z0 system, s = (sx , sy , sz )T represents the direction of y1 , and a = (ax , ay , az )T represents the direction of z1 . The vect vector or T d = (dx , dy , dz ) represents the vector from the origin O0 to the origin O 1 expressed in the frame o 0 x0 y0 z0 . The rationale behind the choice of letters n, s and a is explained in Chapter 3. NOTE: The same interpretation regarding composition and ordering of transformations holds for 4 4 homogeneous transformat transformations ions as for 3 3 3 rotations .
×
×
Example 2.8 The homogeneous homogeneous transformation matrix H that represents α degrees about the current x x -axis followed b a rotation of α followed by a translat translation ion of b units along the current x-axis, followed by a translation of d units along the current z -axis, followed by a rotation of θ degrees about the current z -axis, is given by H = Rotx,α Trans x,b x,b Trans z,d z,d Rotz,θ
=
=
⋄
1 0 0 cα 0 sα 0 0
0
−s
α
cα
0
−s
0 0 0 1 0
cθ cα sα sα sθ
cα cθ s α cθ
0
0
θ
1 0 0 0
0 1 0 0
cα
b sα d cα d
0
1
−s − α
0 0 1 0
b
0 0 1
1 0 0 0
0 1 0 0
0 0 1 0
(2.100) 0 0 d
1
cθ sθ
−s
0 0
0 0
cθ
θ
0 0 1 0
.
The homogeneous representation (2.91) is a special case of homogeneous coordinates, which have been extensively used in the field of computer graphics. There, one is, in addition, interested in scaling and/or perspective transformations. The most general homogeneous transformation takes the form H =
R3 3 f 1×3 ×
d3×1 s1×1
=
Rota Rotati tion on perspective
T ransl ranslat atio ion n scale f actor
. (2.101)
For our purposes we always take the last row vector of H to be (0, 0, 0, 1), although the more general form given by (2.101) could be useful, for example, for interfacing a vision system into the overall robotic system or for graphic simulation.
0 0 0 1
67
2.7. PROBL PROBLEMS EMS
2.7
Pro Problem blemss
1. If R R is an orthogonal matrix show that the column vectors of R R are of unit length and mutually perpendicular. 2. If R is an orthogonal matrix show that det R = 3. Show Show that det R = nate systems.
±1.
±1 if we restrict ourselves to right-handed coordi-
4. Verify Equations Equations (2.16)-(2.18). 5. Derive Derive Equations (2.19) and (2.20). 6. Suppose Suppose A is a 2 2 rotation rotation matrix. matrix. In other words words AT A = I and det A = 1. Show Show that there there exists exists a unique unique θ such that A is of the form
×
A =
cos θ sin θ
− sin θ cos θ
.
7. Find the rotation rotation matrix represen representing ting a roll of π4 followed by a yaw of π followed by a pitch of π2 . 2 8. If the coordinate coordinate frame o 1 x1 y1 z1 is obtained from the coordinate frame o0 x0 y0 z0 by a rotation of π2 about the x -axis followed by a rotation of π about the fixed y -axis, find the rotation matrix R representing the 2 composite transformation. Sketch the initial and final frames. 9. Suppose that that three coordinate coordinate frames o 1 x1 y1 z1 , o 2 x2 y2 z2 and o 3 x3 y3 z3 are given, and suppose
R21
=
1 0 0
0 1
√ 2
3 2
−
0√
3 2
1 2
; R31 =
0 0 0 1 1 0
−1 0 0
.
Find the matrix R32. 10. Verify Equation Equation (2.71). R is a rotation matrix show that +1 is an eigenvalue of R R . Let k be 11. If R b e a unit eigenvector corresponding to the eigenvalue +1. Give a physical interpretation of k k .
TRANSFORMATIONS 68CHAPTER 2. RIGID MOTIONS AND HOMOGENEOUS TRANSFORMATIONS 1 12. Let k = √ (1, 1, 1)T , θ = 90◦ . Find Rk,θ . 3
13. Show Show by direct direct calculation calculation that R k,θ given by (2.71) is equal to R given by (2.76) if θ and k are given by (2.77) and (2.78), respectively. 14. Suppose Suppose R represents a rotation of 90◦ about y 0 followed by a rotation of 45◦ about z 1 . Find the equivalent axis/angle to represent R . Sketch the initial and final frames and the equivalent axis vector k. 15. Find the rotation rotation matrix matrix corres correspond ponding ing to the set of Euler Euler angles angles π π What is the direc directio tion n of the x1 axis relative to the base , 0, 4 . What 2 frame?
16. Compute Compute the homogeneous homogeneous transforma transformation tion representing representing a translation translation π of 3 units along the x-axis followed by a rotation of 2 about the current z -axis followed by a translation of 1 unit along the fixed y -axis. Sketch the frame. What are the coordinates of the origin O1 with respect to the original frame in each case? 17. Consider Consider the diagram of Figure 2.15. Find the homogeneous homogeneous transfortransfor0 0 1 mations H 1 , H 2 , H 2 representing the transformations among the three frames shown. Show that H 20 = H 10 , H 21 . 18. Consid Consider er the diagram diagram of Figure Figure 2.16. 2.16. A robot is set up 1 meter from from a table. table. The table table top is 1 meter meter high and 1 meter meter square. square. A frame frame o1 x1 y1 z1 is fixed to the edge of the table table as shown. shown. A cube measurmeasuring 20 cm on a side is placed in the center of the table with frame o2 x2 y2 z2 established at the center of the cube as shown. A camera is situated directly above the center of the block 2m above the table top with frame o 3 x3 y3 z3 attached as shown. Find the homogeneous homogeneous transformations relating each of these frames to the base frame o0 x0 y0 z0 . Find the homogeneous transformation relating the frame o2 x2 y2 z2 to the camera frame o3 x3 y3 z3 . 19. In Problem 2-18, 2-18, suppose that, after the camera is calibrated, calibrated, it is ro◦ tated 90 about z 3 . Recompute the above coordinate transformations. 20. If the block block on the table table is rotate rotated d 90◦ degrees about z2 and moved so that that its cen center ter has has coo coord rdina inate tess (0, .8, .1)T relati relative ve to the frame frame o1 x1 y1 z1 , compute the homogeneous transformation relating the block frame to the camera frame; the block frame to the base frame.
69
2.7. PROBL PROBLEMS EMS
y1 z 1 x1
√
2m 1m
y2
z 0
45 x2 z 2
◦
1m
x0 y0
Figure 2.15: Diagram for Problem 2.17.
TRANSFORMATIONS 70CHAPTER 2. RIGID MOTIONS AND HOMOGENEOUS TRANSFORMATIONS
x3
y3 z 3
2m
z 2 y2
z 1 x2
1m
y1 x1 z 0 y0 x0
1m
1m 1m
Figure 2.16: Diagram for Problem 2.18.