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.

UnaryMeasurement

Created by Codex.

Store a typed measurement on one key, together with its uncertainty.

Open In Colab

Mathematical idea

A unary measurement record packages a key, typed observation, and covariance,

(i,zi,Σi).(i,z_i,\Sigma_i).

It is intentionally model-free: a consumer may later define a residual such as h(xi)zih(x_i)-z_i, but the record itself stores no prediction function and contributes no optimization error.

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

When to use it

UnaryMeasurement<T> is a lightweight measurement record rather than an error-bearing nonlinear factor. TrajectoryAlignerSim3 uses it to associate timestamp or frame keys with measured poses.

Python exposes UnaryMeasurementPose3, UnaryMeasurementRot3, and UnaryMeasurementPoint3.

pose_noise = gtsam.noiseModel.Isotropic.Sigma(6, 0.05)
measured_pose = gtsam.Pose3(gtsam.Rot3(), np.array([1.0, 2.0, 3.0]))
measurement = gtsam.UnaryMeasurementPose3(X(4), measured_pose, pose_noise)

print("key:", measurement.key())
print("translation:", measurement.measured().translation())
print("noise sigmas:", measurement.noiseModel().sigmas())
key: 8646911284551352324
translation: [1. 2. 3.]
noise sigmas: [0.05 0.05 0.05 0.05 0.05 0.05]

Practical notes

The key is what joins measurements across trajectories. TrajectoryAlignerSim3 only uses child measurements whose keys also appear in the parent trajectory, so consistent key assignment is essential.