#### Understanding Quaternion : Aerial Vehicle Orientation

**Introduction:**

**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.

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? **

**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 be defined as the unit-vector quaternion encoding rotation from the inertial frame to the body frame of the sensor:

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 is a unit vector describing the axis of rotation, then the quaternion elements are defined as

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 is used to rotate an arbitrary 3-element vector from the inertial frame to the body frame using the operation.

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 and . Then the product of quaternion q1q2 is:

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

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

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:

,

, and

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.