Function navtk::navutils::quat_to_rpy

Function Documentation

Vector3 navtk::navutils::quat_to_rpy(const Vector4 &quat)

Converts a quaternion to Euler angles.

When provided a quat that rotates a vector from frame B to frame A ( \(\textbf{q}_\text{B}^\text{A}\)), this function returns the yaw, pitch, and roll that correspond to a 3-2-1 frame rotation sequence from frame A to frame B as described in rpy_to_dcm().

References: “Strapdown Inertial Technology”, Titterton & Weston, 2nd ed eq 3.65. Note that the book equation has a sign error on the ‘d’ term; it should be

\( d = \cos{\frac{\phi}{2}}\cos{\frac{\theta}{2}}\sin{\frac{\psi}{2}} - \sin{\frac{\phi}{2}}\sin{\frac{\theta}{2}}\cos{\frac{\psi}{2}} \).

Parameters

quat – Quaternion ( \(\textbf{q}_\text{B}^\text{A}\))

Returns

The equivalent Euler angles [roll pitch yaw] (radians) that define a frame rotation from frame A to frame B.