45 std::optional<POSE> body_P_sensor_;
48 GTSAM_CONCEPT_TESTABLE_TYPE(POSE)
49 GTSAM_CONCEPT_POSE_TYPE(POSE)
56 typedef typename std::shared_ptr<PoseBetweenFactor> shared_ptr;
64 Base(model, key1, key2), measured_(
measured), body_P_sensor_(body_P_sensor) {
67 ~PoseBetweenFactor()
override {}
70 gtsam::NonlinearFactor::shared_ptr
clone()
const override {
71 return std::static_pointer_cast<gtsam::NonlinearFactor>(
72 gtsam::NonlinearFactor::shared_ptr(
new This(*
this))); }
78 std::cout << s <<
"BetweenFactor("
79 << keyFormatter(this->key1()) <<
","
80 << keyFormatter(this->key2()) <<
")\n";
81 measured_.print(
" measured: ");
82 if(this->body_P_sensor_)
83 this->body_P_sensor_->print(
" sensor pose in body frame: ");
84 this->noiseModel_->print(
" noise model: ");
89 const This *e =
dynamic_cast<const This*
> (&expected);
92 && this->measured_.
equals(e->measured_, tol)
93 && ((!body_P_sensor_ && !e->body_P_sensor_) || (body_P_sensor_ && e->body_P_sensor_ && body_P_sensor_->equals(*e->body_P_sensor_)));
106 hx = p1.compose(*body_P_sensor_,H3).between(p2.compose(*body_P_sensor_), H1, H2);
110 hx = p1.compose(*body_P_sensor_).between(p2.compose(*body_P_sensor_));
113 return measured_.localCoordinates(hx);
115 POSE hx = p1.between(p2, H1, H2);
117 return measured_.localCoordinates(hx);
128#if GTSAM_ENABLE_BOOST_SERIALIZATION
130 friend class boost::serialization::access;
131 template<
class ARCHIVE>
132 void serialize(ARCHIVE & ar,
const unsigned int ) {
133 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
134 ar & BOOST_SERIALIZATION_NVP(measured_);
Concept check for values that can be used in unit tests.
Base class for noise model factors with N variables.
Non-linear factor base classes.
Global functions in a separate testing namespace.
Definition chartTesting.h:28
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Definition Key.cpp:30
Matrix * OptionalMatrixType
This typedef will be used everywhere boost::optional<Matrix&> reference was used previously.
Definition NonlinearFactor.h:57
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition Key.h:35
noiseModel::Base::shared_ptr SharedNoiseModel
Aliases.
Definition NoiseModel.h:846
std::uint64_t Key
Integer nonlinear key type.
Definition types.h:43
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition Group.h:37
bool equals(const This &other, double tol=1e-9) const
check equality
Definition Factor.cpp:42
NoiseModelFactorT()
Definition NoiseModelFactorN.h:257
virtual OutputVec evaluateError(const ValueTypes &... x, OptionalMatrixTypeT< ValueTypes >... H) const =0
Override evaluateError to finish implementing an n-way factor.
Nonlinear factor base class.
Definition NonlinearFactor.h:70
PoseBetweenFactor(Key key1, Key key2, const POSE &measured, const SharedNoiseModel &model, std::optional< POSE > body_P_sensor={})
Constructor.
Definition PoseBetweenFactor.h:62
PoseBetweenFactor()
default constructor - only use for serialization
Definition PoseBetweenFactor.h:59
bool equals(const NonlinearFactor &expected, double tol=1e-9) const override
equals
Definition PoseBetweenFactor.h:88
ErrorVector evaluateError(const POSE &p1, const POSE &p2, OptionalMatrixType H1, OptionalMatrixType H2) const override
implement functions needed to derive from Factor
Definition PoseBetweenFactor.h:99
void print(const std::string &s, const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
implement functions needed for Testable
Definition PoseBetweenFactor.h:77
gtsam::NonlinearFactor::shared_ptr clone() const override
Definition PoseBetweenFactor.h:70
const POSE & measured() const
return the measured
Definition PoseBetweenFactor.h:122
Concept-checking macros for geometric objects Each macro instantiates a concept check structure,...