29 template<
class T,
class P>
31 const T&
trans,
const P& global,
32 boost::optional<Matrix&> Dtrans,
33 boost::optional<Matrix&> Dglobal) {
34 return trans.transformFrom(global, Dtrans, Dglobal);
56 template<
class POINT,
class TRANSFORM>
67 typedef TRANSFORM Transform;
73 :
Base(model,globalKey, transKey, localKey) {}
80 :
Base(globalKey, transKey, localKey, Point().
dim(), mu) {}
88 globalKey, transKey, localKey) {}
92 virtual NonlinearFactor::shared_ptr
clone()
const {
93 return boost::static_pointer_cast<NonlinearFactor>(
94 NonlinearFactor::shared_ptr(
new This(*
this))); }
98 boost::optional<Matrix&> Dforeign = boost::none,
99 boost::optional<Matrix&> Dtrans = boost::none,
100 boost::optional<Matrix&> Dlocal = boost::none)
const {
101 Point newlocal = transform_point<Transform,Point>(
trans, global, Dtrans, Dforeign);
107 virtual void print(
const std::string& s=
"",
109 std::cout << s <<
": ReferenceFrameFactor(" 110 <<
"Global: " << keyFormatter(this->
key1()) <<
"," 111 <<
" Transform: " << keyFormatter(this->key2()) <<
"," 112 <<
" Local: " << keyFormatter(this->key3()) <<
")\n";
113 this->noiseModel_->print(
" noise model");
117 Key global_key()
const {
return this->
key1(); }
118 Key transform_key()
const {
return this->key2(); }
119 Key local_key()
const {
return this->key3(); }
124 template<
class ARCHIVE>
125 void serialize(ARCHIVE & ar,
const unsigned int ) {
126 ar & boost::serialization::make_nvp(
"NonlinearFactor3",
127 boost::serialization::base_object<Base>(*
this));
132 template<
class T1,
class T2>
This is the base class for all factor types.
Definition: Factor.h:54
ReferenceFrameFactor(double mu, Key globalKey, Key transKey, Key localKey)
Construct a hard frame of reference reference constraint with equal mu values for each degree of free...
Definition: ReferenceFrameFactor.h:79
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:57
A constraint between two landmarks in separate maps Templated on: Point : Type of landmark Transform ...
Definition: ReferenceFrameFactor.h:57
A helper that implements the traits interface for GTSAM types.
Definition: Testable.h:150
boost::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition: Key.h:33
const SharedNoiseModel & noiseModel() const
access to the noise model
Definition: NonlinearFactor.h:210
A convenient base class for creating your own NoiseModelFactor with 3 variables.
Definition: NonlinearFactor.h:420
ReferenceFrameFactor(Key globalKey, Key transKey, Key localKey, double sigma=1e-2)
Simple soft constraint constructor for frame of reference, with equal weighting for each degree of fr...
Definition: ReferenceFrameFactor.h:86
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
Non-linear factor base classes.
friend class boost::serialization::access
Serialization function.
Definition: ReferenceFrameFactor.h:123
virtual NonlinearFactor::shared_ptr clone() const
Creates a shared_ptr clone of the factor - needs to be specialized to allow for subclasses.
Definition: ReferenceFrameFactor.h:92
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
Key key1() const
methods to retrieve keys
Definition: NonlinearFactor.h:454
ReferenceFrameFactor()
default constructor for serialization only
Definition: ReferenceFrameFactor.h:60
virtual Vector evaluateError(const Point &global, const Transform &trans, const Point &local, boost::optional< Matrix & > Dforeign=boost::none, boost::optional< Matrix & > Dtrans=boost::none, boost::optional< Matrix & > Dlocal=boost::none) const
Combined cost and derivative function using boost::optional.
Definition: ReferenceFrameFactor.h:97
Matrix trans(const Matrix &A)
static transpose function, just calls Eigen transpose member function
Definition: Matrix.h:244
P transform_point(const T &trans, const P &global, boost::optional< Matrix & > Dtrans, boost::optional< Matrix & > Dglobal)
Transform function that must be specialized specific domains.
Definition: ReferenceFrameFactor.h:30
virtual void print(const std::string &s="", const gtsam::KeyFormatter &keyFormatter=DefaultKeyFormatter) const
Print.
Definition: ReferenceFrameFactor.h:107
virtual size_t dim() const
get the dimension of the factor (number of rows on linearization)
Definition: NonlinearFactor.h:205
ReferenceFrameFactor(Key globalKey, Key transKey, Key localKey, const noiseModel::Base::shared_ptr &model)
General constructor with arbitrary noise model (constrained or otherwise)
Definition: ReferenceFrameFactor.h:72