Rotation and Homogeneous Transformation

Introduction

In this document, we will focus on rotation. We assume the reader is familiar with basic linear algebra.

Rotations and homogeneous transformations are key in robotic control. They are mathematical tools that represent rigid-body motion. In this document, we focus on different representations of rotation.

Most of the content of this document is based on the following three books:

Notation and Convention

It's important we have an intuitive notations in formula when we study robotics. In robotics, we need to deal with many different frames and coordinate systems and it's critical that we know unambiguously which frames we are working with. In this document, we adapt the notations from the book Robotics, Vision and Control - 3rd Edition and Robot Modeling and Control - 2nd Edition.

Rotation Representations

There are many representations of rotations. The most common ones are the following:

  • rotation matrices

  • Euler and Cardan angles representation

  • rotation axis and angle

  • exponential coordinates

  • unit quaternions

In this section we will briefly go through each one of them.

Rotation Matrices

The rotation matrices representation is a direct application of the change of basis. Columns in a rotation matrix RRrepresents the coordinates of bases of the transformed frame in the base frame. It has the following properties:

R1=RTdet(R)=1\begin{align*} & R^{-1} = R^T &\\ & \textrm{det}(R) = 1 & \end{align*}

Example: Rotate a robot on a 2D map

In this case, the rotation is around the z-axis and the rotation matrix takes the following form

Rz(θ)=(cosθsinθ0sinθcosθ0001)R_z(\theta)=\begin{pmatrix} \cos{\theta} & -\sin{\theta} & 0 \\ \sin{\theta} & \cos{\theta} & 0 \\ 0 & 0 & 1 \end{pmatrix}

Interpretations of Rotation Matrix

There are two interpretations/views of rotation. As we mentioned earlier, the rotation matrix represents the change of basis. It relates the coordinates of the same point in two differnet frames.

The second view of the rotation matrix is that it applies the rotation transformation on an object. In this view, the coordinates are all in the same frames (i.e. the original frame) and no other frames are involved. The effect is that it transforms the coordinates of the blue dot in the black frame in the figure below to the coordinates of the red dot in the black frame. (The orange frame is the frame after the rotation as it's rigidly related to the dot. However it's not involved in the formula)

Three-Angle Representations and Euler Angles

Euler's rotation theorem:

Any two independent orthonormal coordinate frames can be related by a sequence of rotations (not more than three) about coordinate axes, where no two successive rotations may be about the same axis (Kuipers 1999)

According to the Euler's theorem, a rotation between any coordinate frames can be constructed by a sequence of rotation about a particular axis. During the process of constructing the intermediate rotations, new coordinate frames are created and the next rotation is about one of the axis in the current frame (not the original one). More specifically, suppose the original frame is denoted by F0F_0 and the consecutive rotations are denoted by R1R_1, R2R_2, and R3R_3. We use FfinalF_{final}to denote the final frame and we have the transformation sequence below:

F0R1F1R2F2R3F3=FfinalF_0 \xrightarrow{R_1} F_1 \xrightarrow{R_2} F_2 \xrightarrow{R_3} F_3=F_{final}

Because the rotation is about an axis in the current frame, we can simply compose the transformation:

Rfinal0=R1R2R3R^{0}_{final}=R_1R_2R_3

In the book Robotics, Vision and Control - 3rd Edition, the author mentions that Euler angles is an ambiguous term. What's more confusing is that the rotation sequence depends on the context. For example, when we say roll-pitch-yaw angle, it could mean either XYZ or ZYX rotation.

The bottom line is that when we use the three-angle representation of rotations, we need to

  • Remember the rotation axis is in the "current" or "latest" intermediate frame.

  • Simply compose the rotation following the order.

Example: Roll-pitch-yaw with ZYX sequence

Remember that the composition order is simply the order of the rotation sequence. In this example, the rotation sequence is Rz(γ)R_z(\gamma), Ry(β)R_y(\beta), and Rx(α)R_x(\alpha). Therefore, the overall rotation is:

R(α,β,γ)=Rz(γ)Ry(β)Rx(α)R(\alpha, \beta, \gamma) = R_z(\gamma)R_y(\beta)R_x(\alpha)

Exponential Coordinates and Different View of Rotation

A rotation can be viewed as the result of the object being subject to a constant angular velocity θ˙\dot{\theta}during the unit of time (i.e. 1 second). Suppose the rotation axis is given by the unit vector ω^\hat{\omega}, the angular velocity can be represented by

ω=θ˙ω^\omega = \dot{\theta} \hat {\omega}

We also have the formula of the velocity of a point subject to the angular velocity:

p˙(t)=ω×p(t)\dot{p}(t) = \omega \times p(t)

TODO: this is a bit complicated. It's related to the twist concetp.

Rotation Axis and Angle

The most natural way to describe a rotation is to specify the rotation axis and the rotation angle.

The relationship between the axis-angle pair and the rotation matrix is established by the Rodrigues' rotation formula:

R(θ,v^)=I+sin(θ)[v^]×+(1cosθ)[v^]×2R(\theta, \hat{v}) = I + sin(\theta)[\hat{v}]_{\times} + (1 - \cos{\theta})[\hat{v}]^2_{\times}

where θ\theta is the rotation angle, v^\hat{v} is the unit vector that represents the rotation axis. [v^]×[\hat{v}]_{\times} is a skew-symmetric matrix constructed from the rotation axis vector.

This formula has a variation:

R(θ,v^)x=x+2s(ω×x)+2(ω×(ω×x))R(\theta, \hat{v})x = x + 2s(\omega \times x) + 2(\omega \times (\omega \times x))

where s=cosθ2s=\cos{\frac{\theta}{2}} and ω=sinθ2v^\omega = \sin{\frac{\theta}{2}} \hat{v}.

We can also recover the the rotation axis vector and the rotation angle from the rotation matrix. The rotation axis vector is the eigen vector with eigen value equals to 1. Note that a rotation matrix always has a real eigenvalue 1 because vectors on the rotation axis will not be changed by the rotation. The other two eigenvalues are λ=cosθ±jsinθ\lambda = \cos{\theta} \pm j \sin{\theta} where θ\theta is the rotation angle.

Unit Quaternions

Quaternions is frequently used in ROS. For information about quaternion in ROS, you can refer to the article Quaternion Fundamentals.

We adopt the notation in the book Robotics, Vision and Control - 3rd Edition and represent a quaternion using the following form:

q˘(s,v)=svx,vy,vz\breve{q}(s, \bm{v}) = s\langle v_x, v_y, v_z \rangle

and a rotation with axis v^\bm{\hat{v}} and angle θ\theta can be represented by a unit quaternion:

q˚=cosθ2v^sinθ2\r{q} = \cos{\frac{\theta}{2}} \langle \bm{\hat{v}} \sin{\frac{\theta}{2}} \rangle

We can apply the following operations to a quaternion:

q˘=svx,vy,vzq˘1q˘2=s1s2+vx1vx2+vy1vy2+vz1vz2q˘1q˘2=(s1s2v1v2)s1v2+s2v1+v1×v2\begin{align*} &\breve{q}^* = s \langle -v_x, -v_y, -v_z \rangle \\ &\breve{q}_1 \cdot \breve{q}_2 = s_1s_2 + v_{x1}v_{x2} + v_{y1}v_{y2} + v_{z1}v_{z2} \\ &\breve{q}_1 \circ \breve{q}_2 = (s_1s_2 - \bm{v_1}\cdot\bm{v_2}) \langle s_1 \bm{v_2} + s_2 \bm{v_1} +\bm{v_1} \times \bm{v_2} \rangle \end{align*}

Relations between Different Representations

Last updated