Skip to article frontmatterSkip to article content

ExpressionFactorGraph

Overview

The ExpressionFactorGraph class in GTSAM is a specialized factor graph designed to work with expressions. It extends the capabilities of a standard factor graph by allowing factors created from GTSAM expressions, that implement automatic differentiation. It creates ExpressionFactors.

Adding Expression Factors

use addExpressionFactor: This method allows the user to add a new factor to the graph based on a symbolic expression. The expression defines the relationship between the variables involved in the factor.

  template<typename T>
  void addExpressionFactor(const Expression<T>& h, const T& z,
      const SharedNoiseModel& R) {
    using F = ExpressionFactor<T>;
    push_back(std::allocate_shared<F>(Eigen::aligned_allocator<F>(), R, z, h));
  }