ahrs.common.orientation.chiaverini(dcm: ndarray) → ndarray
: Quaternion from a Direction Cosine Matrix with Chiaverini’s algebraic
method [CS99].
code
Defining the unit quaternion as:
q=[qwqv]
where
qwqv==cos(2θ)sin(2θ)r
with qw≥0 for θ∈[−π,π]; qw
is the scalar part, while qv is the vector part, and
θ is the rotation about the axis r.
We know the rotation matrix of a given unit quaternion is:
R(q)=(qw2−qvTqv)I3+2qvqvT+2qw⌊qv⌋×
where I3 is the 3×3 identity matrix, and
⌊qv⌋× is the [skew-symmetric matrix](https://en.wikipedia.org/wiki/Skew-symmetric_matrix) of the vector part.
Solving the equation above for the scalar and vector parts we get the
unitary quaternion: