Prof. Wei Zhang - Electrical and Computer Engineeringzhang/RoboticsClass/docs/... · Rigid Body...

34
ECE5463: Introduction to Robotics Lecture Note 3: Rotational Motion Prof. Wei Zhang Department of Electrical and Computer Engineering Ohio State University Columbus, Ohio, USA Spring 2018 Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 1 / 30

Transcript of Prof. Wei Zhang - Electrical and Computer Engineeringzhang/RoboticsClass/docs/... · Rigid Body...

ECE5463: Introduction to Robotics

Lecture Note 3: Rotational Motion

Prof. Wei Zhang

Department of Electrical and Computer EngineeringOhio State UniversityColumbus, Ohio, USA

Spring 2018

Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 1 / 30

Outline

• Mathematics of Rigid Body Transformation

• Rotation Matrix and SO(3)

• Euler Angles and Euler-Like Parameterizations

• Exponential Coordinate of SO(3)

• Quaternion Representation of Rotation

Outline Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 2 / 30

Rigid Body Transformation

• Object (Body) in R3: a collection of points, represented by a subset O ⊂ R

3

• Transformation of a body: A single mapping g : O → R3 which maps the

coordinates of points in the body from their initial to final configurations.

• Transformation on points induce an action on vectors in a natural way. Givena transformation g : O → R

3, define

g(v) � g(q) − g(p), where v = q − p

- Note: g has a different domain than g

Rigid Body Transformation Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 3 / 30

Rigid Body Transformation

• Rigid Body Transformation: A mapping g : R3 → R3 is called a rigid body

transformation if it satisfies the following two properties

1. Length preserved: ‖g(q)− g(p)‖ = ‖q − p‖, for all p, q ∈ R3

2. Cross product is preserved: g(v × w) = g(v)× g(w), for all v, w ∈ R3.

• Implications:

- Inner product is preserved:

g(v)T g(w) = vTw, for all v, w ∈ R3

- Angles between vectors are preserved

- Orthogonal vectors are transformed to orthogonal vectors

- Right-handed coordinate frames are transformed to right-handed coordinateframes

Rigid Body Transformation Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 4 / 30

Outline

• Mathematics of Rigid Body Transformation

• Rotation Matrix and SO(3)

• Euler Angles and Euler-Like Parameterizations

• Exponential Coordinate of SO(3)

• Quaternion Representation of Rotation

Rotation Matrix and SO(3) Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 5 / 30

Representation of Orientation

xs

ys

zs

p

xb

yb

zb

• Basic Reference Frames:

- Fixed (or Space) Frame: {s} = {xs, ys, zs}- Body Frame:{b} ={xb, yb, zb}

• Let xsb, ysb and zsb be the coordinate of xb, yb, zb in frame {s}

Rotation Matrix and SO(3) Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 6 / 30

Rotation Matrix

• Let Rsb =[xsb ysb zsb

]

• Rsb constructed above is called a rotation matrix. We know:

- RTsbRsb = I

- det(Rsb) = 1

Rotation Matrix and SO(3) Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 7 / 30

Special Orthogonal Group

• Special Orthogonal Group: Space of Rotation Matrices in Rn is defined as

SO(n) = {R ∈ Rn×n : RRT = I, det(R) = 1}

• SO(n) is a group. We are primarily interested in SO(3) and SO(2), rotationgroups of R3 and R

2, respectively.

• Group is a set G, together with an operation •, satisfying the followinggroup axioms:

- Closure: a ∈ G, b ∈ G ⇒ a • b ∈ G

- Associativity: (a • b) • c = a • (b • c), ∀a, b, c ∈ G

- Identity element: ∃e ∈ G such that e • a = a, for all a ∈ G.

- Inverse element: For each a ∈ G, there is a b ∈ G such that a • b = b • a = e,where e is the identity element.

Rotation Matrix and SO(3) Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 8 / 30

))

Use of Rotation Matrix

• Representing an orientation: Rab =[xab yab zab

]

• Changing the reference frame:

- pa = Rabpb

- Rac = RabRbc

• Rotating a vector or a frame:

- Theorem (Euler):Any orientation R ∈ SO(3) is equivalent to a rotation about afixed axis ω ∈ R

3 through an angle θ ∈ [0, 2π)

R = Rot(ω, θ)

Rotation Matrix and SO(3) Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 9 / 30

gg

RRRRRR RRRRR

Pre-multiplication vs. Post-multiplication

• Given R ∈ SO(3), we can always find ω and θ such that R = Rot(ω, θ).

• Premultiplying by R yields a rotation about an axis ω considered in the fixedframe;

• Postmultiplying by R yields a rotation about ω considered in the body frame

xy

z90◦

90◦

90◦

R = Rot(z, 90◦)

x

yz

{s}xs ys

zs

{b}

xb

yb

zb

zs

zb

Rsb = RRsb

Rsb = RsbR

{b }

xb

yb

zb

{b }xb

ybzb

fixed framerotation

body framerotation

Rotation Matrix and SO(3) Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 10 / 30

Coordinate System for SO(3)

• How to parameterize the elements in SO(3)?

• The definition of SO(3) corresponds to implicit representation:

R ∈ R3×3, RRT = I, det(R) = 1

.

- 6 independent equations with 9 unknowns

- Dimension of SO(3) is 3.

Rotation Matrix and SO(3) Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 11 / 30

Outline

• Mathematics of Rigid Body Transformation

• Rotation Matrix and SO(3)

• Euler Angles and Euler-Like Parameterizations

• Exponential Coordinate of SO(3)

• Quaternion Representation of Rotation

Euler Angles Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 12 / 30

Euler Angle Representation of Rotation

ya ya, yb

x0

φ

zb

θy0

za

yb

x1

y1

ψzb, z1

xa

z0, za

xa

xb xb

• Euler angle representation:

- Start with {b} coincident with {s}

- Rotate {b} about zb by an angle α, then rotate about the (new) yb axis by β,and then rotate about the (new) zb axis by γ. This yields a net orientationRsb(α, β, γ) parameterized by the ZYZ angles (α, β, γ)

- Rsb(α, β, γ) = Rz(α)Ry(β)Rz(γ)

Euler Angles Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 13 / 30

Other Euler-Like Parameterizations

• Other types of Euler angle parameterization can be devised using differentordered sets of rotation axes

• Common choices include:

- ZYX Euler angles: also called Fick angles or yaw, pitch and roll angles

- YZX Euler angles (Helmholtz angles)

x0

Yaw

Roll

y0

z0

Pitch

Euler Angles Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 14 / 30

RollRollRoll

YawYaw

Examples of Euler-Like Representations

Euler Angles Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 15 / 30

Outline

• Mathematics of Rigid Body Transformation

• Rotation Matrix and SO(3)

• Euler Angles and Euler-Like Parameterizations

• Exponential Coordinate of SO(3)

• Quaternion Representation of Rotation

Exponential Coordinate Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 16 / 30

Towards Exponential Coordinate of SO(3)

• Recall the polar coordinate system of the complex plane:

- Every complex number z = x+ jy = ρejφ

- Cartesian coordinate (x, y) ↔ polar coorindate (ρ, φ)

- For some applications, the polar coordinate is preferred due to its geometricmeaning.

• For any rotation matrix R ∈ SO(3), it turned out R = e[ω]θ

- ω: unit vector representing the axis of rotation

- θ: the degree of rotation

- ωθ is called the exponential coordinate for SO(3).

Exponential Coordinate Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 17 / 30

Skew Symmetric Matrices

• Recall that cross product is a special linear transformation.

• For any ω ∈ Rn, there is a matrix [ω] ∈ R

n×n such that ω × p = [ω]p

ω =

⎡⎣ ω1

ω2

ω3

⎤⎦ ↔ [ω] =

⎡⎣ 0 −ω3 ω2

ω3 0 −ω1

−ω2 ω1 0

⎤⎦

• Note that [ω] = −[ω]T ← skew symmetric

• [ω] is called a skew-symmetric matrix representation of the vector ω

• The set of skew-symmetric matrices in: so(n) � {S ∈ Rn×n : ST = −S}

• We are interested in case n = 2, 3

Exponential Coordinate Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 18 / 30

nnnnnnnn

Find Rotation Rot(ω, θ) via Differential Equation

• Consider a point p with coordinate p0 at time t = 0

• Rotate the point with constant unit velocity around fixed axis ω. The motionis described by

p(t) = ω × p(t) = [ω]p(t), with p(0) = p0

• This is a linear ODE with solution: p(t) = e[ω]tp0

• Note p(θ) = Rot(ω, θ)p0, therefore

Rot(ω, θ) = e[ω]θ

Exponential Coordinate Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 19 / 30

Find Rotation Rot(ω, θ) via Differential Equation

• Exponential Map: By definition

e[ω]θ = I + θ[ω] +θ2

2![ω]2 +

θ3

3![ω]3 + · · ·

• Rodrigues’ Formula: Given any [ω] ∈ so(3), we have

e[ω]θ = I + [ω] sin(θ) + [ω]2(1 − cos(θ))

Exponential Coordinate Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 20 / 30

Find Rotation Rot(ω, θ) via Differential Equation

• Proposition: For any unit vector [ω] ∈ so(3) and any θ ∈ R,

e[ω]θ ∈ SO(3)

Exponential Coordinate Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 21 / 30

Examples of Forward Exponential Map

• Rotation matrix Rx(θ) (corresponding to xθ)

• Rotation matrix corresponding to (1, 0, 1)T

Exponential Coordinate Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 22 / 30

))))

((

Logarithm of Rotations

• Proposition: For any R ∈ SO(3), there exists ω ∈ R3 with ‖ω‖ = 1 and

θ ∈ R such that R = e[ω]θ

- If R = I, then θ = 0 and ω is undefined.

- If tr(R) = −1, then θ = π and set ω equal to one of the following

1√2(1 + r33)

⎡⎣

r13r23

1 + r33

⎤⎦ ,

1√2(1 + r22)

⎡⎣

r121 + r22r32

⎤⎦ ,

1√2(1 + r11)

⎡⎣

1 + r11r21r31

⎤⎦

- Otherwise, θ = cos−1(12(tr(R)− 1)

) ∈ [0, π) and [ω] = 12 sin(θ)

(R−RT )

Exponential Coordinate Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 23 / 30

Exponential Coordinate of SO(3)

exp: [ω]θ ∈ so(3) → R ∈ SO(3)

log: R ∈ SO(3) → [ω]θ ∈ so(3)

• The vector ωθ is called the exponential coordinate for R

• The exponential coordinates are also called the canonical coordinates of therotation group SO(3)

Exponential Coordinate Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 24 / 30

ccccc

Outline

• Mathematics of Rigid Body Transformation

• Rotation Matrix and SO(3)

• Euler Angles and Euler-Like Parameterizations

• Exponential Coordinate of SO(3)

• Quaternion Representation of Rotation

Quaternions Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 25 / 30

Quaternions

• Quaternions generalize complex numbers and can be used to effectivelyrepresent rotations in R

3.

• A quaternion is a vector quantity of the following form:

q = q0 + q1i + q2j + q3k

where q0 is the scalar (“real”) component and �q = (q1, q2, q3) is the vector(“imaginary”) component.

• Addition and multiplication operations:

- p+ q = (p0 + q0) + (p1 + q1)i+ (p2 + q2)j + (p3 + q3)k- i2 = j2 = k2 = ijk = −1- ij = k = −ji, jk = i = −kj, ki = j = −ik

• In scalar-vector form, product of p = (p0, �p) and q = (q0, �q) is given by

pq =(p0q0 − �pT �q, p0�q + q0�p + �p× �q

)

Quaternions Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 26 / 30

Conjugate, Norm, and Inverse

• Given a quaternion q = (q0, �q):

- Conjugate: q∗ = (q0,−q)

- Norm: ‖q‖2 = qq∗ = q∗q = q20 + q21 + q22 + q23

- Inverse: q−1 � q∗‖q‖2

Quaternions Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 27 / 30

Quaternion Representation of Rotation

• For �v ∈ R3, we can associate it with a 0 scalar component to construct a

purely imaginary quaternion:v = (0, �v)

• Each quaternion q = (q0, �q) defines an operation on a vector �v ∈ R3:

Lq(�v) = Im(qvq∗) = (q20 − ‖�q‖2)�v + 2(�qT�v)�q + 2q0(�q × �v)

Quaternions Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 28 / 30

mm ==

Quaternion Representation of Rotation

• Unit quaternion: If ‖q‖ = 1, we can always find θ ∈ [0, 2π) and unit vectorω ∈ R

3 such that:q =

(cos

(θ2

), ω sin

(θ2

))In this case, Lq(�v) is the vector obtained by rotating �v ∈ R

3 about the axis ωfor θ degree.

• Given a unit quaternion q = (q0, �q), we can extract the rotation axis/angle by:

θ = 2 cos−1(q0), ω =

{�q

sin(θ/2) if θ �= 0

0 otherwise

• Lq∗(�v) rotates �v about ω for −θ degree.

• Quaternion provides global parameterization of SO(3), which does not sufferfrom singularities

Quaternions Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 29 / 30

Examples of Quaternions

Quaternions Lecture 3 (ECE5463 Sp18) Wei Zhang(OSU) 30 / 30