Overview¶
The ExpressionFactor
class in GTSAM is a template class designed to work with factor graphs in the context of nonlinear optimization. It represents a factor that can be constructed from a GTSAM expression, allowing for flexible and efficient computation of error terms in optimization problems.
The ExpressionFactor
class allows users to define factors based on expressions in C++, that use (reverse) automatic differentiation to compute their Jacobians.
Main Methods¶
Constructor¶
The ExpressionFactor
class provides a constructor that allows for the initialization of the factor with a specific expression and measurement:
/**
* Constructor: creates a factor from a measurement and measurement function
* @param noiseModel the noise model associated with a measurement
* @param measurement actual value of the measurement, of type T
* @param expression predicts the measurement from Values
* The keys associated with the factor, returned by keys(), are sorted.
*/
ExpressionFactor(const SharedNoiseModel& noiseModel, //
const T& measurement, const Expression<T>& expression)
: NoiseModelFactor(noiseModel), measured_(measurement) {
initialize(expression);
}