Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

ShonanFactor

Created by Codex.

Lift a relative Rot2 or Rot3 measurement into one level of the Shonan relaxation.

Open In Colab

Mathematical idea

At relaxation level pp, each variable QiSO(p)Q_i\in\mathrm{SO}(p) projects to its first dd columns, Yi=Qi[:,1 ⁣: ⁣d]Y_i=Q_i[:,1\!:\!d]. A relative rotation RijSO(d)R_{ij}\in\mathrm{SO}(d) gives the lifted residual

rij=vec(YiRijYj).r_{ij}=\operatorname{vec}(Y_iR_{ij}-Y_j).

Here SO(p)\mathrm{SO}(p) is the special orthogonal group and the projected matrices YiY_i lie on a Stiefel manifold.

import gtsam
import numpy as np

from gtsam import symbol_shorthand

C = symbol_shorthand.C
K = symbol_shorthand.K
P = symbol_shorthand.P
S = symbol_shorthand.S
X = symbol_shorthand.X

Model

ShonanFactor<d> connects two SO(p) variables while measuring a rotation in SO(d). Projection onto the first d columns produces the Stiefel-manifold residual. GTSAM instantiates d=2 and d=3; the Python wrapper currently exposes ShonanFactor3.

factor = gtsam.ShonanFactor3(X(0), X(1), gtsam.Rot3(), 3)
Q1 = gtsam.SOn.FromMatrix(np.eye(3))
Q2 = gtsam.SOn.FromMatrix(np.eye(3))

print("zero-measurement residual:", factor.evaluateError(Q1, Q2))
print("factor dimension:", factor.dim())
zero-measurement residual: [0. 0. 0. 0. 0. 0. 0. 0. 0.]
factor dimension: 9

Practical notes

Most users should construct ShonanAveraging2 or ShonanAveraging3, which build these factors and manage the relaxation sequence. Use ShonanFactor directly for research on a fixed relaxation level p.