Template Class PointDistanceFactor

Inheritance Relationships

Base Type

  • public gtsam::NoiseModelFactor3< TransformationType, gtsam::Point3 >

Class Documentation

template<typename TransformationType>
class PointDistanceFactor : public gtsam::NoiseModelFactor3<TransformationType, gtsam::Point3>

Class for a factor representing the distance between a transformed 3D point from world to camera reference frame and a measured point in the camera reference frame.

This factor constrains a 3D point (in world coordinates) transformed by a pose, and computes the error as the difference to a measured point in the camera frame. It is useful for enforcing geometric consistency between poses and points in SLAM.

Template Parameters:

TransformationType – The type representing the camera pose (e.g., gtsam::Pose3, gtsam::Similarity3).

Public Types

using Base = gtsam::NoiseModelFactor3<TransformationType, gtsam::Point3>

Typedef for the base gtsam class.

using PointDistanceFactorTyped = PointDistanceFactor<TransformationType>

Typedef for the base gtsam class.

using shared_ptr = std::shared_ptr<PointDistanceFactorTyped>

Typedef for a std::shared_ptr of a PointDistanceFactor.

Public Functions

inline PointDistanceFactor(const keyframe_id_t keyframeId_, const point_id_t pointId_, gtsam::Point3 measured_, const gtsam::SharedNoiseModel &noiseModel_)

Construct a PointDistanceFactor object.

Parameters:
  • keyframeId_ – ID of the keyframe where the keypoint was detected.

  • pointId_ – ID of the map point associated with the measurement.

  • measured_ – The 3D point measurement in the camera frame.

  • noiseModel_ – The noise model for the factor.

inline PointDistanceFactor(const PointDistanceFactor::shared_ptr &other_, const keyframe_id_t keyframeId_, const point_id_t pointId_)

Construct a PointDistanceFactor object from a previously existing factor. It basically copies everything from the input factor, and updates the keys for the keyframe and point.

Parameters:
  • other_ – The factor to copy from.

  • keyframeId_ – The new keyframe ID.

  • pointId_ – The new map point ID.

inline gtsam::Vector evaluateError(const TransformationType &pose_, const gtsam::Point3 &point_, gtsam::OptionalMatrixType H1_, gtsam::OptionalMatrixType H2_) const override

Point distance error evaluation function. This is the function that computes the point distance error between the observed 3D point and the transformed 3D point that is used inside gtsam optimization steps.

Parameters:
  • pose_ – The camera pose.

  • point_ – The 3D point in the world.

  • H1_ – Optional Jacobian with respect to the pose.

  • H2_ – Optional Jacobian with respect to the point.

Returns:

The distance error vector.

Public Members

gtsam::Point3 _measured

Measured 3D point in the camera frame.

Public Static Functions

static inline shared_ptr make_shared(const keyframe_id_t keyframeId_, const point_id_t pointId_, gtsam::Point3 measured_, const gtsam::SharedNoiseModel &noiseModel_)

Create a shared point-distance factor.

Parameters:
  • keyframeId_ – Keyframe ID associated with the observation.

  • pointId_ – Point ID associated with the observation.

  • measured_ – Measured 3D point in the camera frame.

  • noiseModel_ – Noise model used for this factor.

Returns:

Shared pointer owning the created point-distance factor.

static inline shared_ptr make_shared(const PointDistanceFactor::shared_ptr &other_, const keyframe_id_t keyframeId_, const point_id_t pointId_)

Clone a point-distance factor with updated graph keys.

Parameters:
  • other_ – Source factor to clone.

  • keyframeId_ – New keyframe ID used in the cloned factor.

  • pointId_ – New point ID used in the cloned factor.

Returns:

Shared pointer owning the cloned point-distance factor.

Public Static Attributes

static const shared_ptr EMPTY = nullptr

A static empty pointer for PointDistanceFactor, useful for initialization.