Typedef mola::Factor

Typedef Documentation

using mola::Factor = std::variant<std::monostate, FactorRelativePose3, FactorDynamicsConstVel, FactorStereoProjectionPose, SmartFactorStereoProjectionPose, SmartFactorIMU, FactorOther>

Variant type for “factors” in the world model. It’s guaranteed that the type is either:

  • std::monostate: Not initialized, or

  • A class derived from FactorBase (stored by value), or

  • FactorOther, which is a wrapper around FactorBase::Ptr (an object allocated in the heap).

In this way, Factor can be handled as a polymorphic class, without the cost of dynamic memory allocation for the most-common classes, while still allowing using any user-derived class via dynamic memory.