gtsam  4.0.0
gtsam
PreintegrationParams.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 
17 #pragma once
18 
20 #include <boost/make_shared.hpp>
21 
22 namespace gtsam {
23 
30  Vector3 n_gravity;
31 
34  PreintegrationParams(const Vector3& n_gravity)
35  : accelerometerCovariance(I_3x3),
36  integrationCovariance(I_3x3),
37  use2ndOrderCoriolis(false),
38  n_gravity(n_gravity) {}
39 
40  // Default Params for a Z-down navigation frame, such as NED: gravity points along positive Z-axis
41  static boost::shared_ptr<PreintegrationParams> MakeSharedD(double g = 9.81) {
42  return boost::shared_ptr<PreintegrationParams>(new PreintegrationParams(Vector3(0, 0, g)));
43  }
44 
45  // Default Params for a Z-up navigation frame, such as ENU: gravity points along negative Z-axis
46  static boost::shared_ptr<PreintegrationParams> MakeSharedU(double g = 9.81) {
47  return boost::shared_ptr<PreintegrationParams>(new PreintegrationParams(Vector3(0, 0, -g)));
48  }
49 
50  void print(const std::string& s) const;
51  bool equals(const PreintegratedRotation::Params& other, double tol) const;
52 
53  void setAccelerometerCovariance(const Matrix3& cov) { accelerometerCovariance = cov; }
54  void setIntegrationCovariance(const Matrix3& cov) { integrationCovariance = cov; }
55  void setUse2ndOrderCoriolis(bool flag) { use2ndOrderCoriolis = flag; }
56 
57  const Matrix3& getAccelerometerCovariance() const { return accelerometerCovariance; }
58  const Matrix3& getIntegrationCovariance() const { return integrationCovariance; }
59  const Vector3& getGravity() const { return n_gravity; }
60  bool getUse2ndOrderCoriolis() const { return use2ndOrderCoriolis; }
61 
62 protected:
65 
67  friend class boost::serialization::access;
68  template<class ARCHIVE>
69  void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
70  namespace bs = ::boost::serialization;
71  ar & boost::serialization::make_nvp("PreintegratedRotation_Params",
72  boost::serialization::base_object<PreintegratedRotationParams>(*this));
73  ar & bs::make_nvp("accelerometerCovariance", bs::make_array(accelerometerCovariance.data(), accelerometerCovariance.size()));
74  ar & bs::make_nvp("integrationCovariance", bs::make_array(integrationCovariance.data(), integrationCovariance.size()));
75  ar & BOOST_SERIALIZATION_NVP(use2ndOrderCoriolis);
76  ar & BOOST_SERIALIZATION_NVP(n_gravity);
77  }
78 
79 #ifdef GTSAM_USE_QUATERNIONS
80  // Align if we are using Quaternions
81 public:
82  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
83 #endif
84 };
85 
86 } // namespace gtsam
Vector3 n_gravity
Gravity vector in nav frame.
Definition: PreintegrationParams.h:30
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:141
bool use2ndOrderCoriolis
Whether to use second order Coriolis integration.
Definition: PreintegrationParams.h:29
Parameters for pre-integration: Usage: Create just a single Params and pass a shared pointer to the c...
Definition: PreintegratedRotation.h:31
Matrix3 integrationCovariance
continuous-time "Covariance" describing integration uncertainty
Definition: PreintegrationParams.h:28
PreintegrationParams(const Vector3 &n_gravity)
The Params constructor insists on getting the navigation frame gravity vector For convenience,...
Definition: PreintegrationParams.h:34
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
PreintegrationParams()
Default constructor for serialization only: uninitialized!
Definition: PreintegrationParams.h:64
Parameters for pre-integration: Usage: Create just a single Params and pass a shared pointer to the c...
Definition: PreintegrationParams.h:26
Matrix3 accelerometerCovariance
continuous-time "Covariance" of accelerometer
Definition: PreintegrationParams.h:27