Template Function navtk::navutils::quat_to_rpy(const S&)

Function Documentation

template<typename S = Vector, IfTensorOfDim<S, 1>* = nullptr>
Vector3 navtk::navutils::quat_to_rpy(const S &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}} \).

Template Parameters
  • S – Type of quat, initializer list by default.

  • std::enable_if_t<> – Constrains S to be 1 dimensional.

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.