Matthew T. Mason Mechanics of Manipulation
Today s outline
Readings, etc. We are starting chapter 3 of the text Lots of stuff online on representing rotations Murray, Li, and Sastry for matrix exponential Roth, Crenshaw, Ohwovoriole, Salamin, all cited in text
Analytic geometry So far, Euclidean geometry. Why? Insight Visualization Economy of expression Now Cartesian, analytic geometry. Why? Beyond 2D, beyond 3D. We need to work with high dimensional configuration spaces! For implementation For additional insight The best of all possible worlds: use both. Understand geometrical or physical meaning for all terms.
Agenda for kinematic representation Following the kinematic agenda: Spherical Spatial Constraints
planar Obvious idea 1 Displacement is rotation or translation Choose a coordinate frame (O, ˆx, ŷ) For rotation, (center, angle), i.e. ((x, y), θ) For translation, ( x, y ) Ugly Obvious idea 2 Given O, displacement is rotation about O; translation Choose a coordinate frame (O, ˆx, ŷ) ( x, y, θ)
What are representations for? Obvious ideas didn t yield homogeneous coordinate transform matrices? We didn t consider all the uses of representations! Uses of representations Communicate with humans and computers Operate on points, lines and stuff Compose Sample, interpolate, average, smooth Differentiate, integrate
Operating on stuff ( x, y, θ) is good for communication. How would you operate on points? Composition? Averaging? Sampling? To operate on points: Represent points by Cartesian coordinates: (x, y) Rotate using rotation matrix Translate using component-wise addition Tidy it up using homogeneous coordinates We will revisit later
Why representing rotations is hard. s do not commute. Vectors are out. For computation we like to represent things with real numbers, so our representations all live in R n. Even though SO(3) is a three-dimensional space, it has the topology of projective three space P 3, which cannot be smoothly mapped to R 3. And, we have lots of different applications, with different requirements: communication, operating on things, composition, interpolation, etc.
Choices Good for communication, geometrical insight Good for operating on stuff, composition, analytical insight Unit quaternions (aka Euler parameters) Good for composition, analytical insight, sampling Good for communication, geometrical insight
Euler s theorem: every spatial rotation has a rotation axis. Let O, ˆn, θ, be... Let rot(ˆn, θ) be the corresponding rotation. Many to one: rot( ˆn, θ) = rot(ˆn, θ) rot(ˆn, θ + 2kπ) = rot(ˆn, θ), for any integer k. So, restrict θ to [0, π]. But not smooth at the edges. When θ = 0, the rotation axis is indeterminate, giving an infinity-to-one mapping. Again you can fix by adopting a convention for ˆn, but result is not smooth. (Or, what about using the product, θˆn? Later.) n
What do we want from axis-angle? Operate on points Compose rotations, average, interpolate, sampling,...? Not using axis-angle Convert to other representations? There aren t any yet. But, later we will use axis-angle big time. It s very close to quaternions.
Others derive using rotation matrices: ugly and messy. The geometrical approach is clean and insightful. Given point x, decompose into components parallel and perpendicular to the rotation axis x = ˆn(ˆn x) ˆn (ˆn x) Only x is affected by the rotation, yielding : n n x n n x n n x x x x = ˆn(ˆn x)+sin θ (ˆn x) cos θ ˆn (ˆn x) O A common variation: x = x+(sin θ) ˆn x+(1 cos θ) ˆn (ˆn x)
Choose O on rotation axis. Choose frame (û 1, û 2, û 3 ). Let (û 1, û 2, û 3 ) be the image of that frame. Write the û i vectors in û i coordinates, and collect them in a matrix: û 1 = û 2 = û 3 = a 11 a 21 a 31 a 12 a 22 a 32 a 13 a 23 a 33 = = = û 1 û 1 û 2 û 1 û 3 û 1 û 1 û 2 û 2 û 2 û 3 û 2 û 1 û 3 û 2 û 3 û 3 û 3 A = ( ) (û a ij = 1 û ) 2 û 3
So many numbers! A rotation matrix has nine numbers, but spatial rotations have only three degrees of freedom, leaving six excess numbers... There are six constraints that hold among the nine numbers. û 1 = û 2 = û 3 = 1 û 3 = û 1 û 2 i.e. the û i are unit vectors forming a right-handed coordinate system. Such matrices are called orthonormal or rotation matrices.
Rotating a point Let (x 1, x 2, x 3 ) be coordinates of x in frame (û 1, û 2, û 3 ). Then x is given by the same coordinates taken in the (û 1, û 2, û 3 ) frame: x =x 1 û 1 + x 2û 2 + x 3û 3 =x 1 Aû 1 + x 2 Aû 2 + x 3 Aû 3 =A(x 1 û 1 + x 2 û 2 + x 3 û 3 ) =Ax So rotating a point is implemented by ordinary matrix multiplication.
Sub- and superscript notation for rotating a point Let A and B be coordinate frames. Let A x be coordinates in frame A. Let B AR be the rotation matrix that rotates frame B to frame A. Then (see previous slide) B AR represents the rotation of the point x: B x = B A R B x Note presuperscripts all match. Both points, and xform, must be written in same coordinate frame.
Coordinate transform There is another use for B A R: A x and B x represent the same point, in frames A and B resp. To transform from A to B: B x = B A R A x For coord xform, matrix subscript and vector superscript cancel. from B to A is the same as coordinate transform from A to B.
Example rotation matrix B A R = ( B x B A y A 1 0 0 B ) z A = 0 0 1 0 1 0 How to remember what B AR does? Pick a coordinate axis and see. The x axis isn t very interesting, so try y: 1 0 0 0 0 1 0 1 0 0 1 0 = 0 0 1
Nice things about rotation matrices Composition of rotations: {R 1 ; R 2 } = R 2 R 1. ({x; y} means do x then do y.) Inverse of rotation matrix is its transpose B A R 1 = A B R = B A RT. Coordinate xform of a rotation matrix: B R = B A R A R A B R
Converting rot(ˆn, θ) to R Ugly way: define frame with ẑ aligned with ˆn, use coordinate xform of previous slide. Keen way:! x = x + (sin θ) ˆn x + (1 cos θ) ˆn (ˆn x) Define cross product matrix N: N = 0 n 3 n 2 n 3 0 n 1 n 2 n 1 0 so that Nx = ˆn x
... using... Substituting the cross product matrix N into : Factoring out x x = x + (sin θ)nx + (1 cos θ)n 2 x R = I + (sin θ)n + (1 cos θ)n 2 That s it! in matrix form. If you want to you could expand it: n2 1 + (1 n2 1 )cθ n 1n 2 (1 cθ) n 3 sθ n 1 n 3 (1 cθ) + n 2 sθ n 1 n 2 (1 cθ) + n 3 sθ n 2 2 + (1 n2 2 )cθ n 2n 3 (1 cθ) n 1 sθ n 1 n 3 (1 cθ) n 2 sθ n 2 n 3 (1 cθ) + n 1 sθ n 2 3 + (1 n2 3 )cθ where cθ = cos θ and sθ = sin θ. Ugly.
for differential rotations Consider for a differential rotation rot(ˆn, dθ). so x =(I + sin dθn + (1 cos dθ)n 2 )x =(I + dθn)x dx =Nx dθ =ˆn x dθ It follows easily that differential rotations are vectors: you can scale them and add them up. We adopt the convention of representing angular velocity by the unit vector ˆn times the angular velocity.
Converting from R to rot(ˆn, θ)... Problem: ˆn isn t defined for θ = 0. We will do it indirectly. Convert R to a unit quaternion (next lecture), then to axis-angle.
Three numbers to describe spatial rotations. ZYZ convention: (α, β, γ) rot(γ, ẑ ) rot(β, ŷ ) rot(α, ẑ) Can we represent an arbitrary rotation? Rotate α about ẑ until ŷ ẑ ; Rotate β about ŷ until ẑ ẑ ; Rotate γ about ẑ until ŷ = ŷ. x z z y Note two choices for ŷ... x... except sometimes infinite choices.
Converting from to rotation matrices notation Define frames {0}, {1}, {2}, {3} so that rot(α, ẑ) maps {0} to {1}, etc., As before i jr is the rotation matrix rotating frame {i} to frame {j}, written in frame {i} coordinates. Let k ( i jr) be the same matrix, written in frame {k} coordinates. Then the correct sequence, written in a common coordinate frame, would be 0 3 R = 0 ( 2 3 R) 0 ( 1 2 R) 0 ( 0 1 R)
Moving frame versus fixed frame Switch to moving frame Use the coordinate transform of a matrix formula: 0 3 R = 0 ( 2 3 R) 0 ( 1 2 R) 0 1 R = ( 0 2 R 2 3 R 2 0 R) (0 1 R 1 2 R 1 0 R) 0 1 R = 0 1 R 1 2 R 2 3 R Wow! You can switch between moving frame and fixed frame, if you also switch the order! You could also have derived the above, just by interpreting 0 3R as a coordinate transform.
From (α, β, γ) to R 0 3 R = 0 1 R 1 2 R 2 3 R cα sα 0 = sα cα 0 0 0 1 = cβ 0 sβ 0 1 0 sβ 0 cβ cγ sγ 0 sγ cγ 0 0 0 1 cα cβ cγ sα sγ cα cβ sγ sα cγ cα sβ sα cβ cγ + cα sγ sα cβ sγ + cα cγ sα sβ sβ cγ sβ sγ cβ
From R to (α, β, γ) the ugly way Case 1: r 33 = 1, β = 0. α γ is indeterminate. cos(α + γ) sin(α + γ) 0 R = sin(α + γ) cos(α + γ) 0 0 0 1 Case 2: r 33 = 1, β = πor π. α + γ is indeterminate. cos(α γ) sin(α γ) 0 R = sin(α γ) cos(α γ) 0 0 0 1 For generic case: solve 3rd column for β. (Sign is free choice.) Solve third column for α and third row for γ.... but there are numerical issues...
From R to (α, β, γ) the clean way Let σ = α + γ δ = α γ Then r 22 + r 11 = cos σ(1 + cos β) r 22 r 11 = cos δ(1 cos β) r 21 + r 12 = sin δ(1 cos β) r 21 r 12 = sin σ(1 + cos β) (No special cases for cos β = ±1?) Solve for σ and δ, then for α and γ, then finally β = tan 1 (r 13 cos α + r 23 sin α, r 33 )
But what about sin β = 0? How can this method work without explicitly addressing the singularity? When β = 0, σ is determined and δ is not. When β = π, δ is determined and σ is not. If your tan 1 handles (0, 0), you can just let it go!