← All notes

Exponential and Log Maps

Exponential and Log Maps

The bridge between rotation vectors ϕ∈R3\boldsymbol\phi\in\mathbb R^3 (where Gaussians, means and covariances work) and unit quaternions (where rotations compose).

Definitions

exp — rotation vector → quaternion. With θ=∥ϕ∥\theta = \lVert\boldsymbol\phi\rVert:

exp⁡(ϕ)=(cos⁡θ2,  ϕθsin⁡θ2)\exp(\boldsymbol\phi) = \left(\cos\tfrac\theta2,\ \ \frac{\boldsymbol\phi}{\theta}\sin\tfrac\theta2\right)
Small angle: exp⁡(ϕ)≈(1, ϕ/2)\exp(\boldsymbol\phi) \approx (1,\ \boldsymbol\phi/2). Use sin⁡(θ/2)θ→12\frac{\sin(\theta/2)}{\theta}\to\frac12 to avoid dividing by 0.

log — quaternion → rotation vector. First flip to w≥0w \ge 0 (shortest rotation), then:

log⁡(q)=2 atan2⁡(∥v∥, w) v∥v∥\log(q) = 2\,\operatorname{atan2}(\lVert\mathbf v\rVert,\ w)\ \frac{\mathbf v}{\lVert\mathbf v\rVert}
atan2 is accurate at all angles, unlike 2*acos(w), which loses precision near 0 and throws when ∣w∣|w| creeps above 1.

Original code ukf_core
exp Quaternion.from_axis_angle qexp
log Quaternion.axis_angle qlog

⊞ and ⊟ ("box-plus / box-minus")

These let you treat the rotation manifold as if it were a vector space, locally:

q⊞δ=exp⁡(δ)⊗qq1⊟q2=log⁡(q1⊗q2−1)q \boxplus \boldsymbol\delta = \exp(\boldsymbol\delta)\otimes q \qquad\qquad q_1 \boxminus q_2 = \log(q_1\otimes q_2^{-1})
That's the left / world-frame version. The right / body-frame version is q⊗exp⁡(δ)q\otimes\exp(\boldsymbol\delta) and log⁡(q2−1⊗q1)\log(q_2^{-1}\otimes q_1).

Uses in the UKF

Step Operation
Sigma points Xi=q⊞Wi\mathcal X_i = q \boxplus W_i
Process model qk+1=qk⊗exp⁡(ωΔt)q_{k+1} = q_k\otimes\exp(\boldsymbol\omega\Delta t) (body-frame increment)
Mean iterate ei=qi⊟qˉ\mathbf e_i = q_i\boxminus\bar q → Quaternion Averaging
Covariance Wi′=qi⊟qˉ\mathcal W'_i = q_i \boxminus \bar q
Update q+=qˉ⊞Kνq^+ = \bar q\boxplus K\nu

Lie-group view (optional)

Unit quaternions form the Lie group S3S^3; rotation vectors live in its Lie algebra so(3)≅R3\mathfrak{so}(3)\cong\mathbb R^3. exp/log are the standard maps between them. Further reading: Solà, Deray & Atchuthan, "A micro Lie theory for state estimation in robotics" (2018).

Next: Quaternion Averaging

Connections