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.
The problem#
skoro holds a rotation as a unit quaternion, and the unit quaternions cover the rotations twice: and are one rotation and two points of . The type skoro declares is 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 , 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 , and the composed quaternion at the end is near , while the loop closure measures a relative rotation near the identity, whose quaternion a file or a program, given the choice, writes with . 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: , and , still stored as quaternions, with the Cayley chart, whose coordinates are the same for and . 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 , their product , the covering map with , the stereographic chart (4) with its inverse, and its volume are those of the rotations’ mathematics. Writing , the stereographic coordinate of at is , of length for the angle of on ’s scale, and its chart at is a diffeomorphism of onto . The rigid motions and the extended poses are stored as and , with the charts of Proposition 23, whose inverse at is
the rotation’s coordinate first, then the rest, each in the frame of the point. A tuple of vectors, such as , is the column vector with its entries stacked. For a point of any of the three, is the point whose quaternion is negated and whose other coordinates are kept; it is the same rotation, motion or extended pose.
The normal is that of its mathematics, with the precision , its residual , and the density with respect to the measure the chart normalizes,
with the chart’s log-volume, for the stereographic chart. A measurement of a state is predicted by a map , such as the relative motion of a pose graph, whose quaternion is .
The antipode in the stereographic chart#
Everything about the sign follows from where the chart at puts the two points over one rotation.
Let with , and let in the chart of (4). Then
and exactly when . Of the two points over one rotation, the one on the side of has the coordinate of length , with the angle between the rotations and , and the other the coordinate of length in the opposite direction.
Write , so that and, since ,
which is below exactly when . Both and are , whose coordinate is , and
The lengths follow from Proposition 5: the point on the side of is at the angle from on ’s scale of angles, which is the angle between the rotations, and the other at , whose coordinate has the length .
∎So the map from one sign to the other is the inversion in the sphere of radius followed by negation. The ball of radius is the chart of the near sides, one point for each rotation within less than a half-turn of , and its complement the far sides; the sphere of radius itself holds the points orthogonal to , the half-turns, where the two signs have coordinates and of equal length. This sharpens the third claim of Proposition 8, that the two lengths multiply to .
What a misaligned measurement does#
Let be a measured rotation given with the sign on the far side of its prediction, so that the point on the near side is , at the angle from . Its residual has the length , which grows without bound as : the term is least likely exactly where the estimate is right. For a concentrated normal, with , its density (1) increases with , and its maximum is at , the measured rotation on the other sheet, which the estimate reaches from where it is only by turning through the remaining .
Against Gauss–Newton. Along the geodesic from to , let be the angle that remains, so that the residual is . A Gauss–Newton step on this residual alone changes by
so that becomes , about : each step doubles the error. Its weight in the normal equations, , is about , 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 and angles add on as they do on the line, modulo . Let the odometry measurements turn by , with , and the loop closure by , each given with . The residual angles of the edges, each in , telescope around the cycle:
No estimate makes every residual zero. With equal noise on every edge, the cost of an edge is , the negative logarithm of (1) up to a constant, whose second derivative is at least , positive when . The cost is then strictly convex, and the least total cost under the constraint spreads the turn evenly: every edge is wrong by . On a loop of a hundred edges that is 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 , with , the sum would be modulo 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 , and every chart of must tell from , since they are different points of it. A chart of 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.
For and , let
Then , and is unchanged when either or is negated. The map is a diffeomorphism of onto the rotations by less than from , with inverse for either over ; is the rotation by about ; ; and .
The norm of is , so , with and ; it is the rotation by about with , so , every such rotation once. Negating negates . Negating or negates , whose and change sign together, so their ratio does not. For , and ; and every rotation by less than from is for a with , which is of . The first-order form and the last identity follow as for the stereographic chart (Proposition 5 and (6)): , and depends on only through its direction and its length.
∎The chart’s coordinate of a rotation by has the length
Its volume against the Haar measure of normalized at the chart’s centre is
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 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 , and is negative on the far hemisphere, which is now a value a model may be given. The inverse is therefore computed as
whose numerator and denominator are each even in the sign of and of , and whose reciprocal is of a positive number wherever the inverse is defined. The retraction’s normalization is the reciprocal of , and the log-volume is a logarithm of a number at least ; both are composites as written.
The half-turns. The chart misses, at each , the rotations a half-turn from it: not one point, as the stereographic chart missed , but a surface, the rotations by about every axis, composed with . 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 , (5) is non-finite, and the term is too; near it the residual is large, its Gauss–Newton weight grows like , and the step below crawls. The stereographic chart was finite at every half-turn, its coordinate of length there, and missed only the antipode , 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 for 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 alone changes by
toward , if slowly near . In the cycle of the one-turn loop, the residual angles are rotation angles, in , and add modulo ,
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 , and the core cannot declare it as one. Its retraction and inverse meet every condition of Proposition 3 on : , stays on , its derivative has rank , and . 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 , the chart at reaches only the open hemisphere , so it is not full, and , 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 is right everywhere, since the point reads on the far hemisphere is the same rotation as its antipode on the near one. The type is , and is how it is stored.
Stored as quaternions, is not a submanifold of its storage: each rotation is stored at two points of , and , 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.
Let , , and be as in Proposition 3, and let be a finite group of linear maps of that carry onto itself and act on it freely, such that for every , and ,
wherever either side is defined. Then is a manifold of dimension , the quotient map is a covering, and and are a retraction on and its inverse, the same whichever representatives are taken. For a function on invariant under , , the chart derivatives of at through , of every order, are those of at through the retraction on , and are the same at every representative .
A finite group acting freely by diffeomorphisms acts properly discontinuously, so is a manifold and a covering, a local diffeomorphism. The retraction on is well defined, since
it is smooth, the identity at , and of full rank there, since is a local diffeomorphism and meets the same conditions on . The inverse is well defined by the two invariances of , and inverts the retraction near as inverts . For the derivatives, as functions of ,
and is in the chart of at .
∎A chart volume is declared for such a type as Definition 3 declares one, with read as : the measure is the one the retraction normalizes on ; the domain, the image, globality and fullness are those of in ; and the log-volume is asked to be invariant, . Since is a local diffeomorphism and the chart volume is local, the volume on is that of the chart on wherever the chart is injective there, and a density on read at a stored point is the same at every representative, since it reads the point only through and .
What a model may read. Everything the core computes from a quantity of such a type goes through , , and , and is the same at every representative. Two things a model writes need not be. The inclusion reads a stored point as its storage, which is a representative and not a function of the point of : on the rotations, the quaternion itself. A map out of the type written on the inclusion is a map of only if it is invariant under , as , a rotated vector and the Cayley coordinate are, and the rotation vector of (10), of length up to , is not. A map into the type, written on the inclusions and projected as (9) does, is a map of when it is equivariant, ; the composition is, since . 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 stays on ; a type’s entry says which of its maps are maps of , 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 . A retraction is on the side of the stored , ; 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 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, , stored as up to , with the Cayley retraction and inverse of Proposition 3, the normalizing projection , and the log-volume (4). The retraction is equivariant and the inverse invariant by Proposition 3, , and the log-volume reads alone.
- The rigid motions, , stored as up to , with and its inverse , both meeting the conditions because , and the log-volume of the rotation alone, against Lebesgue, a Haar measure by the argument of Proposition 23.
- The extended poses, , stored as up to the same sign, likewise.
Each chart is global and full on its group: the rotation’s reaches every rotation by less than from the point’s, which is all of 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 , with the Hessian in place of :
- a measurement of a rotation weighs on the state as a Gaussian of its residual would with the precision on the rotation’s block, a change of for a noise of rad;
- the mean is a mode of the density when , a standard deviation under rad, where it was rad;
- Gauss–Newton with the log-volume’s gradient converges at a rate within of the residuals’ own.
A broad normal is no better than before. Its draws go to the half-turns as its scale grows, since , where the stereographic chart’s went to the far side of , 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, against , which a model meets only through the log-volume’s curvature above. The double cover’s law on the rotations, , and its mirrored modes, are gone: a normal on is a law on already.
The maps of the rotations. Every map of the rotations’ mathematics that reads the rotation through 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 of a coordinate and , change by when is negated, and the angles, their sums and differences returned to , do not. Alignment is too: it returns the same rotation, on the side of its reference, so as a map of it is the identity, choosing a representative and nothing else.
Three read the representative, and are maps of rather than of : the logarithm with its length in , the axis and angle with the angle in , and the interpolation by the arc that avoids . For a rotation by about , the first two give at and at , 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 take their names:
- the logarithm is the rotation vector of the shorter turn, of length in , (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 ; the axis is a convention at the identity, as it was, and at a half-turn, where and name one rotation, a discretization of the vector’s;
- the interpolation is the shorter one, , 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 , the alignment with the identity, which is a map of with a discretization at the half-turns from the identity, where .
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 of , each a translation and a
quaternion with last, followed by the upper triangle of the edge’s information
matrix , 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
the translation of followed by the vector part of its quaternion, read off its rotation matrix and given the sign that makes . The information matrix is that of , 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 , so the sign in which is written never reaches it, and its rotation coordinate is a function of the Cayley coordinate. skoro observes with the mean and reads the residual , rotation first. Since is the conjugate of , the two have the same and opposite vector parts, and with the sign makes positive, the rotation coordinates are related exactly, and the translations to first order, being :
Both coordinates are cut at the half-turns, where , and is unbounded. g2o’s law is not a normal: it is the likelihood factor of the normal’s mathematics, with no volume, so it has no sampler of the normal’s form and its normalization depends on .
Its information in skoro’s coordinates. By (8), with , and the precision of that gives the same quadratic form to second order is
with the first three rows and columns of , the last three, and 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
The normal adds its log-volume, which changes the rotation’s precision by , negligible when 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, , , optionally , and the finite group 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 ; their stored values are representatives.
- Its points are compared up to the group. is only up to , on the side of ; every check the core makes of a type, and every test that compares stored values, compares them as points of , 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 and the log-volume invariant under ; 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 , 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
- The uniform distribution on compact types, and broad scales of a normal on a curved type: Mathematics The uniform distribution on a type of finite mass, curved or finite and discrete, its constant term and its sampler; and what a normal with a large scale is on a curved type, with the ways of refusing it, bounding its scale, replacing its law and documenting it weighed against each other.
- Observed quaternions of arbitrary sign on outside data: Implementation The core declares a type stored up to a finite group of linear maps and checks it; skoro-spatial's rotations, motions and extended poses become SO(3), SE(3) and SE₂(3) under the Cayley chart, stored up to the quaternion's sign; their maps that read the sign are replaced by those of the shorter turn; and a pose graph read from g2o text is estimated in whatever signs it is given.