gtsam  4.0.0
gtsam
PreintegratedRotation.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 
24 #include <gtsam/geometry/Pose3.h>
25 #include <gtsam/base/Matrix.h>
26 
27 namespace gtsam {
28 
33  boost::optional<Vector3> omegaCoriolis;
34  boost::optional<Pose3> body_P_sensor;
35 
36  PreintegratedRotationParams() : gyroscopeCovariance(I_3x3) {}
37 
38  virtual void print(const std::string& s) const;
39  virtual bool equals(const PreintegratedRotationParams& other, double tol=1e-9) const;
40 
41  void setGyroscopeCovariance(const Matrix3& cov) { gyroscopeCovariance = cov; }
42  void setOmegaCoriolis(const Vector3& omega) { omegaCoriolis.reset(omega); }
43  void setBodyPSensor(const Pose3& pose) { body_P_sensor.reset(pose); }
44 
45  const Matrix3& getGyroscopeCovariance() const { return gyroscopeCovariance; }
46  boost::optional<Vector3> getOmegaCoriolis() const { return omegaCoriolis; }
47  boost::optional<Pose3> getBodyPSensor() const { return body_P_sensor; }
48 
49  private:
52  template<class ARCHIVE>
53  void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
54  namespace bs = ::boost::serialization;
55  ar & bs::make_nvp("gyroscopeCovariance", bs::make_array(gyroscopeCovariance.data(), gyroscopeCovariance.size()));
56  ar & BOOST_SERIALIZATION_NVP(omegaCoriolis);
57  ar & BOOST_SERIALIZATION_NVP(body_P_sensor);
58  }
59 };
60 
67  public:
69 
70  protected:
72  boost::shared_ptr<Params> p_;
73 
74  double deltaTij_;
77 
80 
81  public:
84 
86  explicit PreintegratedRotation(const boost::shared_ptr<Params>& p) : p_(p) {
87  resetIntegration();
88  }
89 
91  PreintegratedRotation(const boost::shared_ptr<Params>& p,
92  double deltaTij, const Rot3& deltaRij,
93  const Matrix3& delRdelBiasOmega)
94  : p_(p), deltaTij_(deltaTij), deltaRij_(deltaRij), delRdelBiasOmega_(delRdelBiasOmega) {}
95 
97 
100 
102  void resetIntegration();
103 
105  bool matchesParamsWith(const PreintegratedRotation& other) const {
106  return p_ == other.p_;
107  }
109 
112  const boost::shared_ptr<Params>& params() const {
113  return p_;
114  }
115  const double& deltaTij() const {
116  return deltaTij_;
117  }
118  const Rot3& deltaRij() const {
119  return deltaRij_;
120  }
121  const Matrix3& delRdelBiasOmega() const {
122  return delRdelBiasOmega_;
123  }
125 
128  void print(const std::string& s) const;
129  bool equals(const PreintegratedRotation& other, double tol) const;
131 
134 
138  Rot3 incrementalRotation(const Vector3& measuredOmega, const Vector3& biasHat, double deltaT,
139  OptionalJacobian<3, 3> D_incrR_integratedOmega) const;
140 
143  void integrateMeasurement(const Vector3& measuredOmega, const Vector3& biasHat, double deltaT,
144  OptionalJacobian<3, 3> D_incrR_integratedOmega = boost::none,
145  OptionalJacobian<3, 3> F = boost::none);
146 
148  Rot3 biascorrectedDeltaRij(const Vector3& biasOmegaIncr,
149  OptionalJacobian<3, 3> H = boost::none) const;
150 
152  Vector3 integrateCoriolis(const Rot3& rot_i) const;
153 
155 
156  private:
158  friend class boost::serialization::access;
159  template <class ARCHIVE>
160  void serialize(ARCHIVE& ar, const unsigned int /*version*/) { // NOLINT
161  ar& BOOST_SERIALIZATION_NVP(p_);
162  ar& BOOST_SERIALIZATION_NVP(deltaTij_);
163  ar& BOOST_SERIALIZATION_NVP(deltaRij_);
164  ar& BOOST_SERIALIZATION_NVP(delRdelBiasOmega_);
165  }
166 };
167 
168 template <>
169 struct traits<PreintegratedRotation> : public Testable<PreintegratedRotation> {};
170 
171 }
boost::optional< Vector3 > omegaCoriolis
Coriolis constant.
Definition: PreintegratedRotation.h:33
PreintegratedRotation(const boost::shared_ptr< Params > &p, double deltaTij, const Rot3 &deltaRij, const Matrix3 &delRdelBiasOmega)
Explicit initialization of all class members.
Definition: PreintegratedRotation.h:91
3D Pose
double deltaTij_
Time interval from i to j.
Definition: PreintegratedRotation.h:74
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition: OptionalJacobian.h:39
PreintegratedRotation is the base class for all PreintegratedMeasurements classes (in AHRSFactor...
Definition: PreintegratedRotation.h:66
PreintegratedRotation()
Default constructor for serialization.
Definition: PreintegratedRotation.h:79
Definition: Pose3.h:37
friend class boost::serialization::access
Serialization function.
Definition: PreintegratedRotation.h:51
A helper that implements the traits interface for GTSAM types.
Definition: Testable.h:150
boost::optional< Pose3 > body_P_sensor
The pose of the sensor in the body frame.
Definition: PreintegratedRotation.h:34
typedef and functions to augment Eigen&#39;s MatrixXd
Matrix3 delRdelBiasOmega_
Jacobian of preintegrated rotation w.r.t. angular rate bias.
Definition: PreintegratedRotation.h:76
Template to create a binary predicate.
Definition: Testable.h:110
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
boost::shared_ptr< Params > p_
Parameters.
Definition: PreintegratedRotation.h:72
Definition: Rot3.h:56
Rot3 deltaRij_
Preintegrated relative orientation (in frame i)
Definition: PreintegratedRotation.h:75
bool matchesParamsWith(const PreintegratedRotation &other) const
check parameters equality: checks whether shared pointer points to same Params object.
Definition: PreintegratedRotation.h:105
Matrix3 gyroscopeCovariance
continuous-time "Covariance" of gyroscope measurements
Definition: PreintegratedRotation.h:32
Parameters for pre-integration: Usage: Create just a single Params and pass a shared pointer to the c...
Definition: PreintegratedRotation.h:31
PreintegratedRotation(const boost::shared_ptr< Params > &p)
Default constructor, resets integration to zero.
Definition: PreintegratedRotation.h:86
Global functions in a separate testing namespace.
Definition: chartTesting.h:28