42 GTSAM_CONCEPT_TESTABLE_TYPE(T)
47 typedef typename boost::shared_ptr<PriorFactor<VALUE> >
shared_ptr;
59 Base(model,
key), prior_(prior) {
68 gtsam::NonlinearFactor::shared_ptr
clone()
const override {
69 return boost::static_pointer_cast<gtsam::NonlinearFactor>(
70 gtsam::NonlinearFactor::shared_ptr(
new This(*
this))); }
75 void print(
const std::string& s,
76 const KeyFormatter& keyFormatter = DefaultKeyFormatter)
const override {
77 std::cout << s <<
"PriorFactor on " << keyFormatter(this->
key()) <<
"\n";
79 if (this->noiseModel_)
80 this->noiseModel_->print(
" noise model: ");
82 std::cout <<
"no noise model" << std::endl;
87 const This* e =
dynamic_cast<const This*
> (&expected);
94 Vector
evaluateError(
const T& x, boost::optional<Matrix&> H = boost::none)
const override {
100 const VALUE & prior()
const {
return prior_; }
106 template<
class ARCHIVE>
107 void serialize(ARCHIVE & ar,
const unsigned int ) {
109 ar & boost::serialization::make_nvp(
"NoiseModelFactor1",
110 boost::serialization::base_object<Base>(*
this));
111 ar & BOOST_SERIALIZATION_NVP(prior_);
115 enum { NeedsToAlign = (
sizeof(T) % 16) == 0 };
121 template<
class VALUE>
Concept check for values that can be used in unit tests.
#define GTSAM_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
This marks a GTSAM object to require alignment.
Definition types.h:317
Non-linear factor base classes.
Global functions in a separate testing namespace.
Definition chartTesting.h:28
noiseModel::Base::shared_ptr SharedNoiseModel
Aliases.
Definition NoiseModel.h:724
std::uint64_t Key
Integer nonlinear key type.
Definition types.h:100
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
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition concepts.h:30
A helper that implements the traits interface for GTSAM types.
Definition Testable.h:151
bool equals(const This &other, double tol=1e-9) const
check equality
Definition Factor.cpp:42
Nonlinear factor base class.
Definition NonlinearFactor.h:42
const SharedNoiseModel & noiseModel() const
access to the noise model
Definition NonlinearFactor.h:223
A convenient base class for creating your own NoiseModelFactor with n variables.
Definition NonlinearFactor.h:400
Key key() const
Returns a key.
Definition NonlinearFactor.h:518
A class for a soft prior on any Value type.
Definition PriorFactor.h:30
PriorFactor< VALUE > This
Typedef to this class.
Definition PriorFactor.h:50
PriorFactor()
default constructor - only use for serialization
Definition PriorFactor.h:53
PriorFactor(Key key, const VALUE &prior, const Matrix &covariance)
Convenience constructor that takes a full covariance argument.
Definition PriorFactor.h:63
void print(const std::string &s, const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
implement functions needed for Testable
Definition PriorFactor.h:75
bool equals(const NonlinearFactor &expected, double tol=1e-9) const override
equals
Definition PriorFactor.h:86
boost::shared_ptr< PriorFactor< VALUE > > shared_ptr
The measurement.
Definition PriorFactor.h:47
Vector evaluateError(const T &x, boost::optional< Matrix & > H=boost::none) const override
implement functions needed to derive from Factor
Definition PriorFactor.h:94
PriorFactor(Key key, const VALUE &prior, const SharedNoiseModel &model=nullptr)
Constructor.
Definition PriorFactor.h:58
friend class boost::serialization::access
Serialization function.
Definition PriorFactor.h:105
gtsam::NonlinearFactor::shared_ptr clone() const override
Definition PriorFactor.h:68