Content
    Rotation

Rotation Matrix

This page is work in progress

Rotation

The configuration of a point is fully described by a position, bodies additionally require a rotation to define their pose.

A rotation RR in 3D is specified by a rotation angle θ\theta and a unit vector u (the rotation axis).

Frames

  • Space frame: {s}\{s\}
  • Body frame: {b}\{b\}

Expressing orientation of {b}\{b\} relative to {s}\{s\}:

  • writing the unit coordinate axis of {b}\{b\} as column vectors in the coordinates of {s}\{s\}
  • Form a matrix from the column vectors

Example:

x^b=[010]y^b=[100]z^b=[001]\begin{matrix} \hat{x}_b = \begin{bmatrix} 0\\ 1\\ 0 \end{bmatrix} & \hat{y}_b = \begin{bmatrix} -1\\ 0\\ 0 \end{bmatrix} & \hat{z}_b = \begin{bmatrix} 0\\ 0\\ 1 \end{bmatrix} \end{matrix}

Where:

  • x^b\hat{x}_b, y^b\hat{y}_b, z^b\hat{z}_b: Unit vectors of {b}\{b\} represented in coordinates of {s}\{s\}

Combined unit vectors:

Rsb=[x^by^bz^b]=[010100001]R_{sb}=\begin{bmatrix} \hat{x}_b & \hat{y}_b & \hat{z}_b \end{bmatrix} = \begin{bmatrix} 0 & -1 & 0\\ 1 & 0 & 0\\ 0 & 0 & 1 \end{bmatrix}

Where:

  • RsbR_{sb}:
    • Subscript ss: Reference frame
    • Subscript bb: Frame whose orientation is being represented

Constraints

There are only 33 dimensions for orientation of a rigid body in space. But the 3×33 \times 3 rotation matrix has 99 numbers. So 66 constraints are required:

  • All 33 column vectors are unit vectors
  • Dot product of any 22 column vectors is zero (they are all mutually orthogonal to each other)

These 6 constraints can also be written as:

RTR=IR^TR = I

Where:

  • II: Identity matrix
I=[100010001]I = \begin{bmatrix} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{bmatrix}

Furthermore for right-handed frames the following must hold:

detR=1\det R = 1

This means that all rotation matrices are elements of the Special Orthogonal Group SO(n)SO(n).

Special Orthogonal Group SO(2) and SO(3)

The Special Orthogonal Group SO(2)SO(2) and SO(3)SO(3) is the set of all possible 2×22 \times 2 or 3×33 \times 3 real matrices RR that satisfy:

RTR=RRT=IR^TR = RR^T = I
detR=1det R = 1

We refer to SO(3)SO(3) as the rotation group of R3\mathbb{R}^3

The rotation group SO(3)SO(3) is referred to as the configuration space of the system and a trajectory of the system is a curve R(t)SO(3)R(t) \in SO(3) for t[0,T]t \in [0,T].

Because a rotation matrix RR lives in SO(3)SO(3), there is no numerical equivalent to a position such as angular position.

Properties of Rotation Matrices

These properties hold for SO(2)SO(2) and SO(3)SO(3).

  • Inverse:
    • R1=RTSO(n)R^{-1} = R^T \in SO(n)
    • RR1=R1R=IR R^{-1} = R^{-1} R = I
  • Closure: R1R2SO(n)R_1 R_2 \in SO(n)
  • Associative (R1R2)R3=R1(R2R3)(R_1 R_2) R_3 = R_1 (R_2 R_3)
  • Not commutative: R1R2R2R1R_1 R_2 \neq R_2 R_1
  • Identity element: RI=IR=RR I = I R = R
  • Composition Rule for Rotations (Combining by matrix multiplication): Rac=RabRbcR_{ac} = R_{ab} R_{bc} (subscript cancellation)
  • Rotating a vector doesn’t change its length: xR3,Rx=xx \in \mathbb{R}^3, \left \| Rx \right \| = \left \| x \right \|
  • A rotation matrix (in 2D) has 3 eigenvectors:
    • One real eigenvector corresponding to to eigenvalue 11
    • Two complex eigenvectors with eigenvalues: λ=cosθ±jsinθ\lambda = \cos \theta \pm j \sin \theta where θ\theta is the rotation angle

Composition of Rotations

The coordinates of a vector u\mathbf{u} can be mapped from frame BB to frame AA by writing:

Au=RABBu{}_A\mathbf{u} = R_{AB} \cdot {}_B\mathbf{u}

Where:

  • Au{}_A\mathbf{u}: Vector u\mathbf{u} expressed in frame {A}\{A\} coordinates
  • Bu{}_B\mathbf{u}: Vector u\mathbf{u} expressed in frame {B}\{B\} coordinates
  • RABR_{AB}: Rotation matrix that converts the representation of the vector from {B}\{B\} frames coordiante representation to {A}\{A\} coordinates representation

The vector u\mathbf{u} can also be mapped from frame CC to frame BB by writing:

Bu=RBCCu{}_B\mathbf{u} = R_{BC} \cdot {}_C\mathbf{u}

Combining these equations:

Au=RAB(RBCCu)=RACCu\begin{align*} {}_A\mathbf{u} &= R_{AB} \cdot (R_{BC} \cdot {}_C\mathbf{u}) \\ &= R_{AC} \cdot {}_C\mathbf{u} \end{align*}

The resulting rotation matrix RAC=RABRBCR_{AC} = R_{AB} \cdot R_{BC} (s.a. subscript cancellation) can be interpreted as the rotation obtained by rotating frame AA until it coincides with frame BB, and then rotating frame BB until it coincides with frame CC.

Uses of Roatation Matrices

There are three uses for a rotation matrix:

  • To represent an orientation
  • To change the reference frame in which a vector or a frame is represented (operator for passive rotation)
  • To rotate a vector or a frame (operator for active rotation)

In the first use, RR is thought of as representing a frame; in the second and third uses, RR is thought of as an operator that acts on a vector or frame.

Representing Orientation

RcR_c means implicit the orientation of frame c{c} relative to the fixed reference frame s{s}. Explicit notation would be RscR_{sc}.

Rc=RscR_c = R_{sc}

Properties:

  • RacRca=IR_{ac} R_{ca} = I
  • Rac=Rca1=RcaTR_{ac} = R_{ca}^{-1} = R_{ca}^T
Changing the reference Frame (Passive Rotation)
Rac=RaboperatorRbcorientationR_{ac} = \underbrace{R_{ab}}_{operator} \cdot \overbrace{R_{bc}}^{orientation}

Meaning: Rac=change_reference_frame_from_b_to_a(Rbc)R_{ac} = change\_reference\_frame\_from\_b\_to\_a(R_{bc})

RbcR_{bc} can be viewed as a representation of the orientation of c{c}. RabR_{ab} can be viewed as a mathematical operator that changes the reference frame from b{b} to a{a}.

Subscript cancellation rule: RabRbc=RaRc=RacR_{ab} R_{bc} = R_{a\not{b}} R_{\not{b}c} = R_{ac}

The reference frame of a vector can also be changed by a rotation matrix: Rabpb=Rap=paR_{ab} p_b = R_{a\not{b}} p_{\not{b}} = p_a

Rotating a vector or a frame (Active Rotation)

RR as a rotation operator can be written:

R=Rot(ω^,θ)R = Rot(\hat{\omega}, \theta)
Elementary Rotations
Rot(x^,θ)=(1000cosφsinφ0sinφcosφ)Rot(\hat{x}, \theta) = \begin{pmatrix} 1 & 0 & 0 \\ 0 & \cos \varphi & -\sin \varphi \\ 0 & \sin \varphi & \cos \varphi \end{pmatrix}
Rot(y^,θ)=(cosφ0sinφ010sinφ0cosφ)Rot(\hat{y}, \theta)= \begin{pmatrix} \cos \varphi & 0 & \sin \varphi \\ 0 & 1 & 0 \\ -\sin \varphi & 0 & \cos \varphi \end{pmatrix}
Rot(z^,θ)=(cosφsinφ0sinφcosφ0001)Rot(\hat{z}, \theta) = \begin{pmatrix} \cos \varphi & -\sin \varphi & 0\\ \sin \varphi & \cos \varphi & 0 \\ 0 & 0 & 1 \\ \end{pmatrix}
General form of Rotation
Rot(ω^,θ)=[cosθ+ω^12(1cosθ)ω^1ω^2(1cosθ)ω^3sinθω^1ω^3(1cosθ)ω^2sinθω^1ω^2(1cosθ)ω^3sinθcosθ+ω^22(1cosθ)ω^2ω^3(1cosθ)ω^1sinθω^1ω^3(1cosθ)ω^2sinθω^2ω^3(1cosθ)ω^1sinθcosθ+ω^32(1cosθ)]Rot(\hat{\omega}, \theta) = \begin{bmatrix} \cos \theta + \hat{\omega}_1^2(1-\cos \theta) & \hat{\omega}_1 \hat{\omega}_2(1-\cos \theta) - \hat{\omega}_3 \sin \theta & \hat{\omega}_1 \hat{\omega}_3(1-\cos \theta) - \hat{\omega}_2 \sin \theta \\ \hat{\omega}_1 \hat{\omega}_2(1-\cos \theta) - \hat{\omega}_3 \sin \theta& \cos \theta + \hat{\omega}_2^2(1-\cos \theta) & \hat{\omega}_2 \hat{\omega}_3(1-\cos \theta) - \hat{\omega}_1 \sin \theta\\ \hat{\omega}_1 \hat{\omega}_3(1-\cos \theta) - \hat{\omega}_2 \sin \theta& \hat{\omega}_2 \hat{\omega}_3(1-\cos \theta) - \hat{\omega}_1 \sin \theta& \cos \theta + \hat{\omega}_3^2(1-\cos \theta) \end{bmatrix}

with: ω^=(ω^1,ω^2,ω^3)\hat{\omega} = (\hat{\omega}_1, \hat{\omega}_2, \hat{\omega}_3)

Properties
  • Any RSO(3)R \in SO(3) can be obtained by rotating from the identity matrix II by some θ\theta about some ω^\hat{\omega}
  • Rot(ω^,θ)=Rot(ω^,θ)Rot(\hat{\omega},\theta) = Rot(-\hat{\omega},-\theta)
Reference Frame for Rotation

When rotating a frame b{b} by Rot(ω^,θ)Rot(\hat{\omega}, \theta) and RsbR_{sb} represents the orientation of b{b} relative to s{s}, it’s important to express if the rotation axis ω^\hat{\omega} is defined in s{s} or in b{b} coordinates.

Given R=Rot(ω^,θ)R = Rot(\hat{\omega}, \theta):

  • Rotate by RR in s{s} frame:
    • Rsb=RRsbR_{s{b}'} = RR_{sb}
    • Premultiplying by RR: ω^\hat{\omega} considered in the fixed frame
  • Rotate by RR in b{b} frame:
    • Rsb=RsbRR_{s{b}''} = R_{sb}R
    • Postmulitplying by RR: ω^\hat{\omega} considered in the body frame.

To rotate a vector vv, there is only one frame involved. ω^\hat{\omega} has to be interpreted as being in the frame in which vv is represented:

v=Rv{v}' = Rv

Literature

Notes taken from:

Modern Robotics: Mechanics, Planning, and Control by Kevin M. Lynch and Frank C. Park, Cambridge University Press, 2017

A Mathematical Introduction to Robotic Manipulation by Richard M. Murray, Zexiang Li and S. Shankar Sastry, CRC Press, 1994



  • Category

  • Mechanics

  • Tags

  • Robotics

  • Created

  • 9. October 2018


  • Modified

  • 16. May 2022