Three ways to say the same thing: "how is frame B rotated relative to frame A?"
The trick is knowing how to translate between the three languages without losing information (gimbal lock, sign flips, normalization drift).
WHY start here? Because both DCM and quaternion have a clean formula from axis–angle, so we derive both, then compose them.
HOW we got the three terms (Why each step?): decompose v into a part along e^ (unchanged) and perpendicular. The perpendicular part rotates in its plane; cosΦ keeps it, e^×v gives the 90°-rotated companion scaled by sinΦ. The along-axis part is restored by the last term.
any orientation = a single rotation by angle Φ about one fixed axis e^.
Why does the quaternion use half the rotation angle?
the sandwich product qvq−1 applies the rotation twice, so half-angle cancels the doubling (also makes q,−q identical rotations).
DCM→quaternion, why divide by the largest qi?
to avoid dividing by ~0 when that component is small (e.g. q0≈0 near 180°); Shepperd's method.
What isolates the quaternion vector part from a DCM?
the antisymmetric part: C23−C32=4q0q1, etc.
Trace of C(q) equals?
4q02−1, giving q0=211+trC.
What is gimbal lock, in the 3-2-1 sequence?
at pitch θ=±90° two axes align; yaw and roll become indistinguishable (only ϕ±ψ determined).
Why atan2 instead of atan for Euler extraction?
atan2 keeps sign of both arguments → correct quadrant over full [−π,π].
Best way to convert quaternion↔Euler?
go through the DCM as a neutral hub (fewer error-prone formulas).
q0=cos(Φ/2) and (q1,q2,q3)=?
e^sin(Φ/2).
Do q and −q give the same DCM?
yes (map is quadratic in q).
Why renormalize quaternions each integration step?
drift makes ∥q∥=1, breaking orthonormality of C(q).
Recall Feynman: explain to a 12-year-old
Imagine a toy plane. There are three ways to describe which way it's pointing: (1) write down a little table saying where its nose, wing and belly point (that's the matrix) — very complete but lots of numbers; (2) a magic set of four numbers that never get confused even when the plane loops upside down (quaternion); (3) three plain words — how much it's turned left, tilted up, and rolled sideways (Euler angles) — easy to say but they get "stuck" when the plane points straight up. Converting is just rewriting the same pointing-direction in another one of these languages. You go through the table (matrix) as your common dictionary.
Dekho, ek rotation ek hi physical baat hai — "frame B, frame A ke respect me kitna ghooma hai." Bas usko likhne ke teen tareeke hain. DCM ek 3x3 matrix hai, poori honest info deta hai aur vectors ko seedha rotate karta hai, lekin 9 numbers bhaari lagte hain. Quaternion char numbers ka jaadu hai — koi singularity nahi, isliye time ke saath attitude propagate karne ke liye best. Euler angles (roll, pitch, yaw) insaan ke liye padhne me easy, par gimbal lock pe "phas" jaate hain.
Convert karna matlab same rotation ko doosri language me likhna. Sabse smart trick: hamesha DCM ko hub banao. Quaternion se Euler chahiye? Pehle quaternion se DCM, phir DCM se Euler. Isse kam formula yaad karne padte hain aur galti ka chance kam. Quaternion me half-angle (Φ/2) aata hai kyunki sandwich product qvq−1 rotation ko do baar lagata hai — half-angle usko balance karta hai, aur isi wajah se q aur −q ek hi rotation dete hain.
Do bade dhyaan ki baatein. Pehla: transpose ki galti mat karo — C aur C⊤ opposite direction ke rotation hote hain, convention hamesha likho. Doosra: DCM se quaternion nikaalte waqt agar q0≈0 ho (yaani rotation 180° ke aas-paas), to sabse bade diagonal element se divide karo (Shepperd method), warna zero se divide ho jaayega.
Euler extract karte time hamesha atan2 use karo, simple atan nahi — warna quadrant galat ho ke 180° ka error aa jaata hai. Aur quaternion ko har integration step pe normalize karte raho, warna ∥q∥ 1 se hat jaayega aur matrix orthonormal nahi rahega. Yeh chhoti chhoti baatein hi real GNC code me galtiyan rokti hain.