12 #include <gtsam/geometry/concepts.h> 25 typedef typename POSE::Translation Translation;
26 typedef typename POSE::Rotation Rotation;
28 GTSAM_CONCEPT_POSE_TYPE(Pose)
29 GTSAM_CONCEPT_GROUP_TYPE(Pose)
30 GTSAM_CONCEPT_LIE_TYPE(Rotation)
44 :
Base(model, key), measured_(rot_z) {}
48 :
Base(model, key), measured_(pose_z.rotation()) {}
53 virtual gtsam::NonlinearFactor::shared_ptr
clone()
const {
54 return boost::static_pointer_cast<gtsam::NonlinearFactor>(
55 gtsam::NonlinearFactor::shared_ptr(
new This(*
this))); }
58 const Rotation& measured()
const {
return measured_; }
64 const This *e = dynamic_cast<const This*> (&expected);
65 return e != NULL &&
Base::equals(*e, tol) && measured_.equals(e->measured_, tol);
69 void print(
const std::string& s=
"",
const KeyFormatter& keyFormatter = DefaultKeyFormatter)
const {
71 measured_.print(
"Measured Rotation");
75 Vector
evaluateError(
const Pose& pose, boost::optional<Matrix&> H = boost::none)
const {
76 const Rotation& newR = pose.rotation();
78 *H = Matrix::Zero(rDim, xDim);
79 std::pair<size_t, size_t> rotInterval = POSE::rotationInterval();
80 (*H).middleCols(rotInterval.first, rDim).setIdentity(rDim, rDim);
83 return measured_.localCoordinates(newR);
90 template<
class ARCHIVE>
91 void serialize(ARCHIVE & ar,
const unsigned int ) {
92 ar & boost::serialization::make_nvp(
"NoiseModelFactor1",
93 boost::serialization::base_object<Base>(*
this));
94 ar & BOOST_SERIALIZATION_NVP(measured_);
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
print contents
Definition: PoseRotationPrior.h:69
This is the base class for all factor types.
Definition: Factor.h:54
virtual void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
Print.
Definition: NonlinearFactor.cpp:63
Definition: PoseRotationPrior.h:19
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:57
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
Give fixed size dimension of a type, fails at compile time if dynamic.
Definition: Manifold.h:164
Nonlinear factor base class.
Definition: NonlinearFactor.h:50
PoseRotationPrior(Key key, const Rotation &rot_z, const SharedNoiseModel &model)
standard constructor
Definition: PoseRotationPrior.h:43
Non-linear factor base classes.
Vector evaluateError(const Pose &pose, boost::optional< Matrix & > H=boost::none) const
h(x)-z
Definition: PoseRotationPrior.h:75
virtual bool equals(const NonlinearFactor &expected, double tol=1e-9) const
equals specialized to this factor
Definition: PoseRotationPrior.h:63
friend class boost::serialization::access
Serialization function.
Definition: PoseRotationPrior.h:89
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
virtual bool equals(const NonlinearFactor &f, double tol=1e-9) const
Check if two factors are equal.
Definition: NonlinearFactor.cpp:71
PoseRotationPrior(Key key, const POSE &pose_z, const SharedNoiseModel &model)
Constructor that pulls the translation from an incoming POSE.
Definition: PoseRotationPrior.h:47
virtual gtsam::NonlinearFactor::shared_ptr clone() const
Definition: PoseRotationPrior.h:53