46 GTSAM_CONCEPT_LIE_TYPE(T)
47 GTSAM_CONCEPT_TESTABLE_TYPE(T)
52 typedef typename boost::shared_ptr<BetweenFactor>
shared_ptr;
60 Base(model, key1, key2), measured_(measured) {
66 virtual gtsam::NonlinearFactor::shared_ptr
clone()
const {
68 gtsam::NonlinearFactor::shared_ptr(
new This(*
this))); }
73 virtual void print(
const std::string& s,
const KeyFormatter& keyFormatter = DefaultKeyFormatter)
const {
74 std::cout << s <<
"BetweenFactor("
75 << keyFormatter(this->
key1()) <<
","
76 << keyFormatter(this->key2()) <<
")\n";
77 measured_.print(
" measured: ");
78 this->noiseModel_->print(
" noise model: ");
83 const This *e =
dynamic_cast<const This*
> (&expected);
84 return e != NULL &&
Base::equals(*e, tol) && this->measured_.equals(e->measured_, tol);
91 boost::optional<Matrix&> H1 = boost::none, boost::optional<Matrix&> H2 =
93 T hx = p1.between(p2, H1, H2);
95 return measured_.localCoordinates(hx);
112 template<
class ARCHIVE>
113 void serialize(ARCHIVE & ar,
const unsigned int version) {
114 ar & boost::serialization::make_nvp(
"NoiseModelFactor2",
115 boost::serialization::base_object<Base>(*
this));
116 ar & BOOST_SERIALIZATION_NVP(measured_);
125 template<
class VALUE>
128 typedef boost::shared_ptr<BetweenConstraint<VALUE> > shared_ptr;
132 BetweenFactor<VALUE>(key1, key2, measured, noiseModel::Constrained::All(VALUE::Dim(), fabs(mu))) {}
138 template<
class ARCHIVE>
139 void serialize(ARCHIVE & ar,
const unsigned int version) {
140 ar & boost::serialization::make_nvp(
"BetweenFactor",
Non-linear factor base classes.
friend class boost::serialization::access
Serialization function.
Definition: BetweenFactor.h:111
virtual bool equals(const NonlinearFactor &f, double tol=1e-9) const
Check if two factors are equal.
Definition: NonlinearFactor.h:239
BetweenFactor()
default constructor - only use for serialization
Definition: BetweenFactor.h:55
Vector evaluateError(const T &p1, const T &p2, boost::optional< Matrix & > H1=boost::none, boost::optional< Matrix & > H2=boost::none) const
implement functions needed to derive from Factor
Definition: BetweenFactor.h:90
const VALUE & measured() const
return the measured
Definition: BetweenFactor.h:99
Base class and basic functions for Lie types.
virtual gtsam::NonlinearFactor::shared_ptr clone() const
Definition: BetweenFactor.h:66
Definition: BetweenFactor.h:32
boost::shared_ptr< BetweenFactor > shared_ptr
The measurement.
Definition: BetweenFactor.h:52
A convenient base class for creating your own NoiseModelFactor with 2 variables.
Definition: NonlinearFactor.h:423
std::size_t size() const
number of variables attached to this factor
Definition: BetweenFactor.h:104
This is the base class for all factor types.
Definition: Factor.h:51
virtual void print(const std::string &s, const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
implement functions needed for Testable
Definition: BetweenFactor.h:73
Binary between constraint - forces between to a given value This constraint requires the underlying t...
Definition: BetweenFactor.h:126
Key key1() const
methods to retrieve both keys
Definition: NonlinearFactor.h:455
virtual bool equals(const NonlinearFactor &expected, double tol=1e-9) const
equals
Definition: BetweenFactor.h:82
Concept check for values that can be used in unit tests.
BetweenConstraint(const VALUE &measured, Key key1, Key key2, double mu=1000.0)
Syntactic sugar for constrained version.
Definition: BetweenFactor.h:131
friend class boost::serialization::access
Serialization function.
Definition: BetweenFactor.h:137
size_t Key
Integer nonlinear key type.
Definition: types.h:59
BetweenFactor(Key key1, Key key2, const VALUE &measured, const SharedNoiseModel &model)
Constructor.
Definition: BetweenFactor.h:58
noiseModel::Base::shared_ptr SharedNoiseModel
Note, deliberately not in noiseModel namespace.
Definition: NoiseModel.h:884
Nonlinear factor base class.
Definition: NonlinearFactor.h:54
boost::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition: types.h:62