GTSAM  4.0.2
C++ library for smoothing and mapping (SAM)
SmartStereoProjectionPoseFactor.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
22 #pragma once
23 
25 
26 namespace gtsam {
46 class GTSAM_UNSTABLE_EXPORT SmartStereoProjectionPoseFactor
48  protected:
50  std::vector<std::shared_ptr<Cal3_S2Stereo>> K_all_;
51 
52  public:
53  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
54 
57 
60 
62  typedef std::shared_ptr<This> shared_ptr;
63 
70  const SharedNoiseModel& sharedNoiseModel,
72  const std::optional<Pose3>& body_P_sensor = {});
73 
82  void add(const StereoPoint2& measured, const Key& poseKey,
83  const std::shared_ptr<Cal3_S2Stereo>& K);
84 
93  void add(const std::vector<StereoPoint2>& measurements,
94  const KeyVector& poseKeys,
95  const std::vector<std::shared_ptr<Cal3_S2Stereo>>& Ks);
96 
106  void add(const std::vector<StereoPoint2>& measurements,
107  const KeyVector& poseKeys,
108  const std::shared_ptr<Cal3_S2Stereo>& K);
109 
115  void print(const std::string& s = "", const KeyFormatter& keyFormatter =
116  DefaultKeyFormatter) const override;
117 
119  bool equals(const NonlinearFactor& p, double tol = 1e-9) const override;
120 
124  double error(const Values& values) const override;
125 
127  inline std::vector<std::shared_ptr<Cal3_S2Stereo>> calibration() const {
128  return K_all_;
129  }
130 
138  Base::Cameras cameras(const Values& values) const override;
139 
140  private:
141 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION
142  friend class boost::serialization::access;
144  template <class ARCHIVE>
145  void serialize(ARCHIVE& ar, const unsigned int /*version*/) {
146  ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
147  ar& BOOST_SERIALIZATION_NVP(K_all_);
148  }
149 #endif
150 
151 }; // end of class declaration
152 
154 template <>
156  : public Testable<SmartStereoProjectionPoseFactor> {};
157 
158 } // namespace gtsam
std::shared_ptr< This > shared_ptr
shorthand for a smart pointer to a factor
Definition: SmartStereoProjectionPoseFactor.h:62
std::vector< std::shared_ptr< Cal3_S2Stereo > > K_all_
shared pointer to calibration object (one for each camera)
Definition: SmartStereoProjectionPoseFactor.h:50
Definition: SmartFactorParams.h:42
Definition: SmartStereoProjectionPoseFactor.h:46
std::string serialize(const T &input)
serializes to a string
Definition: serialization.h:113
Definition: Testable.h:152
Definition: Group.h:43
Definition: NonlinearFactor.h:68
Smart stereo factor on StereoCameras (pose)
Definition: Testable.h:112
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef SmartStereoProjectionFactor Base
shorthand for base class type
Definition: SmartStereoProjectionPoseFactor.h:56
GTSAM_EXPORT void print(const Matrix &A, const std::string &s, std::ostream &stream)
Definition: Values.h:65
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
Definition: chartTesting.h:28
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition: Key.h:86
Definition: StereoPoint2.h:34
std::vector< std::shared_ptr< Cal3_S2Stereo > > calibration() const
Definition: SmartStereoProjectionPoseFactor.h:127
Definition: SmartStereoProjectionFactor.h:55
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:102
SmartStereoProjectionPoseFactor This
shorthand for this class
Definition: SmartStereoProjectionPoseFactor.h:59
noiseModel::Base::shared_ptr SharedNoiseModel
Definition: NoiseModel.h:741