skoro v0.0.0

Mathematics

The rotations as unit quaternions with the stereographic chart, global and full with a declared volume so that they carry the normal, the rigid motions SE(3) and SE₂(3) as their semidirect products with the left-translated chart, and the usual maps of all three, each a composite of the core's operations.

Updated 2026-11-14 · 36 min read

The problem#

skoro is meant for models whose states are attitudes, poses and extended poses, a pose with a velocity, and whose measurements are of them. The only curved type it has is the sphere of the core’s tests. This entry brings back the rotations SO(3)SO(3) and the rigid motions SE(3)SE(3) and SE2(3)SE_2(3), as embedded types declared on the core’s public interface, so that each may be an estimated state or an observable, and carry the normal.

Three earlier positions shape them. A type that carries the normal has a declared volume (the core’s measures) and a global chart (why global charts). A type’s operations are composites of the core’s primitives wherever they can be, and fused operations, with kernels of their own, only where they must (charter, position 11). And a type’s chart is part of the meaning of every normal on it, so it is chosen once, here. The archive branch held the rotations as 3×33 \times 3 matrices with the exponential chart, and gave their exponential, logarithm and composition fused kernels for each backend; its rigid motions were a rotation matrix and a position. This document works out which representation, which chart and which measure each type takes now, and the maps between them. It assumes no frame of the earth: frames are the user’s to compose from these.

Setting#

A quaternion is q=(w,u)q = (w, u) with w∈Rw \in \R and u∈R3u \in \R^3, stored as the vector (w,u)(w, u) of R4\R^4. The product is

(w1,u1)⊗(w2,u2)=(w1w2−u1⋅u2, w1u2+w2u1+u1×u2),(1) (w_1, u_1) \otimes (w_2, u_2) = \bigl(w_1 w_2 - u_1 \cdot u_2,\ w_1 u_2 + w_2 u_1 + u_1 \times u_2\bigr), \tag{1}
(1)

the conjugate qˉ=(w,−u)\bar q = (w, -u), and vec⁡(q)=u\operatorname{vec}(q) = u, w(q)=ww(q) = w. The unit quaternions S3={q:∣q∣=1}S^3 = \{q : \lvert q \rvert = 1\} are a group under ⊗\otimes, with identity 1=(1,0)1 = (1, 0) and inverse qˉ\bar q, and a compact Lie group of dimension 33, whose Haar measure is invariant under translation on either side. Each unit quaternion is a rotation,

π(q)=(w2−∣u∣2) I+2 uu⊤+2w [u]×,(2) \pi(q) = (w^2 - \lvert u \rvert^2)\, I + 2\, u u\transpose + 2 w\, [u]_\times , \tag{2}
(2)

the rotation by the angle θ\theta about aa when q=(cos⁡θ2,sin⁡θ2 a)q = (\cos \tfrac\theta2, \sin \tfrac\theta2\, a), and π:S3→SO(3)\pi : S^3 \to SO(3) is a homomorphism, two to one, with π(q)=π(−q)\pi(q) = \pi(-q). Its action on a vector is π(q) x=x+2w (u×x)+2 u×(u×x)\pi(q)\, x = x + 2 w\, (u \times x) + 2\, u \times (u \times x).

The rotations’ tangent coordinates in this document are the rotation vector in the frame of the point, π(q⊕v)=π(q)(I+[v]×)+O(∣v∣2)\pi(q \oplus \tangent) = \pi(q) (I + [\tangent]_\times) + O(\lvert \tangent \rvert^2): a perturbation on the right, in the body frame.

Matrices or quaternions#

The rotations can be stored as the matrices SO(3)⊂R3×3SO(3) \subset \R^{3 \times 3} or as the unit quaternions S3⊂R4S^3 \subset \R^4, and the core asks two different things of either.

A chart. For the normal, the chart at each point must be global and full. On the matrices the Cayley chart is, with log-volume −2log⁡(1+∣v∣2/4)-2 \log(1 + \lvert \tangent \rvert^2 / 4) (the note’s table). On the unit quaternions the stereographic chart is (Proposition 5, below). Either serves the normal exactly.

A way into the type. A model computes rotations as well as holding them: a composition, an inverse, a rotation built from a rate. The core reaches an embedded type from Euclidean values in two ways: the retraction from a base point, valid in that point’s chart, and the type’s projection PP, a smooth map onto the type that is the identity on it (Proposition 3). A composition of two rotations written as a retraction from one of them, R1R2=R1⊕(R2⊖I)R_1 R_2 = R_1 \oplus (R_2 \ominus I), fails wherever R2R_2 is a half-turn, which a model meets whenever a sensor is mounted upside down. A composition needs the projection. On the unit quaternions it is the normalization P(w)=w/∣w∣P(w) = w / \lvert w \rvert, a composite smooth away from 00, and a composition is P(q1⊗q2)P(q_1 \otimes q_2). On the matrices it is the polar factor X(X⊤X)−1/2X (X\transpose X)^{-1/2}, which has no closed form in the core’s primitives that is smooth at the rotations themselves: the eigenvalues of X⊤XX\transpose X coincide there, and a formula through them divides by their differences. Nor can it pass through the quaternions:

Proposition 3(The rotations have no continuous choice of quaternion).

There is no continuous map s:SO(3)→S3s : SO(3) \to S^3 with π∘s=id⁡\pi \circ s = \operatorname{id}.

Proof.

Suppose ss is one. Its image s(SO(3))s(SO(3)) is compact, and so is −s(SO(3))-s(SO(3)), since q↦−qq \mapsto -q is continuous. They are disjoint, since s(R)=−s(R′)s(R) = -s(R') gives R=π(s(R))=π(−s(R′))=R′R = \pi(s(R)) = \pi(-s(R')) = R' and then s(R)=−s(R)s(R) = -s(R), which no unit quaternion is. And they cover S3S^3, since a qq with π(q)=R\pi(q) = R is s(R)s(R) or −s(R)-s(R). So S3S^3 is the union of two disjoint nonempty closed sets, which contradicts its connectedness.

∎

Every formula that reads a quaternion off a matrix is therefore discontinuous somewhere, and a projection of matrices through one is too. The matrices would need the composition, or the projection, as a fused operation, with kernels for each backend and their tests on an adapter. The unit quaternions need none: storage, chart, projection and composition are all composites.

The unit quaternions#

The type S3S^3 has storage 44, dimension 33, and the retraction, inverse and projection

q⊕v=q⊗(1−s, v/2)1+s,s=116∣v∣2;p⊖q=4 vec⁡(qˉ⊗p)1+w(qˉ⊗p);P(x)=x∣x∣.(4) q \oplus \tangent = q \otimes \frac{\bigl(1 - s,\ \tangent / 2\bigr)}{1 + s}, \quad s = \tfrac1{16} \lvert \tangent \rvert^2; \qquad p \ominus q = \frac{4\, \operatorname{vec}(\bar q \otimes p)}{1 + w(\bar q \otimes p)}; \qquad P(x) = \frac{x}{\lvert x \rvert} . \tag{4}
(4)
Proposition 5(The stereographic chart of the unit quaternions).

For q∈S3q \in S^3 and v∈R3\tangent \in \R^3, with s=∣v∣2/16s = \lvert \tangent \rvert^2 / 16, let

q⊕v=q⊗δ(v),δ(v)=(1−s, v/2)1+s. q \oplus \tangent = q \otimes \delta(\tangent), \qquad \delta(\tangent) = \frac{\bigl(1 - s,\ \tangent / 2\bigr)}{1 + s} .

Then v↦q⊕v\tangent \mapsto q \oplus \tangent is a diffeomorphism of R3\R^3 onto S3∖{−q}S^3 \setminus \{-q\}, whose inverse is p↦4 vec⁡(qˉ⊗p)/(1+w(qˉ⊗p))p \mapsto 4\, \operatorname{vec}(\bar q \otimes p) / (1 + w(\bar q \otimes p)); δ(v)\delta(\tangent) is the rotation by the angle θ=4arctan⁡(∣v∣/4)\theta = 4 \arctan(\lvert \tangent \rvert / 4) about v\tangent; and π(q⊕v)=π(q) (I+[v]×)+O(∣v∣2)\pi(q \oplus \tangent) = \pi(q)\,\bigl(I + [\tangent]_\times\bigr) + O(\lvert \tangent \rvert^2), so that v\tangent is, to first order, the rotation vector of the perturbation in the frame of qq.

Proof.

Write δ=δ(v)\delta = \delta(\tangent). Its norm is ((1−s)2+4s)1/2/(1+s)=1((1 - s)^2 + 4s)^{1/2} / (1 + s) = 1, so q⊗δq \otimes \delta is a unit quaternion. With w(δ)=(1−s)/(1+s)w(\delta) = (1 - s)/(1 + s) and ∣vec⁡(δ)∣=(∣v∣/2)/(1+s)\lvert \operatorname{vec}(\delta) \rvert = (\lvert \tangent \rvert / 2)/(1 + s), δ\delta is the rotation by θ\theta about v\tangent with cos⁡θ2=(1−s)/(1+s)\cos \tfrac\theta2 = (1-s)/(1+s) and sin⁡θ2=(∣v∣/2)/(1+s)\sin \tfrac\theta2 = (\lvert \tangent \rvert / 2)/(1+s), so tan⁡θ4=sin⁡θ2/(1+cos⁡θ2)=∣v∣/4\tan \tfrac\theta4 = \sin \tfrac\theta2 / (1 + \cos \tfrac\theta2) = \lvert \tangent \rvert / 4. As ∣v∣\lvert \tangent \rvert runs over [0,∞)[0, \infty), θ\theta runs over [0,2π)[0, 2\pi), so δ\delta runs over every unit quaternion but −1-1, once each; δ\delta is the inverse of the stereographic projection of S3S^3 from −1-1 onto the hyperplane w=0w = 0, at v/4\tangent / 4. Left multiplication by qq carries S3∖{−1}S^3 \setminus \{-1\} to S3∖{−q}S^3 \setminus \{-q\}. The inverse follows from δ=qˉ⊗p\delta = \bar q \otimes p and vec⁡(δ)/(1+w(δ))=v/4\operatorname{vec}( \delta) / (1 + w(\delta)) = \tangent / 4, which ss cancels from. Last, δ(v)=(1,v/2)+O(∣v∣2)\delta(\tangent) = (1, \tangent / 2) + O(\lvert \tangent \rvert^2), and (2) at it is I+[v]×+O(∣v∣2)I + [\tangent]_\times + O(\lvert \tangent \rvert^2); π\pi is a homomorphism.

∎

The chart’s coordinate of a rotation by θ\theta has the length 4tan⁡(θ/4)=θ+θ3/48+O(θ5)4 \tan(\theta / 4) = \theta + \theta^3 / 48 + O(\theta^5), closer to the exponential coordinate θ\theta than the Cayley chart’s 2tan⁡(θ/2)=θ+θ3/12+⋯2 \tan(\theta/2) = \theta + \theta^3 / 12 + \cdots. These are the modified Rodrigues parameters of attitude estimation, scaled by 44 so that they agree with the rotation vector to first order. The chart is the left translation of the chart at the identity, q⊕v=q⊗(1⊕v)q \oplus \tangent = q \otimes (1 \oplus \tangent), and since q⊗(w,u)⊗qˉ=(w,π(q) u)q \otimes (w, u) \otimes \bar q = (w, \pi(q)\, u) for a unit qq, and δ\delta depends on v\tangent only through its direction and ∣v∣\lvert \tangent \rvert, which π(q)\pi(q) preserves,

q⊕v=(1⊕π(q) v)⊗q(6) q \oplus \tangent = (1 \oplus \pi(q)\, \tangent) \otimes q \tag{6}
(6)

exactly, not only to first order: a perturbation v\tangent in the frame of the point is the perturbation π(q) v\pi(q)\, \tangent in the frame the point is expressed in. So the stereographic chart on the left, v↦(1⊕v)⊗q\tangent \mapsto (1 \oplus \tangent) \otimes q, is the same chart as this one, its coordinates rotated by π(q)\pi(q), and a law given with its noise on the left is a law on the right with the covariance π(q)⊤Σ π(q)\pi(q)\transpose \Sigma\, \pi(q).

Proposition 7(The volume of the stereographic chart).

Let ν\nu be the Haar measure of S3S^3 normalized so that the chart of Proposition 5 has volume 11 at its centre, which is 88 times the surface measure of S3⊂R4S^3 \subset \R^4. The chart at every qq is global and full, and its log-volume is

λq(v)=−3log⁡(1+116∣v∣2). \lambda_q(\tangent) = -3 \log\Bigl(1 + \tfrac{1}{16} \lvert \tangent \rvert^2\Bigr) .
Proof.

The chart at qq is the left translation of the chart at 11, and ν\nu is invariant under left translation, so the volume is that of the chart at 11 (Proposition 8). In polar coordinates, with θ\theta the angle of a rotation and aa its axis, Haar measure on S3S^3 is 4sin⁡2(θ/2) dθ da4 \sin^2(\theta/2)\, \dd \theta\, \dd a for θ∈[0,2π)\theta \in [0, 2\pi), normalized as the exponential chart, whose volume at v\tangent is sinc⁡2(∣v∣/2)\operatorname{sinc}^2(\lvert \tangent \rvert / 2) ((11)) and which on S3S^3 is a diffeomorphism of the ball of radius 2π2\pi. With r=4tan⁡(θ/4)r = 4 \tan(\theta/4), dθ=dr/(1+r2/16)\dd \theta = \dd r / (1 + r^2/16) and sin⁡(θ/2)=(r/2)/(1+r2/16)\sin(\theta/2) = (r/2)/(1 + r^2/16), so the measure is r2 dr da/(1+r2/16)3r^2\, \dd r\, \dd a / (1 + r^2/16)^3, while Lebesgue measure in v\tangent is r2 dr dar^2\, \dd r\, \dd a. The chart’s derivative at 00 is v↦q⊗(0,v/2)\tangent \mapsto q \otimes (0, \tangent/2), whose columns have length 12\tfrac12, so its volume at 00 against surface measure is 18\tfrac18, and ν\nu is 88 times surface measure (Proposition 7). The chart is global by Proposition 5 and full since it misses one point.

∎

The log-volume is rational in ∣v∣2\lvert \tangent \rvert^2, smooth as computed everywhere, and needs no guard at v=0\tangent = 0. The total mass of ν\nu is 8⋅2π2=16π28 \cdot 2\pi^2 = 16\pi^2.

The double cover#

A normal on S3S^3 is a law on the unit quaternions, and through π\pi a law on the rotations.

Proposition 8(A law on the unit quaternions as a law on the rotations).

Let x\randomPoint be a random point of S3S^3 with density p\density with respect to ν\nu, and νSO(3)=12 π∗ν\nu_{SO(3)} = \tfrac12\, \pi_* \nu. Then π(x)\pi(\randomPoint) has, with respect to νSO(3)\nu_{SO(3)}, the density R↦p(q)+p(−q)R \mapsto \density(q) + \density(-q), qq either preimage of RR. If x=μ⊕ε\randomPoint = \mu \oplus \varepsilon with ε\varepsilon in R3\R^3, then x\randomPoint lies on the far side of μ\mu, ⟨x,μ⟩<0\langle \randomPoint, \mu \rangle < 0, exactly when ∣ε∣>4\lvert \varepsilon \rvert > 4; and the two points ±q\pm q over one rotation have chart coordinates at μ\mu whose lengths multiply to 1616.

Proof.

The map q↦−qq \mapsto -q is the translation by −1-1, which preserves ν\nu, and π−1(A)=B∪(−B)\pi^{-1}(A) = B \cup (-B) for a measurable BB meeting each fibre once, such as the quaternions over AA with w>0w > 0, or w=0w = 0 and a first nonzero coordinate of uu positive. So Pr⁡(π(x)∈A)=∫B(p(q)+p(−q)) dν(q)\Pr(\pi(\randomPoint) \in A) = \int_B (\density(q) + \density(-q))\, \dd \nu(q), and π\pi carries ν\nu on BB to 12π∗ν=νSO(3)\tfrac12 \pi_* \nu = \nu_{SO(3)} on AA. For the second claim, ⟨μ⊕ε,μ⟩=w(δ(ε))=(1−s)/(1+s)\langle \mu \oplus \varepsilon, \mu \rangle = w(\delta(\varepsilon)) = (1 - s)/(1 + s), negative exactly when s>1s > 1. For the third, the coordinates of qq and −q-q at μ\mu have the angles θ\theta and 2π−θ2\pi - \theta, and 4tan⁡(θ/4)⋅4tan⁡((2π−θ)/4)=164 \tan(\theta/4) \cdot 4 \tan((2\pi - \theta)/4) = 16.

∎

So the normal on S3S^3 puts the mass Pr⁡(∣ε∣>4)\Pr(\lvert \varepsilon \rvert > 4) on the far side of its mean, at most Pr⁡(χ3>4/σ)\Pr(\chi_3 > 4/\sigma) for σ2\sigma^2 the largest eigenvalue of Σ\Sigma: below 10−1310^{-13} at σ=0.5\sigma = 0.5 rad, about 10−310^{-3} at 11 rad. As a law on the rotations it has the density p(q)+p(−q)\density(q) + \density(-q), in which the second term is negligible for a concentrated noise and the first is the normal’s term. For a broad one, such as a prior on an attitude about which little is known, it is the sum that is the law on the rotations, and the term on S3S^3 is the law on its double cover.

Three consequences follow for a model.

  • Generation is unaffected. A draw μ⊕ε\mu \oplus \varepsilon is a unit quaternion near μ\mu, and every value computed from it through π\pi, a rotated vector or a matrix, is the rotation’s.
  • An observed quaternion must be given on the side of its prediction. A sensor’s quaternion has an arbitrary sign: zz and −z-z are one rotation, but two points of S3S^3, and by the third claim one of them has a chart coordinate at the prediction of length at least 44, where the normal’s density is negligible. A measurement zz predicted by h(x)h(\point) is aligned before it is observed, z←sign⁡⟨z,h^⟩ zz \leftarrow \operatorname{sign}\langle z, \hat h \rangle\, z, at a value h^\hat h of the prediction near the estimate: the point of S3S^3 that is the measured rotation on the prediction’s side. Likelihoods that read the rotation only through π\pi, a measured direction π(q) x\pi(q)\, x for one, need no alignment.
  • A posterior on S3S^3 has a mirror. Every term that reads its quaternion through π\pi alone takes the same value at qq and at −q-q; a normal on S3S^3 does not, and breaks the symmetry. A model whose attitude enters through π\pi alone has a posterior with two mirrored modes, one for each sign, and an estimator converges to the one on the side it starts from, which is the same rotation.

Maps of the rotations#

A model computes with rotations as well as estimating them: it composes them, rotates vectors by them, integrates rates into them, reads angles off them, and builds them from the forms in which sensors and people give them. Each map below is a composite of the core’s primitives and selection, and its derivatives in charts are those of its parts. The primitives have no square root, absolute value or inverse sine, and divide only through logarithms, so the composites write a norm as ∣x∣=e12log⁡∑ixi2\lvert x \rvert = e^{\frac12 \log \sum_i x_i^2}, defined for x≠0x \ne 0, a reciprocal as 1/a=e−log⁡a1/a = e^{-\log a}, for a>0a > 0, every inverse trigonometric function through atan2⁡\atantwo, and an absolute value or a sign as a selection. Each map is of one of three kinds, and the kind says what a model may ask of its derivatives:

  • smooth as written: products, sums, sines and cosines of the storage, and reciprocals and norms of quantities positive on the map’s domain, with derivatives of every order the core takes;
  • smooth, with a removable singularity: smooth on its domain, but its closed form divides by an angle that vanishes at the identity; computed as the core’s smooth as computed asks, by a series below a cutoff, with derivatives of every order the core takes, at the identity too;
  • a discretization and a selection: where no continuous map exists, by Proposition 3, by Proposition 20, or by the jump of a rotation vector at a half-turn, the composite selects between smooth formulas by a discretization of its input; its derivatives are those of the selected formula, and the jump has none.

The group#

mapoftoaskind
identityS3S^3the constant (1,0)(1, 0)smooth
compositionS3×S3S^3 \times S^3S3S^3P(q1⊗q2)P(q_1 \otimes q_2), (1)smooth
inverseS3S^3S3S^3P(qˉ)P(\bar q)smooth
relative rotationS3×S3S^3 \times S^3S3S^3P(qˉ1⊗q2)P(\bar q_1 \otimes q_2)smooth
actionS3×R3S^3 \times \R^3R3\R^3x+2w (u×x)+2 u×(u×x)x + 2 w\, (u \times x) + 2\, u \times (u \times x)smooth
inverse actionS3×R3S^3 \times \R^3R3\R^3x−2w (u×x)+2 u×(u×x)x - 2 w\, (u \times x) + 2\, u \times (u \times x)smooth
matrixS3S^3R3×3\R^{3 \times 3}π(q)\pi(q), (2)smooth
adjointS3S^3R3×3\R^{3 \times 3}π(q)\pi(q)smooth
hatR3\R^3R3×3\R^{3 \times 3}[ω]×[\omega]_\timessmooth
veeR3×3\R^{3 \times 3}R3\R^312(A32−A23, A13−A31, A21−A12)\tfrac12 (A_{32} - A_{23},\ A_{13} - A_{31},\ A_{21} - A_{12})smooth

The composition, the inverse and the relative rotation are maps into the type, written in storage and projected ((9)); the product of two unit quaternions, and the conjugate of one, are unit quaternions already, and the projection only returns what rounding carried off the sphere. The relative rotation qˉ1⊗q2\bar q_1 \otimes q_2 is the rotation that carries the frame of q1q_1 to that of q2q_2, expressed in the frame of q1q_1, so that q1⊗(qˉ1⊗q2)=q2q_1 \otimes (\bar q_1 \otimes q_2) = q_2. The inverse action is the action of qˉ\bar q, the transpose π(q)⊤x\pi(q)\transpose x, which takes a vector given in the outer frame into the frame of qq; both actions apply column by column to a 3×n3 \times n matrix of vectors, and a covariance is carried by π(q) Σ π(q)⊤\pi(q)\, \Sigma\, \pi(q)\transpose, a product of the matrix with itself. The adjoint is the matrix itself on the rotations, and its meaning is (6): it carries a perturbation in the frame of the point to the outer frame. The hat is the skew matrix with [ω]×x=ω×x[\omega]_\times x = \omega \times x, and the vee is its inverse on skew matrices and, on any other, the vector of its skew part.

The exponential and the logarithm#

The exponential takes a rotation vector to the rotation about it by its length:

Exp⁡(ω)=(cos⁡θ2, sin⁡(θ/2)θ ω),θ=∣ω∣.(9) \Exp(\omega) = \Bigl(\cos \tfrac\theta2,\ \frac{\sin(\theta/2)}{\theta}\, \omega\Bigr), \qquad \theta = \lvert \omega \rvert . \tag{9}
(9)

It is a diffeomorphism of the open ball of radius 2π2\pi onto S3∖{−1}S^3 \setminus \{-1\}, and every ω\omega is a rotation by θ\theta modulo 2π2\pi. It is how a rate becomes a rotation: an attitude turning at the constant body rate ω\omega for a time Δt\Delta t moves from qkq_k to qk+1=qk⊗Exp⁡(ω Δt)q_{k+1} = q_k \otimes \Exp(\omega\, \Delta t), exactly. Its inverse on S3∖{−1}S^3 \setminus \{-1\} is the logarithm,

Log⁡(q)=2atan2⁡(n,w)n u,n=∣u∣,(10) \Log(q) = \frac{2 \atantwo(n, w)}{n}\, u, \qquad n = \lvert u \rvert, \tag{10}
(10)

whose rotation vector has the length 2atan2⁡(n,w)∈[0,2π)2 \atantwo(n, w) \in [0, 2\pi), smooth on S3∖{−1}S^3 \setminus \{-1\} and undefined at −1-1, the one point the exponential’s ball does not reach. The logarithm is a map of the unit quaternions, and Log⁡(−q)≠Log⁡(q)\Log(-q) \ne \Log(q). The rotation’s own logarithm, the rotation vector of the shorter turn,

rv⁡(q)=Log⁡(s(q) q),s(q)={1w≥0,−1w<0,(11) \rv(q) = \Log\bigl(s(q)\, q\bigr), \qquad s(q) = \begin{cases} 1 & w \ge 0, \\ -1 & w < 0, \end{cases} \tag{11}
(11)

is a map of the rotation, rv⁡(−q)=rv⁡(q)\rv(-q) = \rv(q), with length in [0,π][0, \pi], and a discretization: at a half-turn, w=0w = 0, it jumps from πa\pi a to −πa-\pi a, two rotation vectors of one rotation. The logarithm is what inverts the exponential, and the derivative of either is the other’s inverse; the rotation vector is what a model reports as the error of an attitude, or reads as the rate between two attitudes, ω≈rv⁡(qˉk⊗qk+1)/Δt\omega \approx \rv(\bar q_k \otimes q_{k+1}) / \Delta t.

The left and right Jacobians of the exponential are the matrices with Exp⁡(ω+ε)=Exp⁡(Jl(ω) ε)⊗Exp⁡(ω)=Exp⁡(ω)⊗Exp⁡(Jr(ω) ε)\Exp(\omega + \varepsilon) = \Exp(J_l(\omega)\, \varepsilon) \otimes \Exp(\omega) = \Exp(\omega) \otimes \Exp(J_r(\omega)\, \varepsilon) to first order in ε\varepsilon. They are

Jl(ω)=I+A [ω]×+B [ω]×2,Jr(ω)=Jl(−ω)=I−A [ω]×+B [ω]×2,A=1−cos⁡θθ2,B=θ−sin⁡θθ3,(12) J_l(\omega) = I + A\, [\omega]_\times + B\, [\omega]_\times^2, \quad J_r(\omega) = J_l(-\omega) = I - A\, [\omega]_\times + B\, [\omega]_\times^2, \quad A = \frac{1 - \cos \theta}{\theta^2}, \quad B = \frac{\theta - \sin \theta}{\theta^3}, \tag{12}
(12)

and their inverses, for θ<2π\theta < 2\pi,

Jl(ω)−1=I−12[ω]×+C [ω]×2,Jr(ω)−1=I+12[ω]×+C [ω]×2,C=1θ2(1−θ2cot⁡θ2).(13) J_l(\omega)^{-1} = I - \tfrac12 [\omega]_\times + C\, [\omega]_\times^2, \quad J_r(\omega)^{-1} = I + \tfrac12 [\omega]_\times + C\, [\omega]_\times^2, \quad C = \frac{1}{\theta^2}\Bigl(1 - \frac\theta2 \cot \frac\theta2\Bigr). \tag{13}
(13)

Each is a polynomial in [ω]×[\omega]_\times, so the inverses are checked by multiplying out with [ω]×3=−θ2[ω]×[\omega]_\times^3 = -\theta^2 [\omega]_\times, and Jr(ω)=Jl(ω)⊤J_r(\omega) = J_l(\omega)\transpose, since [ω]×[\omega]_\times is skew. skoro does not need them to differentiate: a model’s derivatives are computed by passes, in the charts of the types, and those are the Jacobians of the textbooks.

Proposition 14(The derivatives in these charts are the exponential coordinates').

Let F\map be a smooth map between the types of this document and Euclidean spaces. Its derivative in charts (11), read in the charts of this document, equals its Jacobian read in exponential coordinates on the same side, xExp⁡(v)\point \Exp(\tangent). In particular the derivative of Exp⁡:R3→S3\Exp : \R^3 \to S^3 at ω\omega is the right Jacobian Jr(ω)J_r(\omega), and that of Log⁡\Log at qq is Jr(Log⁡q)−1J_r(\Log q)^{-1}. On the unit quaternions the chart and the exponential agree to second order, 1⊕v=Exp⁡(v)+O(∣v∣3)1 \oplus \tangent = \Exp(\tangent) + O(\lvert \tangent \rvert^3), so the second derivatives of a map of unit quaternions at the centres of the charts agree too; on the rigid motions they agree to first order only.

Proof.

The derivative in charts of F\map at x\point is the Jacobian at 00 of v↦Qy(F(Rx(v)))\tangent \mapsto Q_\otherPoint(\map(R_\point(\tangent))), with RxR_\point the chart at x\point and QyQ_\otherPoint its inverse at y=F(x)\otherPoint = \map(\point), and by the chain rule it depends on RxR_\point only through its differential at 00 and on QyQ_\otherPoint only through its differential at y\otherPoint, which is the inverse of RyR_\otherPoint’s at 00. On S3S^3, 1⊕v=(1−18∣v∣2, 12v)+O(∣v∣3)1 \oplus \tangent = \bigl(1 - \tfrac18 \lvert \tangent \rvert^2,\ \tfrac12 \tangent\bigr) + O(\lvert \tangent \rvert^3) from (1−s)/(1+s)=1−2s+O(s2)(1 - s)/(1 + s) = 1 - 2s + O(s^2), and Exp⁡(v)\Exp(\tangent) has the same expansion from cos⁡θ2=1−18θ2+O(θ4)\cos \tfrac\theta2 = 1 - \tfrac18 \theta^2 + O(\theta^4) and sin⁡(θ/2)/θ=12+O(θ2)\sin(\theta/2)/\theta = \tfrac12 + O(\theta^2); both charts are left translations of these, so they agree at every point to second order, and so do their inverses. The local representatives of F\map in the two charts then agree to second order at 00, and so do their first and second derivatives there. On the rigid motions the chart is (q⊕ϕ, p+π(q) ρ)(q \oplus \phi,\ p + \pi(q)\, \rho) and the exponential coordinates are (qExp⁡ϕ, p+π(q) Jl(ϕ) ρ)(q \Exp \phi,\ p + \pi(q)\, J_l(\phi)\, \rho), by (25) below, and Jl(ϕ) ρ=ρ+12ϕ×ρ+O(∣ϕ∣2∣ρ∣)J_l(\phi)\, \rho = \rho + \tfrac12 \phi \times \rho + O(\lvert \phi \rvert^2 \lvert \rho \rvert): they agree to first order, and differ at second order by the term 12ϕ×ρ\tfrac12 \phi \times \rho. Last, Exp⁡(ω+ε)⊖Exp⁡(ω)\Exp(\omega + \varepsilon) \ominus \Exp(\omega) is the chart coordinate at 11 of Exp⁡(ω)−1⊗Exp⁡(ω+ε)=Exp⁡(Jr(ω) ε)+O(∣ε∣2)\Exp(\omega)^{-1} \otimes \Exp(\omega + \varepsilon) = \Exp(J_r(\omega)\, \varepsilon) + O(\lvert \varepsilon \rvert^2), which is Jr(ω) ε+O(∣ε∣2)J_r(\omega)\, \varepsilon + O(\lvert \varepsilon \rvert^2); and Log⁡\Log is the inverse of Exp⁡\Exp.

∎

The right Jacobian is still a map of its own, for the values a model computes with it rather than for its derivatives: the left Jacobian is the VV of the rigid motions’ exponential below, and a model that propagates a covariance through a rate by hand, as the preintegration of an inertial unit’s samples does, writes JrJ_r into its formula.

Removable singularities#

The exponential, the logarithm, the Jacobians and their inverses are smooth at the identity, and their closed forms divide by θ\theta there, or by nn. Each is computed as the core’s smooth as computed asks of a composite: a discretization of the argument below a cutoff selects a truncated series of each coefficient, and further selections give each formula a harmless argument on the rows where the other is chosen (the closed form where the series is, and the series, if it can be undefined, where the closed form is), so that no derivative of a formula that is not selected is ever undefined. The coefficients, each a function of θ2\theta^2, or for the logarithm of n2n^2 and ww, are:

coefficientclosed formseriesused by
aacos⁡θ2\cos \tfrac\theta2∑k(−1)kθ2k4k(2k)!=1−θ28+θ4384−⋯\sum_k \frac{(-1)^k \theta^{2k}}{4^k (2k)!} = 1 - \frac{\theta^2}{8} + \frac{\theta^4}{384} - \cdots(9)
bbsin⁡(θ/2)/θ\sin(\theta/2)/\theta∑k(−1)kθ2k22k+1(2k+1)!=12−θ248+θ43840−⋯\sum_k \frac{(-1)^k \theta^{2k}}{2^{2k+1} (2k+1)!} = \frac12 - \frac{\theta^2}{48} + \frac{\theta^4}{3840} - \cdots(9)
AA(1−cos⁡θ)/θ2(1 - \cos \theta)/\theta^2∑k(−1)kθ2k(2k+2)!=12−θ224+θ4720−⋯\sum_k \frac{(-1)^k \theta^{2k}}{(2k+2)!} = \frac12 - \frac{\theta^2}{24} + \frac{\theta^4}{720} - \cdots(12)
BB(θ−sin⁡θ)/θ3(\theta - \sin \theta)/\theta^3∑k(−1)kθ2k(2k+3)!=16−θ2120+θ45040−⋯\sum_k \frac{(-1)^k \theta^{2k}}{(2k+3)!} = \frac16 - \frac{\theta^2}{120} + \frac{\theta^4}{5040} - \cdots(12)
CC(1−θ2cot⁡θ2)/θ2\bigl(1 - \frac\theta2 \cot \frac\theta2\bigr)/\theta^2112+θ2720+θ430240+⋯\frac1{12} + \frac{\theta^2}{720} + \frac{\theta^4}{30240} + \cdots(13)
LL2atan2⁡(n,w)/n2 \atantwo(n, w)/n2w∑k(−1)kxk2k+1=2w(1−x3+x25−⋯ )\frac2w \sum_k \frac{(-1)^k x^k}{2k+1} = \frac2w \bigl(1 - \frac x3 + \frac{x^2}5 - \cdots\bigr), x=n2/w2x = n^2/w^2(10)

The series of CC is that of θ2cot⁡θ2=1−θ212−θ4720−θ630240−⋯\tfrac\theta2 \cot \tfrac\theta2 = 1 - \tfrac{\theta^2}{12} - \tfrac{\theta^4}{720} - \tfrac{\theta^6}{30240} - \cdots, and that of LL is atan2⁡(n,w)/n=arctan⁡(n/w)/n\atantwo(n, w) / n = \arctan(n/w)/n for w>0w > 0, expanded in xx. The logarithm’s series holds near the identity only, so its discretization is n2<c w2n^2 < c\, w^2 and w>0w > 0, which needs no division, and the series is given w=1w = 1 on the rows where it is not chosen, since its 1/w1/w is undefined at w≤0w \le 0; near −1-1 the closed form is selected, and it is the logarithm’s cut, not a removable singularity. Its argument keeps ww: on the sphere w=(1−n2)1/2w = (1 - n^2)^{1/2}, but a series in n2n^2 alone would have no derivative in ww, and the second derivatives along the sphere, which move ww at second order, would be wrong. The closed forms’ own arguments are θ=e12log⁡θ2\theta = e^{\frac12 \log \theta^2} and n=e12log⁡n2n = e^{\frac12 \log n^2}, and cot⁡θ2=cos⁡θ2 e−log⁡sin⁡(θ/2)\cot \tfrac\theta2 = \cos \tfrac\theta2\, e^{-\log \sin(\theta/2)}, positive in its logarithm for 0<θ<2π0 < \theta < 2\pi.

Each series keeps at least the terms through θ2\theta^2, so that the derivatives of second order at the identity are exact, and in practice as many as make its truncation error at the cutoff smaller than the closed form’s rounding there. Where to put each cutoff and how many terms to keep, at either precision, is settled by the implementation against measured errors on both sides of the cutoff; the archive’s exponential, with its terms through θ8\theta^8 and its cutoffs at θ2≈1.37\theta^2 \approx 1.37 in single precision and 0.0250.025 in double, is where that starts.

Interpolation and distance#

The geodesic from q1q_1 to q2q_2, at the parameter t∈Rt \in \R, is

q1⊗Exp⁡(tLog⁡(qˉ1⊗q2)),(15) q_1 \otimes \Exp\bigl(t \Log(\bar q_1 \otimes q_2)\bigr), \tag{15}
(15)

which runs at a constant rate along the great circle of S3S^3 through q1q_1 and q2q_2, reaching q2q_2 at t=1t = 1 by the arc that avoids −q1-q_1, and is smooth wherever q2≠−q1q_2 \ne -q_1. With rv⁡\rv in place of Log⁡\Log it is the rotation’s interpolation, along the shorter of the two turns from one attitude to the other, and a discretization where the relative rotation is a half-turn and the two turns are equally short. A model interpolating an attitude between two estimates means the second; the first is the curve of the unit quaternions, and the two agree whenever ⟨q1,q2⟩≥0\langle q_1, q_2 \rangle \ge 0.

The angle between two rotations, the length of the shorter turn from one to the other and the distance between them on the rotations, is

∠(q1,q2)=∣rv⁡(qˉ1⊗q2)∣=2atan2⁡(∣vec⁡(r)∣, ∣w(r)∣)∈[0,π],r=qˉ1⊗q2.(16) \angle(q_1, q_2) = \lvert \rv(\bar q_1 \otimes q_2) \rvert = 2 \atantwo\bigl(\lvert \operatorname{vec}(r) \rvert,\ \lvert w(r) \rvert\bigr) \in [0, \pi], \qquad r = \bar q_1 \otimes q_2 . \tag{16}
(16)

It is the same at ±q1\pm q_1 and ±q2\pm q_2, and smooth where 0<∠<π0 < \angle < \pi: at 00 it is a norm, with no derivative, and at π\pi a maximum, where ∣w(r)∣\lvert w(r) \rvert turns. Its square, ∣rv⁡(r)∣2\lvert \rv(r) \rvert^2, is smooth at 00, and is what a cost on an attitude’s error is written with.

Constructions and conversions#

Rotations reach a model as an axis and an angle, as a pair of directions, as Euler angles and as matrices, and leave it in the same forms.

Elementary rotations and axis–angle. The rotation by θ\theta about the coordinate axis ee is qe(θ)=(cos⁡θ2, sin⁡θ2 e)q_e(\theta) = (\cos \tfrac\theta2,\ \sin \tfrac\theta2\, e), and about any axis a≠0a \ne 0 it is (cos⁡θ2, sin⁡θ2 a/∣a∣)(\cos \tfrac\theta2,\ \sin \tfrac\theta2\, a / \lvert a \rvert), smooth in both. The way back is the logarithm split into its length and its direction, θ=2atan2⁡(n,w)\theta = 2 \atantwo(n, w) and a=u/na = u / n; the direction is undefined at the identity, where the composite selects a fixed axis, and is a discretization there. A model differentiating through an axis and an angle is better served by the rotation vector, which has no such point.

From two directions. The rotation of least angle carrying the direction of aa to that of bb is

P(∣a∣∣b∣+a⋅b, a×b),(17) P\bigl(\lvert a \rvert \lvert b \rvert + a \cdot b,\ a \times b\bigr), \tag{17}
(17)

since for unit vectors at the angle θ\theta about the axis nn the argument is (1+cos⁡θ,sin⁡θ n)=2cos⁡θ2(cos⁡θ2,sin⁡θ2 n)(1 + \cos \theta, \sin \theta\, n) = 2 \cos \tfrac\theta2 \bigl(\cos \tfrac\theta2, \sin \tfrac\theta2\, n\bigr). It is smooth for a,b≠0a, b \ne 0 except where bb is opposite to aa: there the argument vanishes, every half-turn about an axis perpendicular to aa is a rotation of least angle, and the map is undefined. It is how a measured direction, of gravity or of a magnetic field, is turned into an attitude that explains it.

Euler angles. A sequence of axes (i,j,k)(i, j, k) with i≠j≠ki \ne j \ne k is proper when k=ik = i and of Tait–Bryan type when the three are distinct, six sequences of each. The rotation by the angles (α,β,γ)(\alpha, \beta, \gamma) about them, each about the axis as the previous rotations left it (intrinsic), is

q=qi(α)⊗qj(β)⊗qk(γ),(18) q = q_i(\alpha) \otimes q_j(\beta) \otimes q_k(\gamma), \tag{18}
(18)

smooth in the angles, and its rotation about the fixed axes in the same order (extrinsic) is qk(γ)⊗qj(β)⊗qi(α)q_k(\gamma) \otimes q_j(\beta) \otimes q_i(\alpha), the intrinsic rotation of the reversed sequence. Roll, pitch and yaw (ϕ,ϑ,ψ)(\phi, \vartheta, \psi) in the usual aerospace convention are the intrinsic (z,y,x)(z, y, x) angles (ψ,ϑ,ϕ)(\psi, \vartheta, \phi). The way back is a composite for every sequence:

Proposition 19(The Euler angles of a unit quaternion).

Let (i,j,k)(i, j, k) be axes with i≠j≠ki \ne j \ne k, let ll be the axis other than ii and jj, and let ϵ=±1\epsilon = \pm 1 with ei×ej=ϵ ele_i \times e_j = \epsilon\, e_l. Write qe(θ)=(cos⁡θ2,sin⁡θ2 e)q_e(\theta) = (\cos \tfrac\theta2, \sin \tfrac\theta2\, e).

  1. Proper angles, k=ik = i. If q=qi(α)⊗qj(β)⊗qi(γ)q = q_i(\alpha) \otimes q_j(\beta) \otimes q_i(\gamma) with β∈[0,π]\beta \in [0, \pi], then, with σ=(α+γ)/2\sigma = (\alpha + \gamma)/2 and δ=(α−γ)/2\delta = (\alpha - \gamma)/2,

    (w, ui)=cos⁡β2 (cos⁡σ, sin⁡σ),(uj, ϵ ul)=sin⁡β2 (cos⁡δ, sin⁡δ). (w,\ u_i) = \cos \tfrac\beta2\, (\cos \sigma,\ \sin \sigma), \qquad (u_j,\ \epsilon\, u_l) = \sin \tfrac\beta2\, (\cos \delta,\ \sin \delta) .

    So for β∈(0,π)\beta \in (0, \pi) the angles are recovered, modulo 2π2\pi, from any positive multiple of qq or of −q-q as β=2atan2⁡(∣(uj,ul)∣, ∣(w,ui)∣)\beta = 2 \operatorname{atan2}\bigl(\lvert (u_j, u_l) \rvert,\ \lvert (w, u_i) \rvert\bigr), α=σ+δ\alpha = \sigma + \delta and γ=σ−δ\gamma = \sigma - \delta, where σ=atan2⁡(ui,w)\sigma = \operatorname{atan2}(u_i, w) and δ=atan2⁡(ϵ ul,uj)\delta = \operatorname{atan2}(\epsilon\, u_l, u_j).

  2. Tait–Bryan angles, k=lk = l. If q=qi(α)⊗qj(β)⊗qk(γ)q = q_i(\alpha) \otimes q_j(\beta) \otimes q_k(\gamma) with β∈[−π2,π2]\beta \in [-\tfrac\pi2, \tfrac\pi2], then q⊗qj(π2)q \otimes q_j(\tfrac\pi2) has the proper angles (α, β+π2, −ϵγ)(\alpha,\ \beta + \tfrac\pi2,\ -\epsilon \gamma) about (i,j,i)(i, j, i), and is a positive multiple of (w−uj, ui−ϵuk, uj+w, uk+ϵui)(w - u_j,\ u_i - \epsilon u_k,\ u_j + w,\ u_k + \epsilon u_i), listed as the coordinates (w,ui,uj,uk)(w, u_i, u_j, u_k).

Proof.

With cθ=cos⁡θ2c_\theta = \cos \tfrac\theta2 and sθ=sin⁡θ2s_\theta = \sin \tfrac\theta2, and ej×ei=−ϵ ele_j \times e_i = -\epsilon\, e_l, el×ei=ϵ eje_l \times e_i = \epsilon\, e_j, the product (1) gives qi(α)⊗qj(β)=(cαcβ, sαcβ ei+cαsβ ej+ϵsαsβ el)q_i(\alpha) \otimes q_j(\beta) = (c_\alpha c_\beta,\ s_\alpha c_\beta\, e_i + c_\alpha s_\beta\, e_j + \epsilon s_\alpha s_\beta\, e_l), and its product with qi(γ)q_i(\gamma) has

w=cβ(cαcγ−sαsγ),ui=cβ(cαsγ+sαcγ),uj=sβ(cαcγ+sαsγ),ul=ϵ sβ(sαcγ−cαsγ), w = c_\beta (c_\alpha c_\gamma - s_\alpha s_\gamma), \quad u_i = c_\beta (c_\alpha s_\gamma + s_\alpha c_\gamma), \quad u_j = s_\beta (c_\alpha c_\gamma + s_\alpha s_\gamma), \quad u_l = \epsilon\, s_\beta (s_\alpha c_\gamma - c_\alpha s_\gamma),

which are the stated forms by the addition formulas. For β∈(0,π)\beta \in (0, \pi) both cβc_\beta and sβs_\beta are positive, so ∣(w,ui)∣=λcβ\lvert (w, u_i) \rvert = \lambda c_\beta and ∣(uj,ul)∣=λsβ\lvert (u_j, u_l) \rvert = \lambda s_\beta for qq scaled by λ>0\lambda > 0, and the atan2⁡\atantwos return β/2\beta / 2, and σ\sigma and δ\delta modulo 2π2\pi; for −q-q they return σ+π\sigma + \pi and δ+π\delta + \pi modulo 2π2\pi, which change α\alpha and γ\gamma by multiples of 2π2\pi. For the second claim, let r=qj(π2)r = q_j(\tfrac\pi2). Since π(r)\pi(r) turns eie_i about eje_j to ej×ei=−ϵeke_j \times e_i = -\epsilon e_k, qk(γ)=r⊗qi(−ϵγ)⊗rˉq_k(\gamma) = r \otimes q_i(-\epsilon \gamma) \otimes \bar r, and so q⊗r=qi(α)⊗qj(β+π2)⊗qi(−ϵγ)q \otimes r = q_i(\alpha) \otimes q_j(\beta + \tfrac\pi2) \otimes q_i(-\epsilon\gamma), with β+π2∈[0,π]\beta + \tfrac\pi2 \in [0, \pi]. Last, q⊗(1,ej)=(w−uj, u+w ej+u×ej)q \otimes (1, e_j) = (w - u_j,\ u + w\, e_j + u \times e_j) is 2 q⊗r\sqrt 2\, q \otimes r, and u×ej=ϵui ek−ϵuk eiu \times e_j = \epsilon u_i\, e_k - \epsilon u_k\, e_i.

∎

So the Euler angles of a unit quaternion are, for a proper sequence, those of Proposition 19 read off qq, and for a Tait–Bryan sequence those read off the linear rearrangement of qq it gives, with β\beta lowered by π2\tfrac\pi2 and γ\gamma multiplied by −ϵ-\epsilon; for an extrinsic sequence, those of the reversed sequence, in reverse order. The rotation is smooth in its angles everywhere, but the angles are not smooth in the rotation everywhere, and no choice of formula makes them so:

Proposition 20(No continuous Euler angles).

Fix a sequence of axes (i,j,k)(i, j, k), and call a rotation at the lock when its β\beta is 00 or π\pi for a proper sequence, ±π2\pm\tfrac\pi2 for a Tait–Bryan one.

  1. Away from the lock, α\alpha and γ\gamma are smooth maps of the rotation into the circle R/2πZ\R / 2\pi\Z, but neither is represented by a continuous real-valued map on any set of rotations containing the loop t↦π(qi(t)⊗qj(β)⊗qk(γ))t \mapsto \pi\bigl(q_i(t) \otimes q_j(\beta) \otimes q_k(\gamma)\bigr), t∈[0,2π]t \in [0, 2\pi], for γ\gamma the loop in its own angle, with β\beta off the lock.
  2. At a rotation at the lock, neither α\alpha nor γ\gamma has a limit, even in the circle. For a proper sequence, α+γ\alpha + \gamma has one at β=0\beta = 0 and α−γ\alpha - \gamma at β=π\beta = \pi; for a Tait–Bryan sequence, α−ϵγ\alpha - \epsilon \gamma has one at β=−π2\beta = -\tfrac\pi2 and α+ϵγ\alpha + \epsilon \gamma at β=π2\beta = \tfrac\pi2, with ϵ\epsilon as in the proposition on the Euler angles of a unit quaternion.
Proof.

For the first claim, let α~\tilde\alpha be continuous and real-valued, equal to α\alpha modulo 2π2\pi on the loop. Off the lock the angles are unique modulo 2π2\pi by Proposition 19, so the loop’s rotation at tt has α=t\alpha = t modulo 2π2\pi, and α~(t)−t\tilde\alpha(t) - t is continuous with values in 2πZ2\pi\Z, hence constant. So α~\tilde\alpha is larger by 2π2\pi at t=2πt = 2\pi than at t=0t = 0, but the loop closes there, since qi(2π)=−1q_i(2\pi) = -1 and π(−q)=π(q)\pi(-q) = \pi(q). The same holds of γ\gamma on its loop. For the second, take a proper sequence. As β→0\beta \to 0, qi(α)⊗qj(β)⊗qi(θ−α)q_i(\alpha) \otimes q_j(\beta) \otimes q_i(\theta - \alpha) tends to qi(θ)q_i(\theta) for every α\alpha, and for β∈(0,π)\beta \in (0, \pi) its angles are α\alpha and θ−α\theta - \alpha modulo 2π2\pi; so the rotations near π(qi(θ))\pi(q_i(\theta)) take every α\alpha and every γ\gamma, while α+γ=θ\alpha + \gamma = \theta on all of them. At β=π\beta = \pi the same holds of qi(α)⊗qj(β)⊗qi(α−θ)q_i(\alpha) \otimes q_j(\beta) \otimes q_i(\alpha - \theta), which tends to qi(θ)⊗qj(π)q_i(\theta) \otimes q_j(\pi) for every α\alpha, since qj(π)⊗qi(φ)=qi(−φ)⊗qj(π)q_j(\pi) \otimes q_i(\varphi) = q_i(-\varphi) \otimes q_j(\pi), a half-turn about eje_j reversing eie_i; there α−γ=θ\alpha - \gamma = \theta. A Tait–Bryan sequence’s angles are, by Proposition 19, the proper angles (α,β+π2,−ϵγ)(\alpha, \beta + \tfrac\pi2, -\epsilon\gamma) of q⊗qj(π2)q \otimes q_j(\tfrac\pi2), a diffeomorphism of the rotations, and its lock is theirs.

∎

The way back therefore has two kinds of singularity, and the composite treats them differently.

The wrap. Away from the lock, α\alpha and γ\gamma are smooth as angles, points of the circle, and are returned as real numbers in (−π,π](-\pi, \pi], as atan2⁡(sin⁡α,cos⁡α)\atantwo(\sin \alpha, \cos \alpha), so that qq and −q-q give the same angles. By Proposition 20 a real-valued angle must be cut somewhere, and this convention cuts it where it is π\pi: crossing there, it jumps by 2π2\pi, from π\pi to just above −π-\pi. The jump is in the value alone. atan2⁡(a,b)\atantwo(a, b) jumps across its half-line a=0a = 0, b<0b < 0, but its derivatives, (b,−a)/(a2+b2)(b, -a) / (a^2 + b^2) by (13), and all of their own, are continuous across it, so the angles’ derivatives of every order are the same on either side of the wrap: those of the angle on the circle. What a jump in value breaks is a difference of values: a finite difference straddling the wrap, and a residual. Half-turns about the coordinate axes, common test values, lie on it: a half-turn about xx has the (z,y,x)(z, y, x) angles (0,0,π)(0, 0, \pi), and rounding puts its γ\gamma at either end of the interval. A residual between an angle aa read off a model and an angle bb it is compared with is taken on the circle,

a⊖b=atan2⁡(sin⁡(a−b), cos⁡(a−b)),(21) a \ominus b = \atantwo\bigl(\sin(a - b),\ \cos(a - b)\bigr), \tag{21}
(21)

which moves the cut to a residual of ±π\pm\pi, as far as an angle can be from the one it is compared with, and has the derivatives of a−ba - b everywhere else. With bb a reference angle, such as the previous estimate along a trajectory, b+(a⊖b)b + (a \ominus b) is the angle in (b−π,b+π](b - \pi, b + \pi], continuous along any path that stays within a half-turn of bb.

The lock. At gimbal lock one of the two norms of Proposition 19 vanishes, and by Proposition 20 only α+γ\alpha + \gamma or α−γ\alpha - \gamma is determined there: no convention makes the angles continuous at the lock, and the composite chooses γ=0\gamma = 0, which (18) maps back to the rotation exactly. It selects it by a discretization of the smaller squared norm against a fraction cc of ∣q∣2\lvert q \rvert^2. On the rows selected, β\beta is taken at the lock rather than computed, α=2σ\alpha = 2\sigma when ∣(uj,ul)∣\lvert (u_j, u_l) \rvert vanishes and α=2δ\alpha = 2\delta when ∣(w,ui)∣\lvert (w, u_i) \rvert does, and the vanishing norm and the atan2⁡\atantwo it feeds are given a harmless argument, since a norm has no derivative at 00. A row is selected when sin⁡β2≤c\sin \tfrac\beta2 \le \sqrt c, or cos⁡β2≤c\cos \tfrac\beta2 \le \sqrt c, and there the convention’s rotation differs from qq by a conjugate of qj(β)q_j(\beta), or of qj(π−β)q_j(\pi - \beta): by the angle β\beta, or π−β\pi - \beta, at most 2arcsin⁡c2 \arcsin \sqrt c. So cc is chosen to make that angle smaller than the rounding of either precision, and the selection changes the round trip of no rotation that rounding can tell from the lock. On the selected rows the derivatives are those of the selected formulas: none for β\beta and γ\gamma, and for α\alpha those of 2σ2\sigma or 2δ2\delta, which are the derivatives of α+γ\alpha + \gamma or α−γ\alpha - \gamma, the one combination that has them.

Off the lock the angles are smooth, but not uniformly. δ\delta is the angle of the vector (uj,ϵul)(u_j, \epsilon u_l) of length sin⁡β2\sin \tfrac\beta2, and σ\sigma that of (w,ui)(w, u_i) of length cos⁡β2\cos \tfrac\beta2, so the first derivatives of α\alpha and γ\gamma grow like 1/sin⁡β21 / \sin \tfrac\beta2 as β→0\beta \to 0 and 1/cos⁡β21 / \cos \tfrac\beta2 as β→π\beta \to \pi, and their second derivatives like the squares; β\beta, twice the angle between those two lengths, has bounded first derivatives that turn with the direction of approach, and second derivatives that grow in the same way. The same factor amplifies a rounding of qq’s coordinates into α\alpha and γ\gamma near the lock, while α±γ\alpha \pm \gamma, read off the larger norm, stays accurate: that is the condition of the angles, not an error of the composite. Euler angles are therefore a way into and out of a model, and its noise is put in the charts instead.

From a matrix. By Proposition 3 no continuous map reads a quaternion off every rotation matrix, and the usual reading is a selection between four, each a linear map of the matrix XX projected:

c0(X)=(1+X11+X22+X33, X32−X23, X13−X31, X21−X12),c1(X)=(X32−X23, 1+X11−X22−X33, X12+X21, X13+X31),c2(X)=(X13−X31, X12+X21, 1−X11+X22−X33, X23+X32),c3(X)=(X21−X12, X13+X31, X23+X32, 1−X11−X22+X33),q=P(cm(X)),(22) \begin{aligned} c_0(X) &= (1 + X_{11} + X_{22} + X_{33},\ X_{32} - X_{23},\ X_{13} - X_{31},\ X_{21} - X_{12}), \\ c_1(X) &= (X_{32} - X_{23},\ 1 + X_{11} - X_{22} - X_{33},\ X_{12} + X_{21},\ X_{13} + X_{31}), \\ c_2(X) &= (X_{13} - X_{31},\ X_{12} + X_{21},\ 1 - X_{11} + X_{22} - X_{33},\ X_{23} + X_{32}), \\ c_3(X) &= (X_{21} - X_{12},\ X_{13} + X_{31},\ X_{23} + X_{32},\ 1 - X_{11} - X_{22} + X_{33}), \end{aligned} \qquad q = P\bigl(c_m(X)\bigr), \tag{22}
(22)

with mm the index of the largest of the four diagonal entries cm(X)mc_m(X)_m. At X=π(q)X = \pi(q), (2) gives cm(X)=4qm qc_m(X) = 4 q_m\, q, writing q=(q0,q1,q2,q3)q = (q_0, q_1, q_2, q_3), so P(cm(X))=sign⁡(qm) qP(c_m(X)) = \operatorname{sign}(q_m)\, q: the quaternion over XX whose mm-th coordinate is positive. Since cm(X)m=4qm2c_m(X)_m = 4 q_m^2 and the largest of the qm2q_m^2 is at least 14\tfrac14, the selected argument has norm at least 22. The composite selects the argument before it projects, so that the projection never meets one of the small arguments it did not choose. Within each choice of mm the map is smooth; where the choice changes, the result may change sign. A matrix that is only near a rotation gives a nearby unit quaternion, though not that of the nearest rotation. A quaternion read off a measured matrix this way is aligned with its prediction like any other.

Alignment. The alignment of zz with rr, sign⁡⟨z,r⟩ z\operatorname{sign}\langle z, r \rangle\, z by selection, is the point over zz’s rotation on the side of rr, and with r=1r = 1 the one with w≥0w \ge 0. It is a discretization, applied on the host to an observed quaternion before it is observed, as The double cover says, or to a quaternion before it is reported.

The rigid motions#

A rigid motion is a rotation and a translation, and an extended pose a rotation, a velocity and a position. As groups, with the unit quaternions in place of the rotations, they are the semidirect products S3⋉R3S^3 \ltimes \R^3, a double cover of SE(3)SE(3), and S3⋉(R3×R3)S^3 \ltimes (\R^3 \times \R^3), a double cover of SE2(3)SE_2(3), with the products of Proposition 23, stored as (q,p)(q, p), of storage 77 and dimension 66, and (q,v,p)(q, v, p), of storage 1010 and dimension 99.

Proposition 23(The charts of the rigid motions).

On S3⋉R3S^3 \ltimes \R^3, with the product (q1,p1)(q2,p2)=(q1⊗q2, p1+π(q1)p2)(q_1, p_1)(q_2, p_2) = (q_1 \otimes q_2,\ p_1 + \pi(q_1) p_2), let

(q,p)⊕(ϕ,ρ)=(q⊕ϕ, p+π(q) ρ), (q, p) \oplus (\phi, \rho) = \bigl(q \oplus \phi,\ p + \pi(q)\, \rho\bigr),

and on S3⋉(R3×R3)S^3 \ltimes (\R^3 \times \R^3), with (q1,v1,p1)(q2,v2,p2)=(q1⊗q2, v1+π(q1)v2, p1+π(q1)p2)(q_1, v_1, p_1)(q_2, v_2, p_2) = (q_1 \otimes q_2,\ v_1 + \pi(q_1) v_2,\ p_1 + \pi(q_1) p_2), let

(q,v,p)⊕(ϕ,η,ρ)=(q⊕ϕ, v+π(q) η, p+π(q) ρ). (q, v, p) \oplus (\phi, \eta, \rho) = \bigl(q \oplus \phi,\ v + \pi(q)\, \eta,\ p + \pi(q)\, \rho\bigr).

Each is the left translation by the point of the chart at the identity, is global and full, has the inverse (ϕ,ρ)=((q′⊖q), π(q)⊤(p′−p))\bigl(\phi, \rho\bigr) = \bigl((q' \ominus q),\ \pi(q)\transpose (p' - p)\bigr) (and likewise for vv), and has, against the product ν×\nu \times Lebesgue, which is a Haar measure of the group, the log-volume λ(ϕ,⋅)=−3log⁡(1+∣ϕ∣2/16)\lambda(\phi, \cdot) = -3 \log(1 + \lvert \phi \rvert^2 / 16) of its rotation alone.

Proof.

The product of (q,p)(q, p) and (1⊕ϕ,ρ)(1 \oplus \phi, \rho) is (q⊗(1⊕ϕ),p+π(q)ρ)(q \otimes (1 \oplus \phi), p + \pi(q) \rho), the chart, and likewise for the extended pose. For fixed (q,p)(q, p) the chart is the product of the rotation’s chart, a diffeomorphism of R3\R^3 onto S3∖{−q}S^3 \setminus \{-q\}, and the affine map ρ↦p+π(q)ρ\rho \mapsto p + \pi(q) \rho of R3\R^3 onto itself, so it is global, full, and inverted as stated. Since π(q)\pi(q) is a rotation, ν×\nu \times Lebesgue measure is invariant under the group’s left and right translations, so it is a Haar measure and the volume of the chart is the same at every point (Proposition 8); at the identity it is the product of the rotation’s chart’s volume and ∣det⁡π(1)∣=1\lvert \det \pi(1) \rvert = 1.

∎

The chart is not the groups’ exponential (25), which couples the translation to the rotation through the left Jacobian; the two agree to first order, by Proposition 14. Its translation coordinates are in the frame of the point: the noise ρ\rho of a pose’s normal moves the position along the pose’s own axes, as the noise of an odometer, an inertial unit or a scan matcher is given. Since the chart is a left translation, the normal’s law of a translated chart holds on these groups, as on the rotations.

A translation with its noise in a fixed frame is a different model, the product of S3S^3 with R3\R^3, whose chart moves the rotation and the position independently. The core has products already: S3×R3S^3 \times \R^3 is a product of spaces, global and full when its factors are, with the log-volume of its rotation alone, and needs no type of its own.

Maps of the rigid motions#

The maps of the rigid motions are their group’s, each a composite projecting its rotation, with R=π(q)R = \pi(q) and tangent coordinates ordered rotation first, (ϕ,ρ)(\phi, \rho):

mapoftoaskind
identitySE(3)SE(3)(1,0)(1, 0)smooth
compositionSE(3)×SE(3)SE(3) \times SE(3)SE(3)SE(3)(P(q1⊗q2), p1+R1p2)(P(q_1 \otimes q_2),\ p_1 + R_1 p_2)smooth
inverseSE(3)SE(3)SE(3)SE(3)(P(qˉ), −R⊤p)(P(\bar q),\ -R\transpose p)smooth
relative motionSE(3)×SE(3)SE(3) \times SE(3)SE(3)SE(3)(P(qˉ1⊗q2), R1⊤(p2−p1))(P(\bar q_1 \otimes q_2),\ R_1\transpose (p_2 - p_1))smooth
action on a pointSE(3)×R3SE(3) \times \R^3R3\R^3Rx+pR x + psmooth
action on a directionSE(3)×R3SE(3) \times \R^3R3\R^3RxR xsmooth
inverse actionSE(3)×R3SE(3) \times \R^3R3\R^3R⊤(x−p)R\transpose (x - p)smooth
rotation, positionSE(3)SE(3)S3S^3, R3\R^3P(q)P(q), ppsmooth
from partsS3×R3S^3 \times \R^3SE(3)SE(3)(P(q),p)(P(q), p)smooth
matrixSE(3)SE(3)R4×4\R^{4 \times 4}(Rp01)\begin{pmatrix} R & p \\ 0 & 1 \end{pmatrix}smooth
adjointSE(3)SE(3)R6×6\R^{6 \times 6}(24)smooth
exponentialR6\R^6SE(3)SE(3)(25)removable
JacobiansR6\R^6R6×6\R^{6 \times 6}(27)removable
logarithmSE(3)SE(3)R6\R^6(26)removable
interpolationSE(3)×SE(3)×RSE(3) \times SE(3) \times \RSE(3)SE(3)(29)removable

From parts is a map from the product S3×R3S^3 \times \R^3 to the motion, and rotation, position the way back: they are the identity on storage, and a change of chart, whose derivative is diag⁡(I,R⊤)\operatorname{diag}(I, R\transpose) from the product’s chart to the motion’s, since the product’s coordinates (ϕ,ρ)(\phi, \rho) reach (q⊕ϕ, p+ρ)(q \oplus \phi,\ p + \rho), whose coordinates in the motion’s chart are (ϕ, R⊤ρ)(\phi,\ R\transpose \rho). The matrix is the homogeneous one, so that composition is its product and the action on a point is its product with (x,1)(x, 1).

The adjoint is the conjugation of the group’s Lie algebra, TExp⁡(ξ) T−1=Exp⁡(Ad⁡(T) ξ)T \Exp(\xi)\, T^{-1} = \Exp(\operatorname{Ad}(T)\, \xi), and carries a perturbation in the frame of the motion to the outer frame, T⊕ξ=(1⊕Ad⁡(T) ξ) T+O(∣ξ∣2)T \oplus \xi = (1 \oplus \operatorname{Ad}(T)\, \xi)\, T + O(\lvert \xi \rvert^2); in the order (ϕ,ρ)(\phi, \rho) it is

Ad⁡(q,p)=(R0[p]×RR),(24) \operatorname{Ad}(q, p) = \begin{pmatrix} R & 0 \\ [p]_\times R & R \end{pmatrix}, \tag{24}
(24)

which many references write with the blocks the other way about, their translation first. Unlike (6) on the rotations, the relation holds to first order only, since the chart is not the exponential.

The exponential is the motion at a constant body twist (ϕ,ρ)(\phi, \rho), rotating at the rate ϕ\phi while translating at the body velocity ρ\rho, for unit time, and the logarithm its inverse:

Exp⁡(ϕ,ρ)=(Exp⁡ϕ, Jl(ϕ) ρ),(25) \Exp(\phi, \rho) = \bigl(\Exp \phi,\ J_l(\phi)\, \rho\bigr), \tag{25}
(25)
Log⁡(q,p)=(ϕ, Jl(ϕ)−1p),ϕ=Log⁡q,(26) \Log(q, p) = \bigl(\phi,\ J_l(\phi)^{-1} p\bigr), \qquad \phi = \Log q, \tag{26}
(26)

the logarithm defined for q≠−1q \ne -1, with JlJ_l and its inverse of (12) and (13), whose series serve here too. The motions’ Jacobians, with Exp⁡(ξ+ε)=Exp⁡(Jl(ξ) ε) Exp⁡(ξ)=Exp⁡(ξ) Exp⁡(Jr(ξ) ε)\Exp(\xi + \varepsilon) = \Exp(\mathcal J_l(\xi)\, \varepsilon)\, \Exp(\xi) = \Exp(\xi)\, \Exp(\mathcal J_r(\xi)\, \varepsilon) to first order, are in the order (ϕ,ρ)(\phi, \rho)

Jl(ϕ,ρ)=(Jl(ϕ)0Q(ϕ,ρ)Jl(ϕ)),Jr(ϕ,ρ)=Jl(−ϕ,−ρ),Jl−1=(Jl−10−Jl−1Q Jl−1Jl−1),(27) \mathcal J_l(\phi, \rho) = \begin{pmatrix} J_l(\phi) & 0 \\ Q(\phi, \rho) & J_l(\phi) \end{pmatrix}, \qquad \mathcal J_r(\phi, \rho) = \mathcal J_l(-\phi, -\rho), \qquad \mathcal J_l^{-1} = \begin{pmatrix} J_l^{-1} & 0 \\ -J_l^{-1} Q\, J_l^{-1} & J_l^{-1} \end{pmatrix}, \tag{27}
(27)

with Φ=[ϕ]×\Phi = [\phi]_\times, Ψ=[ρ]×\Psi = [\rho]_\times and

Q(ϕ,ρ)=12Ψ+B (ΦΨ+ΨΦ+ΦΨΦ)+D (Φ2Ψ+ΨΦ2−3 ΦΨΦ)+E (ΦΨΦ2+Φ2ΨΦ),D=θ2+2cos⁡θ−22θ4,E=2θ−3sin⁡θ+θcos⁡θ2θ5,(28) Q(\phi, \rho) = \tfrac12 \Psi + B\, (\Phi \Psi + \Psi \Phi + \Phi \Psi \Phi) + D\, (\Phi^2 \Psi + \Psi \Phi^2 - 3\, \Phi \Psi \Phi) + E\, (\Phi \Psi \Phi^2 + \Phi^2 \Psi \Phi), \quad D = \frac{\theta^2 + 2 \cos \theta - 2}{2 \theta^4}, \quad E = \frac{2\theta - 3 \sin \theta + \theta \cos \theta}{2 \theta^5}, \tag{28}
(28)

BB the coefficient of (12). This is the block of the textbooks written translation first, moved below the diagonal by the order of the coordinates here. Its coefficients are smooth with removable singularities at θ=0\theta = 0, with the series

D=∑k(−1)kθ2k(2k+4)!=124−θ2720+⋯ ,E=∑k(−1)k(k+1) θ2k(2k+5)!=1120−θ22520+⋯ , D = \sum_k \frac{(-1)^k \theta^{2k}}{(2k+4)!} = \frac1{24} - \frac{\theta^2}{720} + \cdots, \qquad E = \sum_k \frac{(-1)^k (k+1)\, \theta^{2k}}{(2k+5)!} = \frac1{120} - \frac{\theta^2}{2520} + \cdots,

computed as the rotations’ are. By Proposition 14, Jr\mathcal J_r is the derivative of (25) that a pass computes, and like the rotations’ it is a map for the values a model computes with it. A pose moving at constant body rates (ω,v)(\omega, v) for a time Δt\Delta t moves from TkT_k to Tk+1=Tk Exp⁡(ω Δt, v Δt)T_{k+1} = T_k\, \Exp(\omega\, \Delta t,\ v\, \Delta t), exactly. With rv⁡\rv in place of Log⁡\Log, the logarithm is the motion’s along the shorter turn, a discretization at half-turns as on the rotations.

Two interpolations are in use, and both are offered:

T1 Exp⁡(tLog⁡(T1−1T2))and(q1⊗Exp⁡(tLog⁡(qˉ1⊗q2)), (1−t) p1+t p2).(29) T_1\, \Exp\bigl(t \Log(T_1^{-1} T_2)\bigr) \qquad\text{and}\qquad \bigl(q_1 \otimes \Exp(t \Log(\bar q_1 \otimes q_2)),\ (1 - t)\, p_1 + t\, p_2\bigr) . \tag{29}
(29)

The first is the screw motion at a constant twist, the one-parameter subgroup through T1−1T2T_1^{-1} T_2 carried to T1T_1, and the second interpolates the rotation along its geodesic and the position along a straight line, the geodesic of the product. Each comes, like (15), with rv⁡\rv in place of Log⁡\Log for the shorter turn.

The extended poses have the same maps with the velocity carried as the position is: the composition (P(q1⊗q2), v1+R1v2, p1+R1p2)(P(q_1 \otimes q_2),\ v_1 + R_1 v_2,\ p_1 + R_1 p_2), the inverse (P(qˉ), −R⊤v, −R⊤p)(P(\bar q),\ -R\transpose v,\ -R\transpose p), the relative motion likewise, the parts and the pose (q,p)(q, p) among them, the 5×55 \times 5 matrix with the columns (R,v,p)(R, v, p) over (010001)\begin{pmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix}, the exponential (Exp⁡ϕ, Jl(ϕ) η, Jl(ϕ) ρ)(\Exp \phi,\ J_l(\phi)\, \eta,\ J_l(\phi)\, \rho) and its logarithm, the left Jacobian with the blocks Jl(ϕ)J_l(\phi) on its diagonal and Q(ϕ,η)Q(\phi, \eta) and Q(ϕ,ρ)Q(\phi, \rho) below it in its first column, and in the order (ϕ,η,ρ)(\phi, \eta, \rho) the adjoint

Ad⁡(q,v,p)=(R00[v]×RR0[p]×R0R).(30) \operatorname{Ad}(q, v, p) = \begin{pmatrix} R & 0 & 0 \\ [v]_\times R & R & 0 \\ [p]_\times R & 0 & R \end{pmatrix} . \tag{30}
(30)

Their action on points is that of their pose. An inertial unit’s step, which turns the attitude by its rate, adds the rotated specific force and a gravity to the velocity, and the velocity to the position, is a composite of these maps that the model writes with its own gravity, since no frame of the earth is assumed.

The normal on these types#

Every chart of this document is global and full with a declared volume, so the normal applies as its mathematics defines it, its density and its sampler exact. The figures its Properties state for a chart follow from the log-volume, whose negative is 316∣v∣2+O(∣v∣4)\tfrac{3}{16} \lvert \tangent \rvert^2 + O(\lvert \tangent \rvert^4), with the Hessian 38I\tfrac38 I:

  • a measurement of a rotation weighs on the state as a Gaussian of its residual would with the precision Λ−38I\Lambda - \tfrac38 I on the rotation’s block, a change of 0.4 %0.4\,\% for a noise of 0.10.1 rad;
  • the mean is a mode of the density when σ2<83\sigma^2 < \tfrac83, a standard deviation under 1.61.6 rad;
  • Gauss–Newton with the log-volume’s gradient converges at a rate within κ=38σ2\kappa = \tfrac38 \sigma^2 of the residuals’ own.

The expected information of the normal’s root is exact in the scale’s block and of second order in the blocks of the point and the mean, as on any curved type.

What the tests check#

  • The types’ boundaries: the core’s check of an embedded type on S3S^3, SE(3)SE(3) and SE2(3)SE_2(3), with each declared volume checked against the area formula.
  • The chart: Proposition 5’s inverse on the whole image, the angle 4arctan⁡(∣v∣/4)4 \arctan(\lvert \tangent \rvert / 4), the first-order rotation vector against (2), and (6).
  • The groups: associativity, identities and inverses of the compositions, and the relative rotations and motions against them; π\pi a homomorphism, the same at qq and −q-q; the actions homomorphisms, the inverse actions their inverses; the homogeneous matrices homomorphisms; hat and vee inverse on skew matrices; the adjoints against TExp⁡(ξ) T−1=Exp⁡(Ad⁡(T) ξ)T \Exp(\xi)\, T^{-1} = \Exp(\operatorname{Ad}(T)\, \xi), and (24) against the first-order relation with the chart.
  • The exponentials and logarithms: each logarithm the inverse of its exponential on the ball of radius 2π2\pi, and rv⁡\rv against Log⁡\Log on either side of a half-turn; the Jacobians against Proposition 14, as the derivative of Exp⁡\Exp computed by a pass, on the rotations and on both motions, and their inverses by multiplication; every coefficient of Removable singularities, and DD and EE, against its closed form, in extended precision, on both sides of its cutoff, at both precisions, with first and second derivatives at the identity checked against the series’.
  • The constructions: (17) carrying aa to bb; Proposition 19 by round trips through (18) for all twelve sequences, intrinsic and extrinsic, away from the lock and the wrap, and at the lock the convention γ=0\gamma = 0 reproducing the rotation, on rows exactly at it and within the threshold of it; (22) returning ±q\pm q from π(q)\pi(q) in each of its four branches; alignment and the interpolations at their endpoints and at a constant rate.
  • The discretizations: each one’s value on both sides of its jump, and its derivatives those of the formula selected, finite where the core’s passes are taken; at the wrap of the Euler angles, values 2π2\pi apart on either side and derivatives that agree across it, with the angles’ finite differences checked only at rows farther from the wrap than their step; and (21) continuous across the wrap of either angle.
  • The normal: its density integrating to one through the chart of S3S^3 and of SE(3)SE(3), its draws agreeing with quadratures, and Proposition 8’s law on the rotations, by quadrature over SO(3)SO(3) of p(q)+p(−q)\density(q) + \density(-q).

The core’s acceptance test stays where it is, on the sphere its tests declare. That sphere is to be replaced by the library’s own spheres when an entry brings them; this entry does not revise the core.

In skoro’s terms#

  • Three embedded types, declared from the core’s public interface: the unit quaternions, of storage 44 and dimension 33; the rigid motions, 77 and 66; the extended poses, 1010 and 99. Each declares its retraction, inverse and projection as composites, and a global volume, the log-volume of its rotation’s chart.
  • Their tangent coordinates are the rotation vector in the body frame, then the translation, and for the extended pose the velocity before the position, in the body frame; every adjoint and Jacobian is written in that order.
  • Their maps are composites of the core’s primitives and selection: the groups’ operations, with compositions and inverses into the types by projection; actions, matrices, adjoints and the rotations’ and the motions’ Jacobians into Euclidean values; exponentials into the types and logarithms out of them; the interpolations and the angle; and the constructions from and to axes and angles, pairs of directions, Euler angles and matrices. Each is smooth, smooth with a removable singularity computed by series, or a stated discretization.
  • Their derivatives are the passes’ over those composites, and are the textbooks’ Jacobians, by Proposition 14; no derivative is written by hand.
  • A quantity of these types may be scored by the normal, observed and simulated; an observed quaternion is aligned with its prediction by its caller. A pose with its noise in a fixed frame is a quantity of the product S3×R3S^3 \times \R^3.
  • No earth frame is assumed: a frame is a rotation or a motion the user composes, and a gravity a constant the user’s model holds.

Open questions#

None remain.

Revisions#

2026-11-03. Reopened after the build: the Euler angles are said to be smooth away from gimbal lock, but returning α\alpha and γ\gamma to (−π,π](-\pi, \pi] makes them jump by 2π2\pi wherever either crosses ±π\pm\pi, which the derivative checks found at the half-turns about the coordinate axes. This revision treats the Euler angles at all of their singularities. A new proposition, Proposition 20, shows that neither singularity can be removed: a real-valued angle must be cut somewhere, and at the lock no convention is continuous. The text now says that the wrap is a jump of the value alone, the derivatives agreeing across it; gives the residual on the circle, (21), by which a model compares angles across the wrap or keeps them continuous along a path; bounds what the lock’s threshold costs, and so how it is chosen; and says how the angles’ derivatives and their rounding grow near the lock. The tests check the wrap and the residual, and the lock within its threshold as well as exactly at it.

Built on by