Created by Codex.
Lift a relative Rot2 or Rot3 measurement into one level of the Shonan relaxation.
Mathematical idea¶
At relaxation level , each variable projects to its first columns, . A relative rotation gives the lifted residual
Here is the special orthogonal group and the projected matrices 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.XModel¶
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.