skoro v0.0.0

Mathematics

A unit quaternion names a rotation twice, and the stereographic chart of the unit quaternions tells the two names apart, so that a measurement given with the wrong sign is misread; the rotations, the rigid motions and the extended poses become the groups themselves, stored as quaternions up to sign under the Cayley chart, which cannot tell the signs apart, and the core learns to declare a type stored up to a finite group.

Updated 2026-11-14 · 22 min read

The problem#

skoro holds a rotation as a unit quaternion, and the unit quaternions cover the rotations twice: qq and −q-q are one rotation and two points of S3S^3. The type skoro declares is S3S^3 itself, with the stereographic chart, and that chart tells the two apart, so the rotations’ mathematics asks the caller to give an observed quaternion the sign of its prediction before it is observed, by aligning it on the host. One given with the other sign is not refused. Its residual is the coordinate of a point beside the one point the chart at the prediction cannot reach, of length at least 44, and growing without bound as the estimate improves.

Nothing in a model’s data can give the right sign, because the right sign is not a property of the measurement. It is set by the prediction, and the prediction’s sign by the signs of the estimated states it is computed from, which are themselves whatever the estimate’s history made them. A robot that drives one loop and closes it shows the difficulty at its plainest: its odometry, composed from the start, turns its heading through 2π2\pi, and the composed quaternion at the end is near −1-1, while the loop closure measures a relative rotation near the identity, whose quaternion a file or a program, given the choice, writes with w>0w > 0. At states composed from the odometry, that loop closure is on the far side of its prediction. At states read from a file, whose signs are as arbitrary as the measurements’, the far side falls on whichever edges the signs put it; but, as In a cycle shows, the cycle as a whole cannot be satisfied with every measurement as given, wherever the states start. Both of skoro’s examples draw their measurements from the model, so their signs are right by construction, and this path has not met outside data.

The sign carries no information about the world: a sensor or a file measured a rotation, and the quaternion is one of its two names. The trouble is that skoro’s type is the cover rather than the group. This entry works out what a misaligned quaternion does under the present chart, and then makes the types the groups themselves: SO(3)SO(3), SE(3)SE(3) and SE2(3)SE_2(3), still stored as quaternions, with the Cayley chart, whose coordinates are the same for qq and −q-q. A stored quaternion is then a representative of its rotation, either sign as good as the other, and nothing in a model needs to align one. The core’s embedded types are submanifolds of their storage, which the rotations stored as quaternions cannot be, so the core learns to declare a type stored up to a finite group. Last, it works out how a measurement given in the format of g2o, the usual source of pose-graph datasets, becomes one of skoro’s.

Setting#

The unit quaternions S3S^3, their product ⊗\otimes, the covering map π:S3→SO(3)\pi : S^3 \to SO(3) with π(q)=π(−q)\pi(q) = \pi(-q), the stereographic chart (4) with its inverse, and its volume are those of the rotations’ mathematics. Writing μˉ⊗q=(w,u)\bar \mu \otimes q = (w, u), the stereographic coordinate of qq at μ\mu is 4u/(1+w)4u / (1 + w), of length 4tan⁡(θ/4)4 \tan(\theta / 4) for θ∈[0,2π)\theta \in [0, 2\pi) the angle of μˉ⊗q\bar \mu \otimes q on S3S^3’s scale, and its chart at μ\mu is a diffeomorphism of R3\R^3 onto S3∖{−μ}S^3 \setminus \{-\mu\}. The rigid motions and the extended poses are stored as (q,p)(q, p) and (q,v,p)(q, v, p), with the charts of Proposition 23, whose inverse at (q,p)(q, p) is

(q′,p′)⊖(q,p)=(q′⊖q, π(q)⊤(p′−p)), (q', p') \ominus (q, p) = \bigl(q' \ominus q,\ \pi(q)\transpose (p' - p)\bigr) ,

the rotation’s coordinate first, then the rest, each in the frame of the point. A tuple of vectors, such as (vR,vT)(\tangent_R, \tangent_T), is the column vector with its entries stacked. For a point of any of the three, −q-q is the point whose quaternion is negated and whose other coordinates are kept; it is the same rotation, motion or extended pose.

The normal N(μ,Σ)\mathcal N(\mu, \Sigma) is that of its mathematics, with the precision Λ=Σ−1=W⊤W\Lambda = \Sigma^{-1} = W\transpose W, its residual x⊖μ\point \ominus \mu, and the density with respect to the measure ν\nu the chart normalizes,

pμ(x)=det⁡W(2π)d/2exp⁡(−12∣W(x⊖μ)∣2)e−λ(x⊖μ),(1) \density_\mu(\point) = \frac{\det W}{(2\pi)^{\dimension / 2}} \exp\Bigl(-\tfrac12 \bigl\lvert W (\point \ominus \mu) \bigr\rvert^2\Bigr) e^{-\lambda(\point \ominus \mu)} , \tag{1}
(1)

with λ\lambda the chart’s log-volume, −3log⁡(1+∣vR∣2/16)-3 \log(1 + \lvert \tangent_R \rvert^2 / 16) for the stereographic chart. A measurement zz of a state x\point is predicted by a map h(x)h(\point), such as the relative motion h(x)=Xi−1Xjh(\point) = X_i^{-1} X_j of a pose graph, whose quaternion is qˉi⊗qj\bar q_i \otimes q_j.

The antipode in the stereographic chart#

Everything about the sign follows from where the chart at μ\mu puts the two points over one rotation.

Proposition 2(The antipode in the stereographic chart).

Let μ,q∈S3\mu, q \in S^3 with q≠±μq \neq \pm\mu, and let v=q⊖μ\tangent = q \ominus \mu in the chart of (4). Then

(−q)⊖μ=q⊖(−μ)=−16∣v∣2 v, (-q) \ominus \mu = q \ominus (-\mu) = -\frac{16}{\lvert \tangent \rvert^2}\, \tangent ,

and ∣v∣<4\lvert \tangent \rvert < 4 exactly when ⟨q,μ⟩>0\langle q, \mu \rangle > 0. Of the two points ±q\pm q over one rotation, the one on the side of μ\mu has the coordinate of length 4tan⁡(θ/4)≤44 \tan(\theta / 4) \le 4, with θ∈[0,π]\theta \in [0, \pi] the angle between the rotations π(q)\pi(q) and π(μ)\pi(\mu), and the other the coordinate of length 16/(4tan⁡(θ/4))≥416 / (4 \tan(\theta/4)) \ge 4 in the opposite direction.

Proof.

Write μˉ⊗q=(w,u)\bar\mu \otimes q = (w, u), so that v=4u/(1+w)\tangent = 4u / (1 + w) and, since ∣u∣2=1−w2\lvert u \rvert^2 = 1 - w^2,

∣v∣2=16∣u∣2(1+w)2=16(1−w)1+w, \lvert \tangent \rvert^2 = \frac{16 \lvert u \rvert^2}{(1 + w)^2} = \frac{16 (1 - w)}{1 + w} ,

which is below 1616 exactly when w=⟨q,μ⟩>0w = \langle q, \mu \rangle > 0. Both μˉ⊗(−q)\bar\mu \otimes (-q) and (−μ)‾⊗q\overline{(-\mu)} \otimes q are (−w,−u)(-w, -u), whose coordinate is −4u/(1−w)-4u / (1 - w), and

−16∣v∣2 v=−(1+w)(1−w)⋅4u1+w=−4u1−w. -\frac{16}{\lvert \tangent \rvert^2}\, \tangent = -\frac{(1 + w)}{(1 - w)} \cdot \frac{4u}{1 + w} = -\frac{4u}{1 - w} .

The lengths follow from Proposition 5: the point on the side of μ\mu is at the angle θ∈[0,π]\theta \in [0, \pi] from μ\mu on S3S^3’s scale of angles, which is the angle between the rotations, and the other at 2π−θ2\pi - \theta, whose coordinate has the length 4tan⁡(π/2−θ/4)=4cot⁡(θ/4)4 \tan(\pi/2 - \theta/4) = 4 \cot(\theta/4).

∎

So the map from one sign to the other is the inversion in the sphere of radius 44 followed by negation. The ball of radius 44 is the chart of the near sides, one point for each rotation within less than a half-turn of π(μ)\pi(\mu), and its complement the far sides; the sphere of radius 44 itself holds the points orthogonal to μ\mu, the half-turns, where the two signs have coordinates v\tangent and −v-\tangent of equal length. This sharpens the third claim of Proposition 8, that the two lengths multiply to 1616.

What a misaligned measurement does#

Let zz be a measured rotation given with the sign on the far side of its prediction, so that the point on the near side is −z-z, at the angle φ∈[0,π]\varphi \in [0, \pi] from π(h(x))\pi(h(\point)). Its residual has the length 4cot⁡(φ/4)4 \cot(\varphi/4), which grows without bound as φ→0\varphi \to 0: the term is least likely exactly where the estimate is right. For a concentrated normal, with σ2<83\sigma^2 < \tfrac83, its density (1) increases with φ\varphi, and its maximum is at h(x)=zh(\point) = z, the measured rotation on the other sheet, which the estimate reaches from where it is only by turning through the remaining 2π−φ2\pi - \varphi.

Against Gauss–Newton. Along the geodesic from h(x)h(\point) to zz, let θ=2π−φ\theta = 2\pi - \varphi be the angle that remains, so that the residual is r(θ)=4tan⁡(θ/4)r(\theta) = 4 \tan(\theta / 4). A Gauss–Newton step on this residual alone changes θ\theta by

−r(θ)r′(θ)=−4tan⁡θ4cos⁡2θ4=−2sin⁡θ2=−2sin⁡φ2, -\frac{r(\theta)}{r'(\theta)} = -4 \tan\frac\theta4 \cos^2 \frac\theta4 = -2 \sin\frac\theta2 = -2 \sin\frac\varphi2 ,

so that φ\varphi becomes φ+2sin⁡(φ/2)\varphi + 2 \sin(\varphi/2), about 2φ2\varphi: each step doubles the error. Its weight in the normal equations, r′(θ)2/σ2=σ−2sin⁡−4(φ/4)r'(\theta)^2 / \sigma^2 = \sigma^{-2} \sin^{-4}(\varphi / 4), is about 256/(σ2φ4)256 / (\sigma^2 \varphi^4), which overwhelms the weight of every correctly given measurement once the estimate is close. A misaligned measurement is not an outlier that the others outvote; near the right answer it is the term that decides the step, and it steps away.

In a cycle. In a pose graph the misalignment of one measurement is the misalignment of a cycle. Take the loop of The problem with every rotation about one axis, so that the quaternions of the states are (cos⁡(ϕk/2),sin⁡(ϕk/2) e3)(\cos(\phi_k / 2), \sin(\phi_k / 2)\, e_3) and angles add on S3S^3 as they do on the line, modulo 4π4\pi. Let the nn odometry measurements turn by α1,…,αn\alpha_1, \dots, \alpha_n, with ∑kαk=2π\sum_k \alpha_k = 2\pi, and the loop closure by β=0\beta = 0, each given with w>0w > 0. The residual angles θe\theta_e of the n+1n + 1 edges, each in (−2π,2π)(-2\pi, 2\pi), telescope around the cycle:

∑eθe≡∑kαk+β=2π(mod4π). \sum_e \theta_e \equiv \sum_k \alpha_k + \beta = 2\pi \pmod{4\pi} .

No estimate makes every residual zero. With equal noise σ\sigma on every edge, the cost of an edge is 8σ−2tan⁡2(θ/4)+6log⁡cos⁡(θ/4)8 \sigma^{-2} \tan^2(\theta / 4) + 6 \log \cos(\theta / 4), the negative logarithm of (1) up to a constant, whose second derivative is at least σ−2sec⁡4(θ/4)−38sec⁡2(θ/4)\sigma^{-2} \sec^4(\theta/4) - \tfrac38 \sec^2(\theta/4), positive when σ2<83\sigma^2 < \tfrac83. The cost is then strictly convex, and the least total cost under the constraint spreads the turn evenly: every edge is wrong by 2π/(n+1)2\pi / (n + 1). On a loop of a hundred edges that is 3.6°3.6° an edge, a trajectory that looks plausible and has an extra full turn of heading wound into it. Had the loop closure been given as −z-z, with β=2π\beta = 2\pi, the sum would be 00 modulo 4π4\pi and every residual could vanish.

So a measured rotation’s sign is a choice, for each cycle it closes, of whether the estimate winds once more around it. Choosing the sign on the near side of a prediction chooses the winding of the estimate the prediction was computed at, which unwinds the drift the shorter way.

A chart that cannot tell the signs apart#

The stereographic chart is a chart of S3S^3, and every chart of S3S^3 must tell qq from −q-q, since they are different points of it. A chart of SO(3)SO(3) must not, and the Cayley chart, already in the note’s table as a global and full chart of the rotations, is written on quaternions as the familiar first-order update, normalized.

Proposition 3(The Cayley chart on the unit quaternions).

For q∈S3q \in S^3 and v∈R3\tangent \in \R^3, let

q⊕v=q⊗γ(v),γ(v)=(1, v/2)1+∣v∣2/4,p⊖q=2vec⁡(qˉ⊗p)w(qˉ⊗p)(w(qˉ⊗p)≠0). q \oplus \tangent = q \otimes \gamma(\tangent), \qquad \gamma(\tangent) = \frac{(1,\ \tangent / 2)}{\sqrt{1 + \lvert \tangent \rvert^2 / 4}} , \qquad p \ominus q = \frac{2 \operatorname{vec}(\bar q \otimes p)}{w(\bar q \otimes p)} \quad \bigl(w(\bar q \otimes p) \ne 0\bigr) .

Then (−q)⊕v=−(q⊕v)(-q) \oplus \tangent = -(q \oplus \tangent), and p⊖qp \ominus q is unchanged when either pp or qq is negated. The map v↦π(q⊕v)\tangent \mapsto \pi(q \oplus \tangent) is a diffeomorphism of R3\R^3 onto the rotations by less than π\pi from π(q)\pi(q), with inverse R↦p⊖qR \mapsto p \ominus q for either pp over RR; γ(v)\gamma(\tangent) is the rotation by θ=2arctan⁡(∣v∣/2)\theta = 2 \arctan(\lvert \tangent \rvert / 2) about v\tangent; π(q⊕v)=π(q) (I+[v]×)+O(∣v∣2)\pi(q \oplus \tangent) = \pi(q)\, (I + [\tangent]_\times) + O(\lvert \tangent \rvert^2); and q⊕v=(1⊕π(q) v)⊗qq \oplus \tangent = (1 \oplus \pi(q)\, \tangent) \otimes q.

Proof.

The norm of (1,v/2)(1, \tangent / 2) is 1+∣v∣2/4\sqrt{1 + \lvert \tangent \rvert^2 / 4}, so γ(v)∈S3\gamma(\tangent) \in S^3, with w(γ)>0w(\gamma) > 0 and ∣vec⁡(γ)∣/w(γ)=∣v∣/2\lvert \operatorname{vec}(\gamma) \rvert / w(\gamma) = \lvert \tangent \rvert / 2; it is the rotation by θ\theta about v\tangent with tan⁡(θ/2)=∣v∣/2\tan(\theta / 2) = \lvert \tangent \rvert / 2, so θ∈[0,π)\theta \in [0, \pi), every such rotation once. Negating qq negates q⊗γq \otimes \gamma. Negating pp or qq negates qˉ⊗p\bar q \otimes p, whose vec⁡\operatorname{vec} and ww change sign together, so their ratio does not. For p=q⊗γ(v)p = q \otimes \gamma(\tangent), qˉ⊗p=γ(v)\bar q \otimes p = \gamma(\tangent) and 2vec⁡(γ)/w(γ)=v2 \operatorname{vec}(\gamma) / w(\gamma) = \tangent; and every rotation by less than π\pi from π(q)\pi(q) is π(q⊗δ)\pi(q \otimes \delta) for a δ\delta with w(δ)>0w(\delta) > 0, which is γ\gamma of 2vec⁡(δ)/w(δ)2 \operatorname{vec}(\delta) / w(\delta). The first-order form and the last identity follow as for the stereographic chart (Proposition 5 and (6)): γ(v)=(1,v/2)+O(∣v∣2)\gamma(\tangent) = (1, \tangent / 2) + O(\lvert \tangent \rvert^2), and γ\gamma depends on v\tangent only through its direction and its length.

∎

The chart’s coordinate of a rotation by θ\theta has the length

2tan⁡(θ/2)=θ+θ3/12+O(θ5). 2 \tan(\theta / 2) = \theta + \theta^3 / 12 + O(\theta^5) .

Its volume against the Haar measure of SO(3)SO(3) normalized at the chart’s centre is

λ(v)=−2log⁡(1+14∣v∣2),(4) \lambda(\tangent) = -2 \log\bigl(1 + \tfrac14 \lvert \tangent \rvert^2\bigr) , \tag{4}
(4)

by the note, whose derivation in the exponential chart is the same for a quaternion as for a matrix. Every coordinate the chart computes at μ\mu is that of the rotation, whichever sign either quaternion is given in.

Built from the primitives. The core’s primitives take reciprocals only of positive numbers, as e−log⁡ae^{-\log a}, and w(qˉ⊗p)w(\bar q \otimes p) is negative on the far hemisphere, which is now a value a model may be given. The inverse is therefore computed as

p⊖q=2 w vec⁡(qˉ⊗p)w2,w=w(qˉ⊗p),1w2=e−log⁡w2,(5) p \ominus q = \frac{2\, w\, \operatorname{vec}(\bar q \otimes p)}{w^2}, \qquad w = w(\bar q \otimes p), \qquad \frac{1}{w^2} = e^{-\log w^2} , \tag{5}
(5)

whose numerator and denominator are each even in the sign of pp and of qq, and whose reciprocal is of a positive number wherever the inverse is defined. The retraction’s normalization is the reciprocal of 1+∣v∣2/4≥1\sqrt{1 + \lvert \tangent \rvert^2 / 4} \ge 1, and the log-volume is a logarithm of a number at least 11; both are composites as written.

The half-turns. The chart misses, at each μ\mu, the rotations a half-turn from it: not one point, as the stereographic chart missed −μ-\mu, but a surface, the rotations by π\pi about every axis, composed with μ\mu. It has measure zero and no draw reaches it, which is all fullness asks. A given value can: a measurement exactly a half-turn from its prediction, a state initialized at the identity against a prior whose mean is a half-turn, a sensor’s mounting given exactly upside down as a measurement of it. There w=0w = 0, (5) is non-finite, and the term is too; near it the residual is large, its Gauss–Newton weight grows like sec⁡4(φ/2)\sec^4(\varphi / 2), and the step below crawls. The stereographic chart was finite at every half-turn, its coordinate of length 44 there, and missed only the antipode −μ-\mu, the point a sign error lands on. So the change trades a cut that a common mistake reaches, invisibly, for a cut that only a value a half-turn from its mean reaches, where a non-finite term says so. A half-turn between a value and its mean is itself an error of the largest size a rotation can have, so the cut costs a model nothing at an estimate that fits its data; it is a fact about the start, and an estimate is started away from it. The term is left non-finite there: a finite residual selected at the cut would let an evaluation at a bad start succeed only by hiding an error of a half-turn, and refusing a model within some angle of the cut would need an angle that no model’s noise sets.

What it does to a measurement. Read under the Cayley chart, a measured rotation has one residual, of length 2tan⁡(φ/2)2 \tan(\varphi / 2) for φ∈[0,π)\varphi \in [0, \pi) the angle between the measured and the predicted rotations, and none of What a misaligned measurement does can happen. The residual is unbounded as the prediction nears a half-turn from the measurement, a real error of a half-turn rather than a mistaken sign, and there it attracts rather than repels: a Gauss–Newton step on r(φ)=2tan⁡(φ/2)r(\varphi) = 2 \tan(\varphi / 2) alone changes φ\varphi by

−r(φ)r′(φ)=−2tan⁡φ2cos⁡2φ2=−sin⁡φ, -\frac{r(\varphi)}{r'(\varphi)} = -2 \tan\frac\varphi2 \cos^2 \frac\varphi2 = -\sin \varphi ,

toward 00, if slowly near π\pi. In the cycle of the one-turn loop, the residual angles are rotation angles, in (−π,π)(-\pi, \pi), and add modulo 2π2\pi,

∑eθe≡∑kαk+β=2π≡0(mod2π), \sum_e \theta_e \equiv \sum_k \alpha_k + \beta = 2\pi \equiv 0 \pmod{2\pi} ,

so every residual can vanish: the winding that the stereographic chart forced on the estimate is no longer a property of any point of the type.

A type stored up to a group#

The Cayley chart is not a chart of S3S^3, and the core cannot declare it as one. Its retraction and inverse meet every condition of Proposition 3 on X=S3\manifold = S^3: R(q,0)=qR(q, 0) = q, RR stays on S3S^3, its derivative B(q)=q⊗(0,12I)B(q) = q \otimes (0, \tfrac12 I) has rank 33, and Q(q,R(q,v))=vQ(q, R(q, \tangent)) = \tangent. The derivative maps that statement gives are therefore right as they stand. What fails is what the core’s measures ask of a type with a volume. On S3S^3, the chart at μ\mu reaches only the open hemisphere ⟨q,μ⟩>0\langle q, \mu \rangle > 0, so it is not full, and Q(μ,⋅)Q(\mu, \cdot), finite on the other hemisphere, is not the inverse of the chart there; it is exactly the chart that measures’ decision Only full charts declare a volume refuses, because a density read at a point it does not reach would be silently wrong. Read on the rotations instead, the chart is full and QQ is right everywhere, since the point QQ reads on the far hemisphere is the same rotation as its antipode on the near one. The type is SO(3)SO(3), and S3S^3 is how it is stored.

Stored as quaternions, SO(3)SO(3) is not a submanifold of its storage: each rotation is stored at two points of R4\R^4, qq and −q-q, so the storage is not the inclusion of the type but a two-to-one cover of it. The core’s definition of an embedded type, a submanifold of its storage, has to admit a type whose storage covers it.

Proposition 6(A type stored up to a group).

Let X⊂Rn\manifold \subset \R^n, RR, QQ and PP be as in Proposition 3, and let GG be a finite group of linear maps of Rn\R^n that carry X\manifold onto itself and act on it freely, such that for every g∈Gg \in G, x,y∈X\point, \otherPoint \in \manifold and v\tangent,

R(gx,v)=g R(x,v),Q(gx,y)=Q(x,y)=Q(x,gy),P(gw)=g P(w), R(g \point, \tangent) = g\, R(\point, \tangent), \qquad Q(g \point, \otherPoint) = Q(\point, \otherPoint) = Q(\point, g \otherPoint), \qquad P(g w) = g\, P(w) ,

wherever either side is defined. Then N=X/GN = \manifold / G is a manifold of dimension d\dimension, the quotient map ϖ:X→N\varpi : \manifold \to N is a covering, and [x]⊕v=ϖ(R(x,v))[\point] \oplus \tangent = \varpi(R(\point, \tangent)) and [y]⊖[x]=Q(x,y)[\otherPoint] \ominus [\point] = Q(\point, \otherPoint) are a retraction on NN and its inverse, the same whichever representatives are taken. For a function ff on X\manifold invariant under GG, f=fˉ∘ϖf = \bar f \circ \varpi, the chart derivatives of ff at x\point through RR, of every order, are those of fˉ\bar f at [x][\point] through the retraction on NN, and are the same at every representative gxg \point.

Proof.

A finite group acting freely by diffeomorphisms acts properly discontinuously, so NN is a manifold and ϖ\varpi a covering, a local diffeomorphism. The retraction on NN is well defined, since

ϖ(R(gx,v))=ϖ(g R(x,v))=ϖ(R(x,v)); \varpi\bigl(R(g \point, \tangent)\bigr) = \varpi\bigl(g\, R(\point, \tangent)\bigr) = \varpi\bigl(R(\point, \tangent)\bigr) ;

it is smooth, the identity at v=0\tangent = 0, and of full rank there, since ϖ\varpi is a local diffeomorphism and RR meets the same conditions on X\manifold. The inverse is well defined by the two invariances of QQ, and inverts the retraction near 00 as QQ inverts RR. For the derivatives, as functions of v\tangent,

f(R(gx,v))=f(g R(x,v))=f(R(x,v)), f\bigl(R(g \point, \tangent)\bigr) = f\bigl(g\, R(\point, \tangent)\bigr) = f\bigl(R(\point, \tangent)\bigr) ,

and f∘R(x,⋅)=fˉ∘ϖ∘R(x,⋅)f \circ R(\point, \cdot) = \bar f \circ \varpi \circ R(\point, \cdot) is fˉ\bar f in the chart of NN at [x][\point].

∎

A chart volume is declared for such a type as Definition 3 declares one, with X\manifold read as NN: the measure is the one the retraction normalizes on NN; the domain, the image, globality and fullness are those of v↦[μ]⊕v\tangent \mapsto [\mu] \oplus \tangent in NN; and the log-volume Λ\Lambda is asked to be invariant, Λ(gμ,v)=Λ(μ,v)\Lambda(g \mu, \tangent) = \Lambda(\mu, \tangent). Since ϖ\varpi is a local diffeomorphism and the chart volume is local, the volume on NN is that of the chart on X\manifold wherever the chart is injective there, and a density on NN read at a stored point is the same at every representative, since it reads the point only through QQ and Λ\Lambda.

What a model may read. Everything the core computes from a quantity of such a type goes through RR, QQ, PP and Λ\Lambda, and is the same at every representative. Two things a model writes need not be. The inclusion ι\iota reads a stored point as its storage, which is a representative and not a function of the point of NN: on the rotations, the quaternion itself. A map out of the type written on the inclusion is a map of NN only if it is invariant under GG, as π(q)\pi(q), a rotated vector and the Cayley coordinate are, and the rotation vector of (10), of length up to 2π2\pi, is not. A map into the type, written on the inclusions and projected as (9) does, is a map of NN when it is equivariant, Fs(g1x1,…,gmxm)∈G Fs(x1,…,xm)F_{\mathrm s}(g_1 \point_1, \dots, g_m \point_m) \in G\, F_{\mathrm s}(\point_1, \dots, \point_m); the composition P(q1⊗q2)P(q_1 \otimes q_2) is, since (±q1)⊗(±q2)=±(q1⊗q2)(\pm q_1) \otimes (\pm q_2) = \pm (q_1 \otimes q_2). The core cannot check invariance, which is a property of a composite on all its inputs, any more than it checks that a type’s RR stays on X\manifold; a type’s entry says which of its maps are maps of NN, and its tests check them at both representatives.

Which representative a value carries is decided by how it was made, and matters to nothing that reads it as a point of NN. A retraction μ⊕v\mu \oplus \tangent is on the side of the stored μ\mu, ⟨μ⊕v,μ⟩>0\langle \mu \oplus \tangent, \mu \rangle > 0; a draw of the normal therefore carries its mean’s sign; a composition carries the product’s sign; and an observed or given value carries the sign it was given in.

Products. A product of types stored up to groups G1,…,GmG_1, \dots, G_m is stored up to their product, acting factor by factor, and meets the conditions of Proposition 6 when each factor does. Its chart, its volume and its normal are the product’s, with nothing to sum over: the charts are invariant already.

The rotations, the rigid motions and the extended poses#

The three types become the groups.

  • The rotations, SO(3)SO(3), stored as S3⊂R4S^3 \subset \R^4 up to G={±1}G = \{\pm 1\}, with the Cayley retraction and inverse of Proposition 3, the normalizing projection P(x)=x/∣x∣P(x) = x / \lvert x \rvert, and the log-volume (4). The retraction is equivariant and the inverse invariant by Proposition 3, P(−x)=−P(x)P(-x) = -P(x), and the log-volume reads v\tangent alone.
  • The rigid motions, SE(3)SE(3), stored as S3×R3S^3 \times \R^3 up to (q,p)↦(−q,p)(q, p) \mapsto (-q, p), with (q,p)⊕(ϕ,ρ)=(q⊕ϕ, p+π(q) ρ)(q, p) \oplus (\phi, \rho) = (q \oplus \phi,\ p + \pi(q)\, \rho) and its inverse (q′⊖q, π(q)⊤(p′−p))(q' \ominus q,\ \pi(q)\transpose (p' - p)), both meeting the conditions because π(−q)=π(q)\pi(-q) = \pi(q), and the log-volume of the rotation alone, against νSO(3)×\nu_{SO(3)} \times Lebesgue, a Haar measure by the argument of Proposition 23.
  • The extended poses, SE2(3)SE_2(3), stored as S3×R3×R3S^3 \times \R^3 \times \R^3 up to the same sign, likewise.

Each chart is global and full on its group: the rotation’s reaches every rotation by less than π\pi from the point’s, which is all of SO(3)SO(3) but the half-turns, a set of measure zero, and the translations’ are affine bijections. So the normal applies to them as its mathematics defines it, its density and its sampler exact, and its law is the law of the rotation. A normal’s term is the same whichever sign the value and the mean are given in, so an observed quaternion needs no alignment, and the sign of a state’s quaternion is a choice of representative that no term reads.

What the change of chart costs. The figures of the rotations’ normal on these types follow from the log-volume, whose negative is now 2log⁡(1+∣v∣2/4)=12∣v∣2+O(∣v∣4)2 \log(1 + \lvert \tangent \rvert^2 / 4) = \tfrac12 \lvert \tangent \rvert^2 + O(\lvert \tangent \rvert^4), with the Hessian II in place of 38I\tfrac38 I:

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

A broad normal is no better than before. Its draws go to the half-turns as its scale grows, since θ=2arctan⁡(∣ε∣/2)→π\theta = 2 \arctan(\lvert \varepsilon \rvert / 2) \to \pi, where the stereographic chart’s went to the far side of S3S^3, which as a rotation is the mean again; neither is a way to say that an attitude is unknown, which a uniform law will be. The coordinate is farther from the angle at third order, θ3/12\theta^3 / 12 against θ3/48\theta^3 / 48, which a model meets only through the log-volume’s curvature above. The double cover’s law on the rotations, p(q)+p(−q)\density(q) + \density(-q), and its mirrored modes, are gone: a normal on SO(3)SO(3) is a law on SO(3)SO(3) already.

The maps of the rotations. Every map of the rotations’ mathematics that reads the rotation through π\pi or through a composition stays as it is: the group operations and the actions, the matrices and the adjoints, the exponential into the type, the Jacobians, the rotation vector of the shorter turn, the angle between two rotations, the shorter interpolation, and the constructions into the type, whose sign was a choice anyway. The Euler angles are among them: their half-angles, each an atan2⁡\operatorname{atan2} of a coordinate and ww, change by π\pi when qq is negated, and the angles, their sums and differences returned to (−π,π](-\pi, \pi], do not. Alignment is too: it returns the same rotation, on the side of its reference, so as a map of SO(3)SO(3) it is the identity, choosing a representative and nothing else.

Three read the representative, and are maps of S3S^3 rather than of SO(3)SO(3): the logarithm with its length in [0,2π)[0, 2\pi), the axis and angle with the angle in [0,2π)[0, 2\pi), and the interpolation by the arc that avoids −q-q. For a rotation by θ\theta about aa, the first two give θa\theta a at qq and (2π−θ)(−a)(2\pi - \theta)(-a) at −q-q, two names of one rotation, and the third takes one of the two arcs between two rotations according to their signs. It is their conventions that read the sign, not what they compute. The rotations remove them, and their counterparts on SO(3)SO(3) take their names:

  • the logarithm is the rotation vector of the shorter turn, of length in [0,π][0, \pi], (11), a discretization at the half-turns, where the two turns are equally short;
  • the axis and angle are that vector’s direction and length, the angle in [0,π][0, \pi]; the axis is a convention at the identity, as it was, and at a half-turn, where aa and −a-a name one rotation, a discretization of the vector’s;
  • the interpolation is the shorter one, q1⊗Exp⁡(t rv⁡(qˉ1⊗q2))q_1 \otimes \Exp(t\, \rv(\bar q_1 \otimes q_2)), a discretization where the two rotations are a half-turn apart.

The inclusion, which reads the stored quaternion itself, is the core’s boundary and stays: every map above is a composite written on it. The rotations offer no map that returns it. A quaternion read out of a model, to report or to hand to another program, is the representative with w≥0w \ge 0, the alignment with the identity, which is a map of SO(3)SO(3) with a discretization at the half-turns from the identity, where w=0w = 0.

Measurements as g2o gives them#

The pose-graph datasets of the literature are files in the format of the g2o library, whose 3D lines are

VERTEX_SE3:QUAT i  x y z  qx qy qz qw
EDGE_SE3:QUAT   i j  x y z  qx qy qz qw  Ω₁₁ Ω₁₂ … Ω₁₆ Ω₂₂ … Ω₆₆

a vertex’s initial pose and an edge’s measurement ZZ of Xi−1XjX_i^{-1} X_j, each a translation and a quaternion with ww last, followed by the upper triangle of the edge’s 6×66 \times 6 information matrix Ω\Omega, row by row. As g2o’s source reads and scores these lines (EdgeSE3::read and EdgeSE3::computeError, read on its master branch on 2026-11-11), the quaternion is normalized on reading and its sign kept, and the error is

e=( t(Δ), vec⁡(sΔ q(Δ))),Δ=Z−1Xi−1Xj,(7) e = \bigl(\, t(\Delta),\ \operatorname{vec}\bigl(s_\Delta\, q(\Delta)\bigr) \bigr), \qquad \Delta = Z^{-1} X_i^{-1} X_j , \tag{7}
(7)

the translation of Δ\Delta followed by the vector part of its quaternion, read off its rotation matrix and given the sign sΔs_\Delta that makes w≥0w \ge 0. The information matrix is that of ee, in this order. The vertex’s increment is applied on the right, in the frame of the pose, as skoro’s chart applies it.

The same cut, the same blindness to sign. g2o’s error reads the measurement through the matrix of Δ\Delta, so the sign in which ZZ is written never reaches it, and its rotation coordinate is a function of the Cayley coordinate. skoro observes ZZ with the mean h=Xi−1Xjh = X_i^{-1} X_j and reads the residual v=Z⊖h\tangent = Z \ominus h, rotation first. Since hˉ⊗Z\bar h \otimes Z is the conjugate of Zˉ⊗h\bar Z \otimes h, the two have the same ww and opposite vector parts, and with ∣w∣=(1−∣eR∣2)1/2|w| = (1 - \lvert e_R \rvert^2)^{1/2} the sign sΔs_\Delta makes positive, the rotation coordinates are related exactly, and the translations to first order, ph−pZp_h - p_Z being −π(qh) vT-\pi(q_h)\, \tangent_T:

vR=2vec⁡(hˉ⊗Z)w(hˉ⊗Z)=−2 eR1−∣eR∣2,eT=π(qZ)⊤(ph−pZ)=−π(qZ)⊤π(qh) vT=−vT+O(∣v∣2).(8) \begin{gathered} \tangent_R = \frac{2 \operatorname{vec}(\bar h \otimes Z)}{w(\bar h \otimes Z)} = -\frac{2\, e_R}{\sqrt{1 - \lvert e_R \rvert^2}} , \\ e_T = \pi(q_Z)\transpose (p_h - p_Z) = -\pi(q_Z)\transpose \pi(q_h)\, \tangent_T = -\tangent_T + O(\lvert \tangent \rvert^2) . \end{gathered} \tag{8}
(8)

Both coordinates are cut at the half-turns, where w=0w = 0, ∣eR∣=1\lvert e_R \rvert = 1 and vR\tangent_R is unbounded. g2o’s law is not a normal: it is the likelihood factor exp⁡(−12e⊤Ωe)\exp(-\tfrac12 e\transpose \Omega e) of the normal’s mathematics, with no volume, so it has no sampler of the normal’s form and its normalization depends on Ω\Omega.

Its information in skoro’s coordinates. By (8), e=−Av+O(∣v∣2)e = -A \tangent + O(\lvert \tangent \rvert^2) with A(vR,vT)=(vT,12vR)A(\tangent_R, \tangent_T) = (\tangent_T, \tfrac12 \tangent_R), and the precision of v\tangent that gives the same quadratic form to second order is

Λ=A⊤ΩA=[14ΩRR12ΩRT12ΩTRΩTT],(9) \Lambda = A\transpose \Omega A = \begin{bmatrix} \tfrac14 \Omega_{RR} & \tfrac12 \Omega_{RT} \\ \tfrac12 \Omega_{TR} & \Omega_{TT} \end{bmatrix} , \tag{9}
(9)

with ΩTT\Omega_{TT} the first three rows and columns of Ω\Omega, ΩRR\Omega_{RR} the last three, and ΩTR=ΩRT⊤\Omega_{TR} = \Omega_{RT}\transpose the block between them. The rotation’s precision is a quarter of g2o’s, because g2o’s coordinate is half an angle.

What the conversion costs. The two costs agree at a zero residual to second order and differ in the third: by (8), g2o’s rotation coordinate and half of skoro’s have the lengths

sin⁡(θ/2)=θ/2−θ3/48+⋯ ,tan⁡(θ/2)=θ/2+θ3/24+⋯ . \begin{gathered} \sin(\theta / 2) = \theta/2 - \theta^3/48 + \cdots , \\ \tan(\theta / 2) = \theta/2 + \theta^3/24 + \cdots . \end{gathered}

The normal adds its log-volume, which changes the rotation’s precision by II, negligible when ΛRR\Lambda_{RR} is large against it. So an estimate under (9) agrees with g2o’s to the order of the residuals at the solution, not exactly, and a comparison with g2o’s solution on a dataset is a comparison to that tolerance.

In skoro’s terms#

  • A type stored up to a group is declared by its storage, its dimension, RR, QQ, optionally PP, and the finite group GG of linear maps of the storage it is stored up to, meeting Proposition 6; a type that declares no group is stored up to the trivial one, as every type is today. Its quantities are points of NN; their stored values are representatives.
  • Its points are compared up to the group. μ⊕(y⊖μ)\mu \oplus (\otherPoint \ominus \mu) is y\otherPoint only up to GG, on the side of μ\mu; every check the core makes of a type, and every test that compares stored values, compares them as points of NN, by their distance in a chart or by the closest representative.
  • Its derivatives are those Proposition 3 gives, unchanged, computed at the stored representative; by Proposition 6 they are the same at every representative for every function the core computes.
  • Its volume is declared as for any embedded type, with the domain, globality and fullness read on NN and the log-volume invariant under GG; its normal is the normal of its mathematics, with no change.
  • The rotations, the rigid motions and the extended poses are the groups, stored up to the sign of their quaternion, with the Cayley charts, the normalizing projection, and the log-volume (4), all composites of the core’s primitives, the inverse as (5). A quantity of these types is a rotation, motion or extended pose; a measured one is observed in whatever sign it was given, and scored by the normal of its prediction; a state’s prior is a normal like any other.
  • Maps out of these types are maps of the groups when they are invariant under the sign, and maps into them when they are equivariant. The rotations offer only such maps: the logarithm, the axis and angle and the interpolation are those of the shorter turn, and the quaternion a model reports is the representative with w≥0w \ge 0, as The maps of the rotations says. The core’s inclusion stays, the boundary those maps are written on; a model that reads it directly reads a representative, outside what the types promise.
  • At a half-turn between a value and its mean, the inverse (5), and so the residual and the term, are non-finite, and are left so: a model evaluated there fails, saying where, and an estimate is started away from it.
  • A measurement read from g2o is a quaternion and a translation in g2o’s order, normalized, in whatever sign the file gives, observed under the normal with the precision (9); a vertex’s pose is a state’s initial value, in whatever sign the file gives.
  • Alignment on the host is no longer needed by a model; a measured quaternion is observed in whichever sign it comes in.

Open questions#

None remain.

Built on by