Composition of rotations

From Robotics
Jump to: navigation, search
← Back: Rotations using quaternions Overview: Quaternions Next: Realization of transformations

Usually rotations are regarded around the three coordinate axes x, y and z and formulas are known to define the corresponding principal rotation matrices \mathbf{Rot}(x,\alpha), \mathbf{Rot}(y,\beta) and \mathbf{Rot}(z,\gamma).

As explained in the previous article Rotations using quaternions, a rotation around an axis defined by a unit vector \vec{\mathbf{u}} about the angle \phi can be described by a quaternion e as follows:


e(\vec{\mathbf{u}},\phi) = \cos{\frac{\phi}{2}} + \sin{\frac{\phi}{2}}\vec{\mathbf{u}}

\mathbf{Rot}(x,\alpha) describes a rotation around the x-axis by the angle \alpha. The x-axis is defined by the unit vector [1\ 0\ 0]^T. So if this rotation should be presented as a quaternion, \vec{\mathbf{u}} has to equal [1\ 0\ 0]^T. Accordingly the three principal rotations can be described by the following quaternions:


\begin{align}
e(x,\alpha) &= \cos{\frac{\alpha}{2}} \oplus \sin{\frac{\alpha}{2}} \left[\begin{array}{c}1\\0\\0\end{array}\right] &= \cos{\frac{\alpha}{2}} &+ \sin{\frac{\alpha}{2}} i \\
e(y,\beta) &= \cos{\frac{\beta}{2}} \oplus \sin{\frac{\beta}{2}} \left[\begin{array}{c}0\\1\\0\end{array}\right] &= \cos{\frac{\beta}{2}} &+ \sin{\frac{\beta}{2}} j \\
e(z,\gamma) &= \cos{\frac{\gamma}{2}} \oplus \sin{\frac{\gamma}{2}} \left[\begin{array}{c}0\\0\\1\end{array}\right] &= \cos{\frac{\gamma}{2}} &+ \sin{\frac{\gamma}{2}} k
\end{align}

Assume two rotations are composed as


\mathbf{Rot}_{comp}=\mathbf{Rot}_2(\vec{\mathbf{u}}_2,\phi_2)\mathbf{Rot}_1(\vec{\mathbf{u}}_1,\phi_1)

If two rotations are applied on a vector \vec{\mathbf{r}}_s, one rotation is executed first and then the second rotation is applied on the intermediate result \vec{\mathbf{r}}' of the first rotation. Using rotation matrices this looks as follows:


\vec{\mathbf{r}}_f = \mathbf{Rot}_{comp}\vec{\mathbf{r}}_s = \mathbf{Rot}_2(\vec{\mathbf{u}}_2,\phi_2)\mathbf{Rot}_1(\vec{\mathbf{u}}_1,\phi_1)\vec{\mathbf{r}}_s = \underbrace{\mathbf{Rot}_2(\vec{\mathbf{u}}_2,\phi_2)\underbrace{\Big(\mathbf{Rot}_1(\vec{\mathbf{u}}_1,\phi_1)\vec{\mathbf{r}}_s\Big)}_{\text{1. rotation:}\ \vec{\mathbf{r}}'=\mathbf{Rot}_1\vec{\mathbf{r}}_s}}_{\text{2. rotation:}\ \vec{\mathbf{r}}_f=\mathbf{Rot}_2\vec{\mathbf{r}}'}

The corresponding quaternions e_1 and e_2 for the two rotations can be computed as explained above and in Rotations using quaternions. So the first quaternion rotation leads to \vec{\mathbf{r}}' and is defined as


r' = e_1(\vec{\mathbf{u}}_1,\phi_1)\ r_s\ e_1^*(\vec{\mathbf{u}}_1,\phi_1)

The second rotation is then applied to r' using the second quaternion e_2:


\begin{align}
r_f &= e_2(\vec{\mathbf{u}}_2,\phi_2)\ r'\ e_2^*(\vec{\mathbf{u}}_2,\phi_2) \\
&= e_2(\vec{\mathbf{u}}_2,\phi_2)\ \Big(e_1(\vec{\mathbf{u}}_1,\phi_1)\ r_s\ e_1^*(\vec{\mathbf{u}}_1,\phi_1)\Big)\ e_2^*(\vec{\mathbf{u}}_2,\phi_2)
\end{align}

Since multiplication of quaternions is associative, the order in which the multiplications are solved is not important and does not influence the result. So each the two outer quaternions can be multiplied first:


\begin{align}
r_f &= e_2(\vec{\mathbf{u}}_2,\phi_2)\ \Big(e_1(\vec{\mathbf{u}}_1,\phi_1)\ r_s\ e_1^*(\vec{\mathbf{u}}_1,\phi_1)\Big)\ e_2^*(\vec{\mathbf{u}}_2,\phi_2) \\
&= \Big(e_2(\vec{\mathbf{u}}_2,\phi_2)\ e_1(\vec{\mathbf{u}}_1,\phi_1)\Big)\ r_s\ \Big(e_1^*(\vec{\mathbf{u}}_1,\phi_1)\ e_2^*(\vec{\mathbf{u}}_2,\phi_2)\Big)
\end{align}

Following the rule for the conjugate of a product of quaternions this leads to


\begin{align}
r_f 
&= \Big(e_2(\vec{\mathbf{u}}_2,\phi_2)\ e_1(\vec{\mathbf{u}}_1,\phi_1)\Big)\ r_s\ \Big(e_1^*(\vec{\mathbf{u}}_1,\phi_1)\ e_2^*(\vec{\mathbf{u}}_2,\phi_2)\Big) \\
&= \underbrace{\Big(e_2(\vec{\mathbf{u}}_2,\phi_2)\ e_1(\vec{\mathbf{u}}_1,\phi_1)\Big)}_{e_{comp}}\ r_s\ \underbrace{\Big(e_2(\vec{\mathbf{u}}_2,\phi_2)\ e_1(\vec{\mathbf{u}}_1,\phi_1)\Big)^*}_{e_{comp}^*} \\
&= e_{comp}\ r_s\ e_{comp}^* 
\end{align}

Thus the rotation \mathbf{Rot}_{comp} composed by the two rotations \mathbf{Rot}_1 and \mathbf{Rot}_2 is equivalent to a quaternion e_{comp} equal to the product of the two corresponding quaternions e_1 and e_2:


\mathbf{Rot}_{comp}=\mathbf{Rot}_2\mathbf{Rot}_1 \quad \equiv \quad e_{comp}=e_2e_1