3.5.9Guidance, Navigation & Control (GNC)

Quaternion kinematics — q̇ = ½ Ξ(q) ω

2,113 words10 min readdifficulty · medium5 backlinks

WHAT is a quaternion (fast recap)

Quaternion multiplication (Hamilton product): for p=(p0,pv)p = (p_0, \mathbf{p}_v), q=(q0,qv)q = (q_0, \mathbf{q}_v), pq=[p0q0pvqvp0qv+q0pv+pv×qv]p \otimes q = \begin{bmatrix} p_0 q_0 - \mathbf{p}_v\cdot\mathbf{q}_v \\ p_0\mathbf{q}_v + q_0\mathbf{p}_v + \mathbf{p}_v\times\mathbf{q}_v \end{bmatrix}

The WHY of the cross product term: quaternion multiplication is non-commutative, exactly like composing rotations. The pv×qv\mathbf{p}_v\times\mathbf{q}_v term encodes that non-commutativity.


Deriving the kinematics from first principles

Step 1 — The tiny rotation quaternion

A rotation of small angle Δθ=ωΔt\Delta\theta = \|\omega\|\,\Delta t about the (body-frame) axis ω^=ω/ω\hat\omega = \omega/\|\omega\| is: δq=[cosΔθ2ω^sinΔθ2]\delta q = \begin{bmatrix} \cos\tfrac{\Delta\theta}{2} \\ \hat\omega \sin\tfrac{\Delta\theta}{2} \end{bmatrix}

Why this step? This is just the definition of a quaternion applied to the infinitesimal rotation that occurs during Δt\Delta t.

For small Δt\Delta t: cosΔθ21\cos\tfrac{\Delta\theta}{2}\approx 1 and sinΔθ2Δθ2=ωΔt2\sin\tfrac{\Delta\theta}{2}\approx \tfrac{\Delta\theta}{2} = \tfrac{\|\omega\|\Delta t}{2}. So δq[112ωΔt]=[1000]+Δt2[0ω].\delta q \approx \begin{bmatrix} 1 \\ \tfrac{1}{2}\omega\,\Delta t \end{bmatrix} = \begin{bmatrix}1\\0\\0\\0\end{bmatrix} + \frac{\Delta t}{2}\begin{bmatrix}0\\ \omega\end{bmatrix}.

Why the 12\tfrac12 appears here: the half-angle in sinθ2\sin\tfrac{\theta}{2} is baked into the quaternion definition. This is the origin of the famous 12\tfrac{1}{2}.

Step 2 — Difference quotient → derivative

q(t+Δt)q(t)=qδqq=q(δqqidentity)=qΔt2[0ω]q(t+\Delta t) - q(t) = q \otimes \delta q - q = q\otimes(\delta q - q_{\text{identity}}) = q \otimes \frac{\Delta t}{2}\begin{bmatrix}0\\\omega\end{bmatrix}

where qidentity=(1,0)q_{\text{identity}}=(1,\mathbf{0}). Divide by Δt\Delta t and let Δt0\Delta t\to 0:

  q˙=12q[0ω]  \boxed{\;\dot q = \frac{1}{2}\, q \otimes \begin{bmatrix} 0 \\ \omega \end{bmatrix}\;}

Why this step? We turned "compose a tiny rotation" into a genuine time-derivative. The pure quaternion (0,ω)(0,\omega) is called the angular-velocity quaternion.

Step 3 — Rewrite the product as a matrix acting on ω\omega

Quaternion multiplication is linear, so q(0,ω)q\otimes(0,\omega) can be written as a 4×34\times 3 matrix times ω\omega. Working out q(0,ω)q\otimes(0,\omega) with the Hamilton product:

q[0ω]=[qvωq0ω+qv×ω]=Ξ(q)ωq\otimes\begin{bmatrix}0\\\omega\end{bmatrix} = \begin{bmatrix} -\mathbf{q}_v\cdot\omega \\ q_0\omega + \mathbf{q}_v\times\omega\end{bmatrix} = \Xi(q)\,\omega

with

Why this step? GNC filters (EKF, etc.) need a linear relation q˙=Aω\dot q = A\,\omega. Packaging the Hamilton product as Ξ(q)\Xi(q) gives us exactly that — clean for matrix code.


WHY the norm stays 1 (the sanity check)

The rate of change of q2\|q\|^2 must be zero — otherwise qq drifts off the unit sphere and no longer represents a valid rotation.

ddtq2=2q ⁣q˙=2q ⁣ ⁣(12Ξ(q)ω)=(q ⁣Ξ(q))ω.\frac{d}{dt}\|q\|^2 = 2\,q^{\!\top}\dot q = 2\,q^{\!\top}\!\left(\tfrac12 \Xi(q)\omega\right) = \big(q^{\!\top}\Xi(q)\big)\,\omega.

Key algebraic fact: q ⁣Ξ(q)=0 ⁣q^{\!\top}\Xi(q) = \mathbf{0}^{\!\top} (a zero 1×31\times3 row). Check row-by-row using the block form: q ⁣Ξ(q)=q0(qv ⁣)+qv ⁣(q0I+[qv×])=q0qv ⁣+q0qv ⁣+qv ⁣[qv×]=0 ⁣q^{\!\top}\Xi(q) = q_0(-\mathbf{q}_v^{\!\top}) + \mathbf{q}_v^{\!\top}\big(q_0 I + [\mathbf q_v\times]\big) = -q_0\mathbf{q}_v^{\!\top} + q_0\mathbf{q}_v^{\!\top} + \mathbf{q}_v^{\!\top}[\mathbf q_v\times] = \mathbf 0^{\!\top} because qv ⁣[qv×]=(qv×qv) ⁣=0\mathbf{q}_v^{\!\top}[\mathbf q_v\times] = -(\mathbf q_v\times\mathbf q_v)^{\!\top}=\mathbf 0. Hence ddtq2=0\frac{d}{dt}\|q\|^2 = 0. ✔


Body frame vs inertial frame (a real GNC subtlety)

  • If ω\omega is expressed in the body frame (usual case, gyros measure body rates): use right multiplication q˙=12q(0,ω)\dot q = \tfrac12 q\otimes(0,\omega) → the Ξ(q)\Xi(q) above.
  • If ω\omega is in the inertial frame: use left multiplication q˙=12(0,ω)q\dot q = \tfrac12 (0,\omega)\otimes q, giving a different matrix (often called Ω(ω)\Omega(\omega)).

Worked examples


Common mistakes (Steel-manned)


Recall Feynman: explain to a 12-year-old

Imagine you're spinning on an office chair. To describe which way you face, you use a special 4-number "compass" called a quaternion. Now, if I tell you how fast you're spinning, you want to know how fast your compass numbers change. It turns out the compass numbers change at half the spin speed — because the compass secretly measures half-turns (a quaint quirk that makes the math turn out beautifully). There's also a little bookkeeping table (the Ξ\Xi matrix) that mixes your current facing with your spin to give the right change. And the whole thing is built so your compass always stays a valid "unit" compass — it never breaks.


Active recall

Why does the ½ appear in q˙=12Ξ(q)ω\dot q = \tfrac12\Xi(q)\omega?
Because quaternions encode the half-angle (sinθ2,cosθ2\sin\tfrac\theta2,\cos\tfrac\theta2); differentiating the half-angle gives ½ by the chain rule.
Write the continuous-time quaternion kinematic equation (body rates).
q˙=12q(0,ω)=12Ξ(q)ω\dot q = \tfrac12\,q\otimes(0,\omega) = \tfrac12\,\Xi(q)\,\omega.
What guarantees q\|q\| stays 1 in the kinematics?
qΞ(q)=0q^{\top}\Xi(q)=\mathbf 0^{\top}, so ddtq2=qq˙2=0\tfrac{d}{dt}\|q\|^2 = q^{\top}\dot q\cdot 2 = 0; q˙q\dot q \perp q.
Structure of Ξ(q)\Xi(q)?
4×34\times3: top row qv-\mathbf q_v^\top; bottom 3×33\times3 block q0I+[qv×]q_0 I + [\mathbf q_v\times].
Body-frame ω\omega: pre- or post-multiply?
Post-multiply, q(0,ω)q\otimes(0,\omega). Inertial-frame ω\omega pre-multiplies.
What is the equivalent Ω(ω)\Omega(\omega) form?
q˙=12Ω(ω)q\dot q = \tfrac12\Omega(\omega)q, factoring out qq instead of ω\omega; Ω(ω)\Omega(\omega) is 4×44\times4 skew.
Why renormalize in code if norm is provably preserved?
Preservation is exact only in continuous time; discrete integrators leak norm, so renormalize each step.
For pure spin ωz\omega_z from identity, what does q3(t)q_3(t) equal?
q3(t)=sinωzt2q_3(t)=\sin\tfrac{\omega_z t}{2} (half-angle), with q0=cosωzt2q_0=\cos\tfrac{\omega_z t}{2}.

Connections

Concept Map

lives on

encodes

half-angle in sin cos

uses

q at t plus dt = q times delta-q

small angle = norm omega times dt

approx identity plus half omega dt

difference quotient to derivative

guarantees

keeps norm q = 1

packs multiplication

builds

Unit quaternion q

Unit 3-sphere S3

Rotation theta about axis n-hat

Factor one-half

Rotations compose by multiplication

Hamilton product with cross term

Tiny rotation delta-q

Angular velocity omega

q-dot = half Xi q omega

Velocity tangent to S3

Matrix Xi q

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, jab koi satellite ya drone space me ghoomta hai, to uska orientation (kis taraf muh hai) hum ek unit quaternion qq se track karte hain — ye 4 numbers ka ek chhota sa "compass" samajh lo. Ab sawaal ye hai: agar body ω\omega angular velocity se ghoom rahi hai, to ye 4 numbers time ke saath kitni tezi se badalte hain? Iska jawaab hai q˙=12Ξ(q)ω\dot q = \tfrac12\,\Xi(q)\,\omega.

Sabse important cheez woh 12\tfrac12 hai. Ye kahan se aaya? Kyunki quaternion andar-hi-andar half-angle store karta hai (cosθ2\cos\tfrac\theta2 aur sinθ2\sin\tfrac\theta2). Jab tum half-angle ko differentiate karte ho, chain rule se ek 12\tfrac12 nikal aata hai. Bas yahi secret hai — koi jaadu nahi. Aur Ξ(q)\Xi(q) matrix ka kaam sirf itna hai ki ω\omega (jo body frame me gyroscope measure karta hai) ko sahi tarike se qq ke saath mix kare, kyunki quaternion multiplication me order matter karta hai (non-commutative). Body rates ke liye hamesha q(0,ω)q\otimes(0,\omega) — yaani qq ko left pe rakho.

Ek bahut khoobsurat property ye hai: q\|q\| hamesha 1 rehta hai. Iska proof simple hai — qΞ(q)=0q^\top\Xi(q)=0, isliye q˙\dot q hamesha qq ke perpendicular hota hai. Sphere pe socho: agar velocity surface ke tangent me hai, to tum sphere pe hi slide karte ho, kabhi bahar nahi girte. GNC me isi liye ye equation itni pyaari hai — attitude kabhi "invalid" nahi hoti.

Ek practical warning: paper pe norm perfectly conserve hota hai, lekin computer me jab tum discrete steps (Euler/RK4) se integrate karte ho, thoda-thoda norm leak hota hai. Isliye real flight software har step ke baad qq/qq \leftarrow q/\|q\| karke renormalize karta hai.

Go deeper — visual, from zero

Test yourself — Guidance, Navigation & Control (GNC)

Connections