MIT 6.4210 — Lecture 3

Frames, Monogram Notation, and Rotations

§ Frames

Note that E3\mathbb{E}^3 denotes an affine space. Informally, it's R3\mathbb{R}^3 without an origin—so it has subtraction and distances, but no addition. In robotics, we work in E3\mathbb{E}^3 instead of R3\mathbb{R}^3 because we oftentimes can't pick a single universally-meaningful origin.

Definition. In robotics, a frame (similar to a basis in linear algebra) describes a frame of reference using the following data.

frame = (origin O∈E3, basis (x^,y^,z^)),    where (x^,y^,z^) must be orthonormal and right-handed.\text{frame} ~ = ~ (\text{origin } O \in \mathbb{E}^3, ~ \text{basis } (\hat{x}, \hat{y}, \hat{z})), ~~~ \text{ where } (\hat{x}, \hat{y}, \hat{z}) \text{ must be orthonormal and right-handed.}

Note that every body ii has a frame BiB_i associated with it. (Imagine an airplane, for example.)

Definition. Drake has a built-in world frame denoted WW.

Definition. Any frame is defined by its position OO and its orientation (x^,y^,z^)(\hat{x}, \hat{y}, \hat{z}). This data is collectively called spatial pose.

When we refer to “the pose of an object OO”, we really mean “the pose of the body frame of OO in the world frame WW”.

§ Monogram Notation

Definition. We write BpCA^B p^A_C to denote the vector BA→\vec{BA} expressed in frame CC. (So BpCA^B p^A_C is a tuple of 33 real numbers.) Furthermore,

Definition. For any two frames FF and GG, we say:

Definition. The Drake documentation suggests the following variable names:

BpCA=p_BA_C         FRG=R_FG         FXG=X_FG^Bp^A_C = \verb|p_BA_C| ~~~~~~~~~ ^FR^G = \verb|R_FG| ~~~~~~~~~ ^FX^G = \verb|X_FG|

Theorem. (Monogram Algebra) The following identities are all true.

ApFB+BpFC=ApFC   ∥   ApFB=−BpFA   ∥   ApGB=GRFApFB   ∥   ARBBRC=ARC{}^Ap^B_F + {}^Bp^C_F = {}^Ap^C_F ~~~ \parallel ~~~ {}^Ap^B_F = - {}^Bp^A_F ~~~ \parallel ~~~ {}^Ap^B_G = {}^GR^F {}^Ap^B_F ~~~ \parallel ~~~ {}^AR^B {}^BR^C = {}^AR^C

Proof: The first, second, and fourth of these are obvious. The third is surprisingly unintuitive—think through it carefully.   ■\blacksquare

Remark. There are two ways to think about the rotation ARB^AR^B.

We now dedicate the rest of this lecture to giving examples of how we actually describe rotations numerically.

§ Rotation Matrices

Just a matrix M∈SO3(R)M \in SO_3(\mathbb{R}). The main nontrivial point to be aware of is that M−1M^{-1} is very easy to compute—it's just M−1=M⊤M^{-1} = M^{\top}.

Note, also, that using 99 numbers for a data structure that describes rotation in R3\mathbb{R}^3 is, in some sense, wasteful. There are ways to describe rotations using fewer than 99 numbers, such as…

§ Roll, Pitch, Yaw (Euler Angles)

Definition. Let Rx(θ)R_x(\theta) denote the rotation about the world's xx-axis by θ\theta. Define Ry(θ)R_y(\theta) and Rz(θ)R_z(\theta) similarly.

Remark. Use the right-hand rule. If you point your thumb in the direction of the positive xx-axis, then your fingers curl in the direction of positive rotations θ\theta.

Definition. Let (r,p,y)(r, p, y) in roll-pitch-yaw denote the rotation Rz(y)Ry(p)Rx(r)R_z(y)R_y(p)R_x(r) (read from right-to-left, as with matrix multiplication). These are also called Euler angles.

Example. The rotation with roll 90∘90^{\circ}, pitch 0∘0^{\circ}, and yaw 90∘90^{\circ} has the effect of permuting the axes (x,y,z)↦(y,z,x)(x, y, z) \mapsto (y, z, x).

Theorem. (Extrinsic vs. Intrinsic) Given rotation angles (r,p,y)(r, p, y) and an object OO, consider the following rotations on OO, where the extrinsic axes are the world's axes, whereas the intrinsic axes are the basis of the frame of OO.

Then these two rotations are the same.

Proof: Say the rotations about the extrinsic axes have rotation matrices RXR_X, RYR_Y, and RZR_Z. Then the intrinsic rotations are…

And composing all three gives (RZRY)RX(RZRY)−1⋅RZRYRZ−1⋅RZ=RZRYRX(R_ZR_Y)R_X(R_ZR_Y)^{-1} \cdot R_ZR_YR_Z^{-1} \cdot R_Z = R_ZR_YR_X, as desired.   ■\blacksquare

The problem with using Euler angles to parametrize the space of rotations is that this parametrization produces gimbal lock.

Example. Consider the subspace of roll-pitch-yaw rotations {(r,90∘,y)∣r,y∈R}\{(r, 90^{\circ}, y) \mid r, y \in \mathbb{R}\}. This happens to be a one-dimensional subspace, despite there being 22 free parameters (r,y)(r, y).

The following (warning: AI-generated) widget gives a visual demonstration of gimbal lock when p=90∘p = 90^{\circ}.

Roll–yaw independence 100%

Gimbal lock

0°
0°
0°

Remark. The “only” times when gimbal lock occurs are when p=±90∘p = \pm 90^{\circ}—you should intuitively be able to see why using the widget above. (What is the only way that two axes can overlap with each other?)

In fact, it has been proven (Stuelpnagel, 1964) that no parametrization of SO3(R)SO_3(\mathbb{R}) with three variables can avoid gimbal lock.

§ Axis-Angle

Recall from 18.701 that every rotation in SO3(R)SO_3(\mathbb{R}) looks like a rotation about some axis v^\hat{v} through the origin by some angle θ\theta. So one natural way to encode a rotation is through the three-variable vector θ⋅v^∥v^∥\theta \cdot \frac{\hat{v}}{\|\hat{v}\|}.

Of course, this parametrization also produces gimbal lock, because it has exactly three variables.

§ Quaternions

See 18.701 for a more rigorous discussion of the quaternions H\mathbb{H} (along with the group of unit quaternions SU2SU_2). Here's the main point we need to know.

Theorem. (Unit Quaternions as Rotations) The unit quaternion (w,x,y,z)∈SU2(w, x, y, z) \in SU_2 represents a rotation about axis v^\hat{v} by angle θ\theta (with ∥v^∥=1\|\hat{v}\| = 1) if we have w=cos⁡(θ2)w = \cos\left(\frac{\theta}{2}\right) and [xyz]=sin⁡(θ2)v^\left[\begin{smallmatrix} x \\ y \\ z \end{smallmatrix}\right] = \sin\left(\frac{\theta}{2}\right) \hat{v}.

Example. A rotation by θ=60∘\theta = 60^{\circ} about the axis v^=[2/32/31/3]\hat{v} = \left[\begin{smallmatrix} 2/3 \\ 2/3 \\ 1/3 \end{smallmatrix}\right] can be expressed by the quaternion (32,13,13,16)\left(\frac{\sqrt{3}}{2}, \frac{1}{3}, \frac{1}{3}, \frac{1}{6}\right).