ahrs.common.orientation.hughes(C: ndarray) → ndarray
: Quaternion from a Direction Cosine Matrix with trigonometric Hughes’ method
[Hug86].
code
Defining the quaternion (reluctantly called “Euler Parameters” in Hughes’
book) as:
q=[ηϵ]
where
ηϵ==cos(2ϕ)sin(2ϕ)a
The quaternion is subject to the constraint
ϵTϵ+η2=1, and
ϕ is the rotation about the unitary axis a.
The rotation matrix associated to the quaternion is:
C=(η2−ϵTϵ)I+2ϵϵT−2ηϵ×
where I is the 3×3 identity matrix, and
ϵ× is the [skew-symmetric matrix](https://en.wikipedia.org/wiki/Skew-symmetric_matrix) of
ϵ.
Given C, the quaternion components are obtained as:
The plus sign is chosen if it is advantageous to have a unique η;
corresponding to ϕ∈[0,π]. To ensure uniqueness, the
vector part is multiplied by -1 if η>0.
If η=0, then it is a pure quaternion, and its vector part is:
ϵ=21+c1121+c2221+c33
Finally, we normalize the quaternion to have unitary norm.
q=∥q∥q
Parameters:
: **C** (*numpy.ndarray*) – 3-by-3 or N-by-3-by-3 Direction Cosine Matrix (or Matrices).
Returns:
: **q** – 4-dimensional or N-by-4 Quaternion array.
Return type:
: numpy.ndarray