3D Kinematics Eric Whitman 1/24/2010 Rigid Body State: 2D p ŷ x̂ Rigid Body State: 3D p ŷ ẑ x̂ Add a Reference Frame ŷ ' p ŷ ẑ x̂ ẑ ' x̂' Rotation Matrix • Linear Algebra definition – Orthogonal matrix: R-1 = RT • square – det(R) = 1 • 2D: 4 numbers • 3D: 9 numbers Unit Vectors xˆ ' x' x xˆ x' y yˆ x' z zˆ ŷ ' p ŷ ẑ x̂ ẑ ' yˆ ' y ' x xˆ y ' y yˆ y ' z zˆ zˆ ' z ' x xˆ z ' y yˆ z ' z zˆ x̂' x' x R x' y x' z y'x y' y y'z z'x z' y z ' z Using the Rotation Matrix ŷ ' a A p ŷ ẑ x̂ ẑ ' x̂' A p Ra Pros and • Rotates Vectors Directly • Easy composition Cons • 9 numbers • Difficult to enforce constraints Simple Rotation Matrices 2D cos( ) sin( ) R( ) sin( ) cos( ) 3D cos( ) Rz ( ) sin( ) 0 cos( ) R y ( ) 0 sin( ) sin( ) 0 cos( ) 0 0 1 0 sin( ) 1 0 0 cos( ) 0 0 1 Rx ( ) 0 cos( ) sin( ) 0 sin( ) cos( ) Degrees of Freedom • 2D – 2x2 matrix has 4 numbers – Only one DoF • 3D – 3x3 matrix has 9 numbers – 6 constraints – 3 DoF Euler Angle Combinations • Can use body or world coordinates • 2 consecutive angles must be different – Can alternate (3-1-3) or be all different (3-1-2) • 24 possibilities (12 pairs of equivalent) • For aircraft, 3-2-1 body is common – Yaw, pitch, roll • For spacecraft, 3-1-3 body is common Construct a Rotation Matrix 3-1-3 Body Convention – Common for spacecraft cc scs R( , , ) sc ccs ss cs scc ss ss ccc cs sc c Recover Euler Angles cc scs R( , , ) sc ccs ss cs scc ss ss ccc cs sc c arccos( R33 ) arctan( R31, R32 ) arctan( R13, R23 ) Gimbal Lock • Physically: two gimbal axes line up, making movement in one direction impossible • Mathematically describes a singularity in Euler angle systems • For the 3-1-3 body convention, this occurs when angle 2 equals 0 or pi • For the 3-1-2 body convention, this occurs when angle 2 +/- pi/2 • Switching helps Pros and • Minimal Representation • Human readable Cons • Gimbal Lock • Must convert to RM to rotate a vector • No easy composition Axis Angle (4 numbers) • A special case of Euler’s Rotation Theorem: any combination of rotations can be represented as a single rotation • 3 numbers to represent the axis of rotation • 1 number to represent the angle of rotation • Has singularity for small rotations a, Rotation Vector (3 numbers) • The axis can be a unit vector (only 2 DoF) • Multiply axis by angle of rotation • Can easily extract axis angle – Axis = rotation vector • Normalize if desired – Angle = ||rotation vector|| • Same singularity – small rotations â Pros and • Minimal Representation • Human readable (sort of) Cons • Singularity for small rotations • Must convert to RM to rotate a vector • No easy composition (Unit) Quaternions • All schemes with 3 numbers will have a singularity q – So says math (topology) 1 q q 2 q q3 q 4 q4 q1 q q2 sin( / 2) aˆ q3 q4 cos( / 2) Constraint q q q q q q 1 T • Easy to enforce 2 1 2 2 2 3 2 4 Conversion with RM q12 q22 q32 q42 R 2(q2 q1 q4 q3 ) 2(q3 q1 q4 q2 ) 2(q1q2 q4 q3 ) q12 q22 q32 q42 2(q3 q2 q4 q1 ) 1 q4 1 R11 R22 R33 2 1 q1 ( R23 R32 ) 4q4 q2 1 ( R31 R13 ) 4q4 q3 1 ( R12 R21 ) 4q4 2(q1q3 q4 q2 ) 2(q2 q3 q4 q1 ) q12 q22 q32 q42 Composition q'4 q q4q'q'q q'q q'4 q4 q'q Pros and • No Singularity • Almost minimal representation • Easy to enforce constraint • Easy composition • Interpolation possible Cons • Not quite minimal • Somewhat confusing Summary of Rotation Representations • Need rotation matrix to rotate vectors • Often more convenient to use something else and convert to rotation matrix • Euler angles good for small angular deviations • Quaternions good for free rotation Homogeneous Transformations p o R p 0 0 1 0 1 1 Define: p ~ p 1 0 A1 R10 0T 0 o1 1 Composition 0 0 1 n 1 n ~ p A1 A2 ... An p