48 GTSAM_CONCEPT_LIE_TYPE(VALUE)
73 Base(model, key),
prior_((Vector(1) << prior).finished()),
mask_(1, idx),
H_(Matrix::Zero(1,
T::dimension)) {
74 assert(model->dim() == 1);
82 assert((
size_t)
prior_.size() == mask.size());
83 assert(model->dim() == (size_t) prior.size());
88 virtual gtsam::NonlinearFactor::shared_ptr
clone()
const {
89 return boost::static_pointer_cast<gtsam::NonlinearFactor>(
90 gtsam::NonlinearFactor::shared_ptr(
new This(*
this))); }
95 virtual void print(
const std::string& s,
const KeyFormatter& keyFormatter = DefaultKeyFormatter)
const {
102 const This *e = dynamic_cast<const This*> (&expected);
105 this->mask_ == e->mask_;
111 Vector
evaluateError(
const T& p, boost::optional<Matrix&> H = boost::none)
const {
114 Vector full_logmap = T::Logmap(p);
116 Vector masked_logmap = Vector::Zero(this->
dim());
117 for (
size_t i=0; i<
mask_.size(); ++i)
118 masked_logmap(i) = full_logmap(
mask_[i]);
119 return masked_logmap -
prior_;
123 const Vector& prior()
const {
return prior_; }
124 const std::vector<bool>& mask()
const {
return mask_; }
125 const Matrix& H()
const {
return H_; }
131 for (
size_t i=0; i<
mask_.size(); ++i)
137 friend class boost::serialization::access;
138 template<
class ARCHIVE>
139 void serialize(ARCHIVE & ar,
const unsigned int ) {
140 ar & boost::serialization::make_nvp(
"NoiseModelFactor1",
141 boost::serialization::base_object<Base>(*
this));
142 ar & BOOST_SERIALIZATION_NVP(
prior_);
143 ar & BOOST_SERIALIZATION_NVP(
mask_);
144 ar & BOOST_SERIALIZATION_NVP(
H_);
PartialPriorFactor(Key key, const std::vector< size_t > &mask, const Vector &prior, const SharedNoiseModel &model)
Indices Constructor: specify the mask with a set of indices.
Definition: PartialPriorFactor.h:79
This is the base class for all factor types.
Definition: Factor.h:54
void fillH()
Constructs the jacobian matrix in place.
Definition: PartialPriorFactor.h:130
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:141
virtual void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
Print.
Definition: NonlinearFactor.cpp:63
bool equal_with_abs_tol(const Eigen::DenseBase< MATRIX > &A, const Eigen::DenseBase< MATRIX > &B, double tol=1e-9)
equals with a tolerance
Definition: Matrix.h:82
Robot state for use with IMU measurements.
Definition: PoseRTV.h:23
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:57
Vector prior_
measurement on tangent space parameters, in compressed form
Definition: PartialPriorFactor.h:53
std::vector< size_t > mask_
indices of values to constrain in compressed prior vector
Definition: PartialPriorFactor.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: Key.h:33
A convenient base class for creating your own NoiseModelFactor with 1 variable.
Definition: NonlinearFactor.h:276
Nonlinear factor base class.
Definition: NonlinearFactor.h:50
virtual gtsam::NonlinearFactor::shared_ptr clone() const
Definition: PartialPriorFactor.h:88
size_t size() const
Definition: Factor.h:129
Non-linear factor base classes.
PartialPriorFactor(Key key, const SharedNoiseModel &model)
constructor with just minimum requirements for a factor - allows more computation in the constructor.
Definition: PartialPriorFactor.h:64
Matrix H_
Constant Jacobian - computed at creation.
Definition: PartialPriorFactor.h:55
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
noiseModel::Base::shared_ptr SharedNoiseModel
Note, deliberately not in noiseModel namespace.
Definition: NoiseModel.h:1072
Vector evaluateError(const T &p, boost::optional< Matrix & > H=boost::none) const
implement functions needed to derive from Factor
Definition: PartialPriorFactor.h:111
A class for a soft partial prior on any Lie type, with a mask over Expmap parameters.
Definition: PartialPriorFactor.h:40
virtual bool equals(const NonlinearFactor &f, double tol=1e-9) const
Check if two factors are equal.
Definition: NonlinearFactor.cpp:71
virtual bool equals(const NonlinearFactor &expected, double tol=1e-9) const
equals
Definition: PartialPriorFactor.h:101
Base class and basic functions for Lie types.
PartialPriorFactor(Key key, size_t idx, double prior, const SharedNoiseModel &model)
Single Element Constructor: acts on a single parameter specified by idx.
Definition: PartialPriorFactor.h:72
virtual size_t dim() const
get the dimension of the factor (number of rows on linearization)
Definition: NonlinearFactor.h:205
virtual void print(const std::string &s, const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
implement functions needed for Testable
Definition: PartialPriorFactor.h:95
PartialPriorFactor()
default constructor - only use for serialization
Definition: PartialPriorFactor.h:58