40 GTSAM_CONCEPT_TESTABLE_TYPE(T)
45 typedef typename boost::shared_ptr<PriorFactor<VALUE> >
shared_ptr;
57 Base(model, key), prior_(prior) {
61 virtual gtsam::NonlinearFactor::shared_ptr
clone()
const {
63 gtsam::NonlinearFactor::shared_ptr(
new This(*
this))); }
68 virtual void print(
const std::string& s,
const KeyFormatter& keyFormatter = DefaultKeyFormatter)
const {
69 std::cout << s <<
"PriorFactor on " << keyFormatter(this->key()) <<
"\n";
70 prior_.print(
" prior mean: ");
71 this->noiseModel_->print(
" noise model: ");
76 const This* e =
dynamic_cast<const This*
> (&expected);
77 return e != NULL &&
Base::equals(*e, tol) && this->prior_.equals(e->prior_, tol);
83 Vector
evaluateError(
const T& p, boost::optional<Matrix&> H = boost::none)
const {
84 if (H) (*H) =
eye(p.dim());
86 return prior_.localCoordinates(p);
89 const VALUE & prior()
const {
return prior_; }
95 template<
class ARCHIVE>
96 void serialize(ARCHIVE & ar,
const unsigned int version) {
97 ar & boost::serialization::make_nvp(
"NoiseModelFactor1",
98 boost::serialization::base_object<Base>(*
this));
99 ar & BOOST_SERIALIZATION_NVP(prior_);
Non-linear factor base classes.
virtual bool equals(const NonlinearFactor &f, double tol=1e-9) const
Check if two factors are equal.
Definition: NonlinearFactor.h:239
PriorFactor< VALUE > This
Typedef to this class.
Definition: PriorFactor.h:48
PriorFactor()
default constructor - only use for serialization
Definition: PriorFactor.h:51
virtual bool equals(const NonlinearFactor &expected, double tol=1e-9) const
equals
Definition: PriorFactor.h:75
Matrix eye(size_t m, size_t n)
Creates an identity matrix, with matlab-like syntax.
Definition: Matrix.cpp:50
PriorFactor(Key key, const VALUE &prior, const SharedNoiseModel &model)
Constructor.
Definition: PriorFactor.h:56
This is the base class for all factor types.
Definition: Factor.h:51
virtual gtsam::NonlinearFactor::shared_ptr clone() const
Definition: PriorFactor.h:61
Concept check for values that can be used in unit tests.
Vector evaluateError(const T &p, boost::optional< Matrix & > H=boost::none) const
implement functions needed to derive from Factor
Definition: PriorFactor.h:83
size_t Key
Integer nonlinear key type.
Definition: types.h:59
friend class boost::serialization::access
Serialization function.
Definition: PriorFactor.h:94
A convenient base class for creating your own NoiseModelFactor with 1 variable.
Definition: NonlinearFactor.h:354
virtual void print(const std::string &s, const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
implement functions needed for Testable
Definition: PriorFactor.h:68
boost::shared_ptr< PriorFactor< VALUE > > shared_ptr
The measurement.
Definition: PriorFactor.h:45
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
Definition: PriorFactor.h:28