Download presentation
Presentation is loading. Please wait.
1
More Rigid Transforms, 3D Rotations
ECE 383/ ME 442 More Rigid Transforms, 3D Rotations 1
2
Agenda Working with transforms 3D rotations and representations
3
Operations on Transforms
Application Composition Inversion Interpolation Differentiation Accomplish: changes of coordinate frame Accomplish: movement
4
Composing 2D transformations
Using the representation q=( ๐ก ,๐) with ๐ก =( ๐ก ๐ฅ , ๐ก ๐ฆ ) ๐ ๐ ๐ฅ =๐
๐ ๐ฅ + ๐ก Suppose this is followed by another transformation ๐ ๐ โฒ with ๐ โฒ = ๐ก โฒ , ๐ โฒ . Thenโฆ ๐ ๐ โฒ ๐ ๐ ๐ฅ =๐
๐ โฒ ๐
๐ ๐ฅ + ๐ก + ๐ก โฒ =๐
๐ โฒ ๐
๐ ๐ฅ +๐
๐ โฒ ๐ก + ๐ก โฒ Which is equivalent to the transform ๐ ๐โฒโฒ represented by ๐ โฒโฒ = ๐
๐ โฒ ๐ก + ๐ก โฒ ,๐+ ๐ โฒ
5
Rigid Transformation in 3D
q = (R,tx,ty,tz) with R a 3x3 rotation matrix Robot R0๏R3 given in reference frame T0 Whatโs the new robot Rq? {Tq(x,y,z) | (x,y,z) ๏ R0} Define rigid transformation Tq(x,y,z) : R3๏ฎ R3 R x y z tx ty tz Tq(x,y,z) = + 3D rotation matrix Affine translation 5
6
3-D Rigid Rotations r11 r12 r13 r21 r22 r23 r31 r32 r33 det(A) = +1
Orthogonal rows and columns: ATA=I, AAT=I ||Ax|| = ||x|| for any x, L2 norm ||.|| Product of two rotations is a rotation (0,1,0) (r11,r21,r31) (Right-handed coordinate system) (r13,r23,r33) (1,0,0) (1,0,0) (r12,r22,r32) (0,0,1) (0,0,1) 6
7
Coordinate Frames R R-1 = RT Local frame World frame ๐ 13 ๐ 23 ๐ 33
๐ 13 ๐ 23 ๐ 33 (0,1,0) R ๐ฅ ๐ฆ ๐ง ๐ 11 ๐ 21 ๐ 31 (1,0,0) R ๐ฅ ๐ฆ ๐ง ๐ 12 ๐ 22 ๐ 32 (0,0,1) R-1 = RT
8
Composing 3D transformations
Using the representation q=(๐
, ๐ก ) with ๐ก =( ๐ก ๐ฅ , ๐ก ๐ฆ , ๐ก ๐ง ) ๐ ๐ ๐ฅ =๐
โ
๐ฅ + ๐ก Suppose this is followed by another transformation ๐ ๐ โฒ with ๐ โฒ =(๐
โฒ, ๐ก โฒ). Thenโฆ ๐ ๐ โฒ ๐ ๐ ๐ฅ = ๐
โฒ โ
๐
โ
๐ฅ + ๐ก + ๐ก โฒ = ๐
โฒ โ
๐
๐ฅ + ๐
โฒ โ
๐ก + ๐ก โฒ Which is equivalent to the transform ๐ ๐โฒโฒ where ๐ โฒโฒ = ๐
โฒ โ
๐
, ๐
โฒ โ
๐ก + ๐ก โฒ
9
Interpolating 2D rotations
Say we want to blend smoothly from ๐
๐ to ๐
๐ โฒ with a parameter ๐ขโ[0,1] (๐ข=0 gives ๐
๐ , ๐ข=1 gives ๐
(๐โ)) Blending matrices doesnโt work: (1โ๐ข)๐
(๐)+๐ข ๐
(๐โ) isnโt in general a rotation matrix Blending angles ๐
1โ๐ข ๐+๐ข ๐ โฒ โฆ sort of works. What about the boundary at 0 and 2๐? Naรฏve blend ๐ Geodesic blend: pick minimum of CW and CCW displacement ๐ ๐โฒ ๐โฒ
10
Topological spaces Three representations of 2D rotations:
Representation 1: Angle ๐โ[0,2๐) Representation 2: Matrix ๐
= ๐ 11 ๐ 12 ๐ 21 ๐ with constraints ๐
๐ ๐
=๐ผ (in other words, ๐ ๐ 12 2 = ๐ ๐ 22 2 =1 and ๐ 11 ๐ 21 + ๐ 12 ๐ 22 =0) det(R)=+1 Representation 3: unit vector ๐ฅ = ๐ฅ 1 , ๐ฅ 2 ๐ with ๐ฅ =1 And a way to convert between them: ๐
๐ = cos ๐ โ sin ๐ sin ๐ cos ๐ ๐ ๐
=atan2( ๐ 21 , ๐ 11 ) (here atan2 gives a range of [0,2๐) ) ๐ฅ ๐ = cos ๐ , sin ๐ ๐ , ๐ฅ ๐
= ๐ 11 , ๐ 21 ๐ , ๐
๐ฅ = ๐ฅ 1 โ ๐ฅ 2 ๐ฅ 2 ๐ฅ 1 But rotations donโt โblendโ in the way they would on either 0,2๐ , ๐
2 , or in ๐ 2,2 โฆ Fundamentally different topology
11
Some Important Topological Spaces
R: real number line Rn: N-dimensional Cartesian space S1: boundary of circle in 2D S2: surface of sphere in 3D SO(2), SO(3): set of 2D, 3D orientations (special orthogonal group) SE(2), SE(3): set of rigid 2D, 3D transformations (special Euclidean group) Cartesian product A x B, power notation An = A x A โฆ x A Homeomorphism ~ denotes topological equivalence Continuous mapping with continuous inverse (bijective) Cube ~ S2 SO(2) ~ S1 SE(3) ~ SO(3) x R3
12
Topology of SO(3) r11 r12 r13 r21 r22 r23 r31 r32 r33
9 entries, constrained by: Orthogonal rows and columns: ATA=I, AAT=I det(A) = +1 (+/- 1 is implied by the first condition) Six (Row-wise) orthogonality constraints: 1 = ๐ ๐ ๐ 13 2 1 = ๐ ๐ ๐ 23 2 1 = ๐ ๐ ๐ 33 2 0 = ๐ 11 ๐ 21 + ๐ 12 ๐ 22 + ๐ 13 ๐ 23 0 = ๐ 11 ๐ 31 + ๐ 12 ๐ 32 + ๐ 13 ๐ 33 0 = ๐ 21 ๐ 31 + ๐ 22 ๐ 32 + ๐ 23 ๐ 33 9 variables - 6 non-redundant constraints => SO(3) has 3 degrees of freedom 12
13
4 representations of 3D rotations
3x3 rotation matrix R Euler angles REuler(f,q,y) Axis angle RAA(v,q) Quaternion RQuat(q) All representations are โequivalentโ but may have certain mathematical or computational advantages
14
Axis-aligned rotations
Rotate about: Z axis Y axis X axis cos ฮธ -sin ฮธ 0 sin ฮธ cos ฮธ 0 cos ฮธ sin ฮธ -sin ฮธ cos ฮธ 0 cos ฮธ -sin ฮธ 0 sin ฮธ cos ฮธ 14
15
Parameterization of SO(3)
Euler angles: (f,q,y) x y z q x y z x y z f x y z 1 ๏ 2 ๏ 3 ๏ 4 15
16
Euler Angles Which axes to pick, and what order? Convention A,B,C
REuler(f,q,y) = RA(f)RB(q)RC(y) E.g., ZYZ, ZYX (roll-pitch-yaw), etc 16
17
Euler Angles Which axes to pick, and what order? Disadvantages
Convention A,B,C REuler(f,q,y) = RA(f)RB(q)RC(y) E.g., ZYZ, ZYX (roll-pitch-yaw), etc Disadvantages Must constrain to range of values Singularities, e.g. ZYZ when q=0 or p (Gimbal lock) Interpolation? 17
18
Axis-Angle Representation
Every rotation matrix R can be obtained by rotating the identity matrix by some angle ฮธ about some axis v! R v = v
19
Axis-Angle Representation
Axis v (||v||=1), angle ฮธ Rodriguesโ formula: rotate x about v -> xโ xโ = x cos ฮธ + (v x x) sin ฮธ + v (vT x) (1 - cos ฮธ) Or in matrix formโฆ RAA(ฮธ,v) = cos ฮธ I + sin ฮธ [v] + (1 - cos ฮธ) v vT Cross product matrix 0 -vz vy vz vx -vy vx 0
20
Recovering Axis and Angle from the Rotation Matrix
ฮธ = Angle(R) = cos-1((r11+r22+r33-1)/2) = cos-1((tr(R)-1)/2) v = Axis(R) = 1/(2 sin ฮธ) r32-r23 r13-r31 r21-r12
21
Properties of Axis-Angle
Disadvantages: Non unique: RAA(ฮธ,v)=RAA(-ฮธ,-v) (can constrain ฮธ to range [0,p]) 4 parameters + one unit length constraint ||v||=1; dealing with this constraint is sometimes annoying, for example, in interpolation, optimization, or sampling Unique encoding: vector w = ฮธv ฮธ = ||w||, v = w/||w|| โExponential mapโ REM(w) = RAA( ||w|| , w/||w|| )
22
Quaternion representation
Generalization of complex numbers Complex z=z0+i z1, with |z|=1 can represent a 2D rotation. Whatโs the 3D analogue? q = q0+q1i + q2j +q3k, where i2 = j2 = k2 = -1 i = jk = -kj j = ki = -ik k = ij = -ji Quaternions were a forerunner of vectors and were once mandatory of all students of physics and math!
23
Unit quaternion representation
q = (q0,q1,q2,q3), ||q||=1 Related to axis angle: q = (cos q/2,vx sin q/2, vy sin q/2, vz sin q/2) 2(q02+q12)-1 2(q1q2-q0q3) 2(q1q3+q0q2) 2(q1q2+q0q3) 2(q02+q22)-1 2(q2q3-q0q1) 2(q1q3-q0q2) 2(q2q3+q0q1) 2(q02+q32)-1 RQ(q) =
24
Properties of Unit Quaternions
4-sphere: 3D manifold in 4D space Non-unique: Double cover of SO(3) Advantages (widely used in computer animation): Quaternion multiplication = rotation composition (slightly faster than matrix *) Curve interpolation formulas (Shoemake, โ85)
25
Summary Rotation matrix Euler angles Axis-angle
9 parameters rij in range [-1,1] Constraint: determinant +1 Advantages: composition, inversion are easy Euler angles 3 parameters (f,q,y) in range [0,2p) Axes picked by convention (e.g., Roll-Pitch-Yaw) Advantages: no constraints, simple interpolation โworksโ Disadvantages: multiple representation, singularities, composition & inversion not easy Axis-angle 4 parameters (q,v), q in [0,p] Constraint: |v|=1 Advantages: intuitive, inversion is easy Disadvantages: constraint, composition & interpolation not easy , multiple representation at p Moment representation (aka exponential map) 3 parameters w (= q*v), ||w||<=p Advantages: no constraints, inversion easy, relation to angular velocity (as we shall see soon) Disadvantages: composition & interpolation not easy, multiple representation at p Quaternion 4 parameters q=(q0,q1,q2,q3) Constraint: |q|=1 Advantages: composition & interpolation formulas, inversion easy Disadvantages: constraint, multiple representation R(q) = R(-q)
26
Notion of Distance ฮธ(R1TR2) = cos-1 ((tr(R1TR2)-1)/2) measures the minimum angle needed to rotate from frame R1 to R2 Makes a good distance metric
27
Actually a geodesic in SO(3)!
Rotation in Motion Interpolating between two rotation matrices A and B We want a path X(s) : [0,1] -> SO(3) with R(0) = A and R(1) = B Let v = Axis(ATB), ฮธ = Angle(ATB) Verify that X(s) = A RAA(sฮธ,v) satisfies the desired properties Actually a geodesic in SO(3)!
28
Differentiating 2D rotations
๐
๐ = cos ๐ โ sin ๐ sin ๐ cos ๐ ๐
โ ๐ = โ sin ๐ โ cos ๐ cos ๐ โsin ๐ Interpretation: Suppose the angle moves as a function of time ๐ ๐ก , and we wish to observe the movement of a point ๐ฆ ๐ก =๐
๐(๐ก) ๐ฅ where the original coordinates ๐ฅ are not time-varying By the chain rule, ๐ฆ โฒ ๐ก = ๐ โฒ (๐ก) ๐ ๐๐ ๐
๐ ๐ก โ
๐ฅ (Convince yourself by writing out the components of ๐ฆ(๐ก)) So, the product ๐
โฒ ๐ โ
๐ฅ gives the velocity the point ๐ฆ would rotate if moved at a constant velocity ๐
โฒ ๐ โ
๐ฅ is perpendicular to ๐ฆ and of the same magnitude
29
Angular Velocities in 2D
For a rotation trajectory ๐
๐ ๐ก , we can show: ๐ ๐๐ก ๐
๐ ๐ก = ๐ ๐๐ก cos ๐ ๐ก โ sin ๐ ๐ก sin ๐ ๐ก cos ๐ ๐ก = โ sin ๐ ๐ก ๐โฒ(๐ก) โ cos ๐ ๐ก ๐โฒ(๐ก) cos ๐ ๐ก ๐โฒ(๐ก) โ sin ๐ ๐ก ๐โฒ(๐ก) = ๐ โฒ ๐ก 0 โ ๐
๐ ๐ก => ๐ โฒ ๐ก is the angular velocity For a point in world coordinates ๐ ๐ก =๐
๐ ๐ก ๐ 0 , we have ๐ โฒ (๐ก)= ๐ โฒ ๐ก 0 โ ๐ ๐ก
30
Angular Velocities in 3D
For parameterized rotation trajectory REM(wt), we can show: d/dt REM(wt) = [w] REM(wt) => |w| is the speed of rotation [w] is the cross product matrix => w x x is the velocity of some point x, specified in world coordinates, attached to the frame as it rotates => w is the angular velocity
31
Recap 5 operations on transforms: Four common representations of SO(3)
Application to points / directions Composition Inversion Interpolation Differentiation Four common representations of SO(3) All four implemented robustly in Python klampt.so3 module, C++ in KrisLibrary/math3d Notion of distance, geodesic, velocity in SO(3)
32
Next Week Lab: Intro to Python and Klampโt
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.