Introduction:

Reformulating the technique of determination of the aerial vehicle orientation using an efficient methodology of Quaternion in place of conventional Euler’s angle method.

quaternion
credits: Chrobotics

Achieving breakthroughs in improving the capacity of the vehicle and reducing the computational load and time

Compared to quaternions, Euler Angles are intuitive and straightforward, and they lend themselves well to simple analysis and control. Euler Angles have a limitation of “gimbal lock,” it is not possible to measure orientation when the pitch angle approaches +/- 90 degrees using the Euler angle technique.

Quaternions have an advantage over Euler Angle, this measurement technique that does not suffer from gimbal lock. Quaternions are less intuitive as compared to Euler Angles, and mathematics is a little more complicated.

What is Quaternion?

A quaternion is a four-element vector used to encode any rotation in a three-dimensional coordinate system. A quaternion is comprised of one real element and three complex elements, and it is also useful for much more than rotations. In this article, we are providing only the information that is needed to use them for representing the attitude of an orientation sensor. The attitude quaternion estimated by orientation sensors encodes rotation from the “inertial frame” to the sensor “body frame.”  The earth-fixed coordinate frame is the inertial frame defined, as shown in Figure 1. The coordinate frame is a sensor body-frame that always remains aligned with the sensor. Only the inertial frame and the body frame are required when using quaternions for estimation, unlike the Euler angle.

Let the vector $q_{i}^{b}$ be defined as the unit-vector quaternion encoding rotation from the inertial frame to the body frame of the sensor:

$q_{i}^{b}=(a b c d)^{T}$

Where T is the transpose operator of the vector, the “vector part” of the quaternion are elements b, c, and d, which can be considered as a vector about which rotation should be performed. The “scalar part” is an element ‘a’ that stipulates the amount of rotation that performed about the vector part particularly, if θ is the angle of rotation and the vector $\left(v_{x} v_{y} v_{z}\right)^{T}$ is a unit vector describing the axis of rotation, then the quaternion elements are defined as

$\left(\begin{array}{l} a \\ b \\ c \\ d \end{array}\right)=\left(\begin{array}{c} \cos (0.5 \theta) \\ v_{x} \sin (0.5 \theta) \\ v_{y} \sin (0.5 \theta) \\ v_{z} \sin (0.5 \theta) \end{array}\right)$

In system, this definition need not be used explicitly, but it provides an intuitive description of what the quaternion represents.

Vector Rotation Using Quaternions

The attitude quaternion $q_{i}^{b}$ is used to rotate an arbitrary 3-element vector from the inertial frame to the body frame using the operation.

$\mathbf{v}_{B}=\mathbf{q}_{i}^{b}\left(\begin{array}{c} 0 \\ \mathbf{v}_{I} \end{array}\right)\left(\mathbf{q}_{i}^{b}\right)^{-1}$

A vector can rotate by treating it like a quaternion with null real-part and multiplying it by the attitude quaternion and its inverse. The inverse of a quaternion is equal to its conjugate, which means that all the vector elements are null. The rotation uses quaternion multiplication, which has its definition.

Define quaternions $q_{1}=\left(a_{1} b_{1} c_{1} d_{1}\right)^{T}$ and $q_{2}=\left(a_{2} b_{2} c_{2} d_{2}\right)^{T}$. Then the product of quaternion q1q2 is:

$\mathbf{q}_{1} \mathbf{q}_{2}=\left(\begin{array}{l} a_{1} a_{2}-b_{1} b_{2}-c_{1} c_{2}-d_{1} d_{2} \\ a_{1} b_{2}+b_{1} a_{2}+c_{1} d_{2}-d_{1} c_{2} \\ a_{1} c_{2}-b_{1} d_{2}+c_{1} a_{2}+d_{1} b_{2} \\ a_{1} d_{2}+b_{1} c_{2}-c_{1} b_{2}+d_{1} a_{2} \end{array}\right)$

The rotation matrix from the ‘inertial frame’ to the ‘body frame’ using quaternion is defined as:

$R_{i}^{b}\left(\mathbf{q}_{i}^{b}\right)=\left(\begin{array}{ccc} a^{2}+b^{2}-c^{2}-d^{2} & 2 b c-2 a d & 2 b d+2 a c \\ 2 b c+2 a d & a^{2}-b^{2}+c^{2}-d^{2} & 2 c d-2 a b \\ 2 b d-2 a c & 2 c d+2 a b & a^{2}-b^{2}-c^{2}+d^{2} \end{array}\right)$

Then the rotation from the ‘inertial frame’ to the ‘body frame’ can be performed using the matrix multiplication.

$\mathbf{v}_{B}=R_{i}^{b}\left(\mathbf{q}_{i}^{b}\right) \mathbf{v}_{I}$

Regardless of whether quaternion multiplication or matrix multiplication is used to perform the rotation, the rotation can be reversed by simply inverting the attitude quaternion before performing the rotation.  By negating the vector part of the quaternion vector, the operation is reversed.

Transforming Quaternions to Euler Angles:

The precise equations for transforming from quaternions to Euler Angles depends on the order of rotations. The transformation takes place from the inertial frame to the body frame using the first yaw, then pitch, and roll. This results in the following transformation equations:

$\phi=\arctan \left(\frac{2(a b+\alpha t)}{a^{2}-b^{2}-c^{2}+d^{2}}\right)$,

$\theta=-\arcsin (2(b d-a c))$, and

$\psi=\arctan \left(\frac{2(a d+b c)}{a^{2}+b^{2}-c^{2}-d^{2}}\right)$

Hope you enjoyed this article on Quaternion and have a great experience exploring robotics on Towards Robotics. Do share your feedback on this work. Thanks.

 



No Thoughts on Understanding Quaternion : Aerial Vehicle Orientation

Leave A Comment