gtsam  4.0.0
gtsam
RelativeElevationFactor.h
Go to the documentation of this file.
1 
10 #pragma once
11 
13 #include <gtsam/geometry/Pose3.h>
15 
16 namespace gtsam {
17 
28 class GTSAM_UNSTABLE_EXPORT RelativeElevationFactor: public NoiseModelFactor2<Pose3, Point3> {
29 private:
30 
31  double measured_;
35 
36 public:
37 
38  RelativeElevationFactor() : measured_(0.0) {} /* Default constructor */
39 
40  RelativeElevationFactor(Key poseKey, Key pointKey, double measured,
41  const SharedNoiseModel& model);
42 
43  virtual ~RelativeElevationFactor() {}
44 
46  virtual gtsam::NonlinearFactor::shared_ptr clone() const {
47  return boost::static_pointer_cast<gtsam::NonlinearFactor>(
48  gtsam::NonlinearFactor::shared_ptr(new This(*this))); }
49 
51  Vector evaluateError(const Pose3& pose, const Point3& point,
52  boost::optional<Matrix&> H1 = boost::none, boost::optional<Matrix&> H2 = boost::none) const;
53 
55  inline double measured() const { return measured_; }
56 
58  virtual bool equals(const NonlinearFactor& expected, double tol=1e-9) const;
59 
61  void print(const std::string& s="", const KeyFormatter& keyFormatter = DefaultKeyFormatter) const;
62 
63 private:
64 
66  friend class boost::serialization::access;
67  template<class ARCHIVE>
68  void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
69  ar & boost::serialization::make_nvp("NoiseModelFactor2",
70  boost::serialization::base_object<Base>(*this));
71  ar & BOOST_SERIALIZATION_NVP(measured_);
72  }
73 }; // RelativeElevationFactor
74 
75 
76 } // \namespace gtsam
77 
78 
This is the base class for all factor types.
Definition: Factor.h:54
A convenient base class for creating your own NoiseModelFactor with 2 variables.
Definition: NonlinearFactor.h:345
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:141
Definition: Point3.h:45
Binary factor for a relative elevation.
Definition: RelativeElevationFactor.h:28
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:57
Template to create a binary predicate.
Definition: Testable.h:110
double measured() const
return the measured
Definition: RelativeElevationFactor.h:55
virtual gtsam::NonlinearFactor::shared_ptr clone() const
Definition: RelativeElevationFactor.h:46
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
Nonlinear factor base class.
Definition: NonlinearFactor.h:50
Non-linear factor base classes.
3D Pose
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
Definition: Pose3.h:37
Symbols for exporting classes and methods from DLLs.