Skip to main content
This section draws from section 3.2, Rotations and Angular Velocities, of Kevin Lynch and Frank Park, Modern Robotics: Mechanics, Planning, and Control (Kevin M. Lynch, 2017). You can download the chapter as a PDF. A rigid body in space has six degrees of freedom: three for position and three for orientation. A body in the plane has three: two for position and one for orientation. This section describes orientation. It begins with rotations in the plane and then moves to three dimensions. The planar parts also provide background for wheeled robots. How orientation changes over time is covered in angular velocity.

Vectors and reference frames

A free vector v∈Rn\mathbf{v} \in \mathbb{R}^n is a geometric quantity with magnitude and direction. It does not depend on a coordinate system. It acquires numerical values when you express it in a coordinate frame. For example, a velocity vector may be v=[3,1,0]T\mathbf{v} = [3, 1, 0]^T in frame {a}\{a\} and have different coordinates in frame {b}\{b\}. If vectors are new to you, watch two short Khan Academy videos first: adding and subtracting vectors and unit vector notation. You can also represent points as vectors. Their coordinates are measured from the origin of a reference frame, as shown below. A point and a free vector behave differently when the frame changes. The coordinates of a point depend on the frame’s origin. A free vector is unaffected by translation and only rotates. Homogeneous coordinates show this distinction by appending a 1 to a point and a 0 to a free vector. Coordinates of a point and a free vector depend on the reference frame. All frames here are right handed and inertial, meaning that they do not accelerate or rotate. A frame fixed to the ground turns with the Earth, but this effect is small enough to ignore for robots. Rigid-body dynamics explains what changes in an accelerating frame. The unit axes of every frame follow the right-hand rule and satisfy x^×y^=z^\hat x \times \hat y = \hat z. Point your right thumb along an axis. The curled fingers give the direction of positive rotation about that axis. Left, a right hand with the index finger along x, the middle finger along y, and the thumb along z. Right, a thumb points along an axis while the curled fingers show the direction of positive rotation. We define one fixed frame, the space frame {s}\{s\}. It is also called the world frame. We also define a body frame {b}\{b\} associated with the body. At each instant, this frame coincides with the frame attached to the body. A fixed space frame with axes x_s, y_s and z_s, and a body frame with axes x_b, y_b and z_b attached to a rigid body. The vector p runs from the origin of the space frame to the origin of the body frame. Lynch and Park use only inertial frames. Their body frame {b}\{b\} does not move with the body. At a given instant, it is the stationary frame aligned with the frame attached to the body.
  • The body can accelerate, and its attached frame moves with it.
  • Velocities are always measured relative to inertial space.
  • Each instant uses a new stationary body frame. This frame is aligned with the body at that instant.
Every frame used by Lynch and Park is therefore inertial, so their derivations contain no fictitious forces.
Physics engines make their own conventions. Many draw from Lynch and Park but differ in some details. The discussion of twists in motion representations gives one example.

Rotation matrices

The rotation matrices form the special orthogonal group SO(3)SO(3). The product of two rotation matrices is another rotation matrix, R1R2∈SO(3)R_1 R_2 \in SO(3). Every rotation matrix has an inverse, R−1=R⊤R^{-1} = R^\top. Rotations preserve lengths, ∥Rv∥=∥v∥\|Rv\| = \|v\|.

Rotations in the plane

Representing the configuration of a planar rigid body

Begin in the plane, where a frame has two axes. In the figure below, the body frame {b}\{b\} has its origin at p\mathbf{p} and is rotated by an angle θ\theta relative to the space frame {s}\{s\}. A planar grid with space frame s at the lower left and body frame b attached to a body at the upper right. The vector p joins their origins, and the x axis of b is rotated by angle theta from the horizontal. Both frames share an origin here, so only the rotation shows. Projecting x^b\hat{x}_b onto the space axes gives cos⁡θ\cos\theta and sin⁡θ\sin\theta, the first column of R(θ)R(\theta). The axis y^b\hat{y}_b sits at angle π/2+θ\pi/2 + \theta, so its projections are cos⁡(π/2+θ)=−sin⁡θ\cos(\pi/2 + \theta) = -\sin\theta and sin⁡(π/2+θ)=cos⁡θ\sin(\pi/2 + \theta) = \cos\theta, the second column. As θ\theta changes, the numbers below the matrix change with it. Write each body axis in space-frame coordinates: x^b=cos⁡θ x^s+sin⁡θ y^s,y^b=cos⁡(π2+θ)x^s+sin⁡(π2+θ)y^s=−sin⁡θ x^s+cos⁡θ y^s.\begin{aligned} \hat{x}_b &= \cos\theta\, \hat{x}_s + \sin\theta\, \hat{y}_s , \\ \hat{y}_b &= \cos\left(\tfrac{\pi}{2} + \theta\right) \hat{x}_s + \sin\left(\tfrac{\pi}{2} + \theta\right) \hat{y}_s = -\sin\theta\, \hat{x}_s + \cos\theta\, \hat{y}_s . \end{aligned} Place these vectors side by side as columns. The result is a rotation matrix: R(θ)=[x^by^b]=[cos⁡θ−sin⁡θsin⁡θcos⁡θ]∈SO(2).R(\theta) = \begin{bmatrix} \hat{x}_b & \hat{y}_b \end{bmatrix} = \begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix} \in SO(2) . The columns are perpendicular unit vectors. Their four entries obey three constraints: two unit-length conditions and one orthogonality condition. One free number remains, the angle θ\theta. SO(2) as a manifold studies this group in detail. The first use of R(θ)R(\theta) is to describe where the body is. The rotation matrix gives the body’s orientation: its columns are the directions of the body axes. The body’s position is the vector p\mathbf{p} from the origin of {s}\{s\} to the origin of {b}\{b\}, written in the space frame: p=px x^s+py y^s=[pxpy].\mathbf{p} = p_x \, \hat{x}_s + p_y \, \hat{y}_s = \begin{bmatrix} p_x \\ p_y \end{bmatrix} . The pair (R(θ),p)(R(\theta), \mathbf{p}) is the configuration of the rigid body in the plane. It holds three free numbers, θ\theta, pxp_x and pyp_y. These match the three degrees of freedom of a planar rigid body in configuration space. Representing a configuration is the first of the three uses of a rotation matrix - two uses are presented here and one is covered in the planar section of the motion representations section.

Changing the reference frame

The second use of a rotation matrix is to change the frame in which you write a vector or another frame. When several frames are in play, a matrix needs to say which frame it describes and which frame it is written in. Two subscripts carry that information. The first names the reference frame and the second names the frame being described, so RsbR_{sb} is the orientation of {b}\{b\} written in {s}\{s\}, and RbcR_{bc} is the orientation of {c}\{c\} written in {b}\{b\}. The rotation matrix R(θ)R(\theta) above is RsbR_{sb}. Figure 3.4 of Lynch and Park (book page 64) shows three frames on a grid of unit squares:
  • {b}\{b\} in {s}\{s\} is (Rsb,p)(R_{sb}, \mathbf{p}), with p=(2,2)\mathbf{p} = (2, 2) and θ=90∘\theta = 90^\circ.
  • {c}\{c\} in {b}\{b\} is (Rbc,q)(R_{bc}, \mathbf{q}), with ψ=90∘\psi = 90^\circ. The vector q\mathbf{q} runs from the origin of {b}\{b\} to the origin of {c}\{c\}, measured along the axes of {b}\{b\}: q=(−1,−1)\mathbf{q} = (-1, -1).
  • {c}\{c\} in {s}\{s\} is (Rsc,r)(R_{sc}, \mathbf{r}), with ϕ=180∘\phi = 180^\circ and r=(3,1)\mathbf{r} = (3, 1).
Lynch and Park call these three matrices P=RsbP = R_{sb}, Q=RbcQ = R_{bc} and R=RscR = R_{sc}. This animation follows Figure 3.4 of Lynch and Park. The yellow arrow q\mathbf{q} reads (−1,−1)(-1, -1) along the axes of {b}\{b\} and (1,−1)(1, -1) along the axes of {s}\{s\}. Multiplying by RsbR_{sb} converts the first set of numbers into the second. Adding p\mathbf{p} gives r\mathbf{r}, and Rsc=RsbRbcR_{sc} = R_{sb} R_{bc} gives the axes of {c}\{c\} in {s}\{s\}. Suppose you know (Rsb,p)(R_{sb}, \mathbf{p}) and (Rbc,q)(R_{bc}, \mathbf{q}) and want {c}\{c\} in {s}\{s\}. The numbers (−1,−1)(-1, -1) describe q\mathbf{q} in {b}\{b\} coordinates. Multiplying by RsbR_{sb} describes the same arrow in {s}\{s\} coordinates: Rsb q=[0−110][−1−1]=[1−1].R_{sb}\,\mathbf{q} = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix} \begin{bmatrix} -1 \\ -1 \end{bmatrix} = \begin{bmatrix} 1 \\ -1 \end{bmatrix} . The arrow has not moved. Only the frame you measure it in has changed. Adding p\mathbf{p}, which runs from the origin of {s}\{s\} to the origin of {b}\{b\}, gives the position of {c}\{c\} in {s}\{s\}. The axes of {c}\{c\} change frame the same way: the columns of RbcR_{bc} are the axes of {c}\{c\} in {b}\{b\} coordinates, and RsbR_{sb} rewrites each one in {s}\{s\} coordinates. Together these are Lynch and Park’s eqs. 3.8 and 3.9 (page 65): Rsc=RsbRbc=[−100−1],r=Rsb q+p=[31].R_{sc} = R_{sb} R_{bc} = \begin{bmatrix} -1 & 0 \\ 0 & -1 \end{bmatrix} , \qquad \mathbf{r} = R_{sb}\,\mathbf{q} + \mathbf{p} = \begin{bmatrix} 3 \\ 1 \end{bmatrix} . The first column of RscR_{sc} says that x^c\hat{x}_c points along −x^s-\hat{x}_s, as the grid shows. In the product RsbRbcR_{sb} R_{bc} the inner subscripts match and cancel, leaving the reference frame of the first matrix and the frame described by the second (eq. 3.22, page 73).

Displacing a frame

The third use of a rotation matrix is to move a vector or a frame. Figure 3.5(a) of Lynch and Park (book page 66) reuses the frames of Figure 3.4. This time {b}\{b\} stays fixed in space, given by (Rsb,p)(R_{sb}, \mathbf{p}). A rigid body carries two frames. The frame {d}\{d\} starts on top of {s}\{s\}, and the frame {c}\{c\} starts at (Rsc,r)(R_{sc}, \mathbf{r}), with r=(3,1)\mathbf{r} = (3, 1). Move the body so that {d}\{d\} lands on {b}\{b\}, in two steps. First rotate it by RsbR_{sb} about the origin of {s}\{s\}. Then translate it by p\mathbf{p}. The frame {c}\{c\} rides along and ends at a new frame {c′}\{c'\}, given by (Rsc′,r′)(R_{sc'}, \mathbf{r}') (Lynch and Park eqs. 3.10 and 3.11): Rsc′=RsbRsc=[01−10],r′=Rsbr+p=[−13]+[22]=[15].R_{sc'} = R_{sb} R_{sc} = \begin{bmatrix} 0 & 1 \\ -1 & 0 \end{bmatrix} , \qquad \mathbf{r}' = R_{sb}\mathbf{r} + \mathbf{p} = \begin{bmatrix} -1 \\ 3 \end{bmatrix} + \begin{bmatrix} 2 \\ 2 \end{bmatrix} = \begin{bmatrix} 1 \\ 5 \end{bmatrix} . This animation follows Figure 3.5(a) of Lynch and Park. Step ① rotates the body by RsbR_{sb} about the origin of {s}\{s\}, which takes the origin of {c}\{c\} to Rsbr=(−1,3)R_{sb}\mathbf{r} = (-1, 3). Step ② translates the body by p\mathbf{p}. The frame {d}\{d\} lands on {b}\{b\}, and {c}\{c\} lands on {c′}\{c'\} at Rsbr+p=(1,5)R_{sb}\mathbf{r} + \mathbf{p} = (1, 5). Compare this with the change of frame, Rsc=RsbRbcR_{sc} = R_{sb} R_{bc}. There, the second subscript of RsbR_{sb} matches the first subscript of RbcR_{bc}. The result is still the frame {c}\{c\}, now written in {s}\{s\}. Here the product is RsbRscR_{sb} R_{sc}. The middle subscripts are bb and ss, so they do not cancel. Both matrices are written in {s}\{s\}, and the result is a different frame, {c′}\{c'\}. You can also reach {c′}\{c'\} with a single rotation about a fixed point. Motion representations covers this as a planar screw motion.

Rotations in space (3D)

A frame in space has three axes, but the construction is unchanged. Let p\mathbf{p} denote the vector from the fixed-frame origin to the body-frame origin. In fixed-frame coordinates, p=p1 x^s+p2 y^s+p3 z^s.(3.12)\mathbf{p} = p_1 \, \hat{\mathbf{x}}_s + p_2 \, \hat{\mathbf{y}}_s + p_3 \, \hat{\mathbf{z}}_s . \tag{3.12} You can also express the axes of the body frame in the fixed frame: x^b=r11x^s+r21y^s+r31z^sy^b=r12x^s+r22y^s+r32z^sz^b=r13x^s+r23y^s+r33z^s\begin{aligned} \hat{\mathbf{x}}_b &= r_{11} \hat{\mathbf{x}}_s + r_{21} \hat{\mathbf{y}}_s + r_{31} \hat{\mathbf{z}}_s \\ \hat{\mathbf{y}}_b &= r_{12} \hat{\mathbf{x}}_s + r_{22} \hat{\mathbf{y}}_s + r_{32} \hat{\mathbf{z}}_s \\ \hat{\mathbf{z}}_b &= r_{13} \hat{\mathbf{x}}_s + r_{23} \hat{\mathbf{y}}_s + r_{33} \hat{\mathbf{z}}_s \end{aligned} Place these three vectors side by side as columns. The result is a 3×33 \times 3 rotation matrix: p=[p1p2p3],R=[r11r12r13r21r22r23r31r32r33]=[x^by^bz^b].\mathbf{p} = \begin{bmatrix} p_1 \\ p_2 \\ p_3 \end{bmatrix}, \qquad R = \begin{bmatrix} r_{11} & r_{12} & r_{13} \\ r_{21} & r_{22} & r_{23} \\ r_{31} & r_{32} & r_{33} \end{bmatrix} = \begin{bmatrix} \hat{\mathbf{x}}_b & \hat{\mathbf{y}}_b & \hat{\mathbf{z}}_b \end{bmatrix} . The pair (R,p)(R, \mathbf{p}) contains 12 parameters and fully describes the body’s position and orientation relative to the fixed frame. Similarly to the planar case, a 3×33 \times 3 rotation matrix represents an orientation, changes the frame in which a vector or frame is written, and displaces a vector or frame. Its columns must be perpendicular unit vectors. These requirements give six equations for the nine entries and can be written as R⊤R=IR^\top R = I (Lynch and Park eq. 3.19). A right-handed frame also requires det⁡R=1\det R = 1 (eq. 3.21). A matrix with det⁡R=−1\det R = -1 describes a reflection. The six constraints leave three free numbers, matching the three degrees of freedom of an orientation in space. The planar R(θ)R(\theta) is a rotation about z^\hat z with the third row and column removed.

Angular velocity and exponential coordinates

How orientation changes over time is the topic of angular velocity. That section derives the angular velocity from a point turning about a fixed axis, and writes it as a skew-symmetric matrix in so(3)\mathfrak{so}(3). Exponential coordinates then turn a constant angular velocity into a finite rotation.

Other representations

A rotation matrix uses nine numbers for three degrees of freedom. Other representations use fewer numbers. Exponential coordinates are one. Appendix B of Lynch and Park (book pages 575 to 584) covers the rest: The Lie cheatsheet collects these representations and their velocity counterparts in tables.

References

  • Kevin M. Lynch, F. (2017). Modern Robotics.

Found an error on this page? Report an issue.