This API walkthrough introduces the wrapped classes FixedLagSmoother, FixedLagSmootherResult declared by FixedLagSmoother.h and demonstrates their principal Python operations.
import gtsam
import numpy as np
from gtsam.symbol_shorthand import L, XOverview¶
The FixedLagSmoother class is the base class for BatchFixedLagSmoother and IncrementalFixedLagSmoother.
It provides an API for fixed-lag smoothing in nonlinear factor graphs. It maintains a sliding window of the most recent variables and marginalizes out older variables. This is particularly useful in real-time applications where memory and computational efficiency are critical.
Mathematical Formulation¶
In fixed-lag smoothing the objective is to estimate the state given all measurements up to time , but only retaining a fixed window of recent states. The optimization problem can be expressed as:
where is the fixed lag, are the measurement functions, and are the measurements. In practice, the functions depend only on a subset of the state variables , and the optimization is performed over a set of factors instead:
The API below allows the user to add new factors at every iteration, which will be automatically pruned after they no longer depend on any variables in the lag.
Wrapped class API¶
The header also exposes the following wrapped classes. This executable listing makes their constructors, properties, and methods visible in the installed build: FixedLagSmootherResult.
def public_api(qualified_name):
value = gtsam
for component in qualified_name.split('.'):
value = getattr(value, component, None)
if value is None:
return []
return [name for name in dir(value) if not name.startswith('_')]
print('\nFixedLagSmootherResult')
print(public_api('FixedLagSmootherResult'))