gtsam  4.0.0
gtsam
TangentPreintegration.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 
18 #pragma once
19 
21 
22 namespace gtsam {
23 
29  protected:
30 
35  Vector9 preintegrated_;
38 
41  resetIntegration();
42  }
43 
44 public:
47 
53  TangentPreintegration(const boost::shared_ptr<Params>& p,
54  const imuBias::ConstantBias& biasHat = imuBias::ConstantBias());
55 
57 
61  void resetIntegration() override;
62 
64 
67  Vector3 deltaPij() const override { return preintegrated_.segment<3>(3); }
68  Vector3 deltaVij() const override { return preintegrated_.tail<3>(); }
69  Rot3 deltaRij() const override { return Rot3::Expmap(theta()); }
70  NavState deltaXij() const override { return NavState().retract(preintegrated_); }
71 
72  const Vector9& preintegrated() const { return preintegrated_; }
73  Vector3 theta() const { return preintegrated_.head<3>(); }
74  const Matrix93& preintegrated_H_biasAcc() const { return preintegrated_H_biasAcc_; }
75  const Matrix93& preintegrated_H_biasOmega() const { return preintegrated_H_biasOmega_; }
76 
79  bool equals(const TangentPreintegration& other, double tol) const;
81 
84 
85  // Update integrated vector on tangent manifold preintegrated with acceleration
86  // Static, functional version.
87  static Vector9 UpdatePreintegrated(const Vector3& a_body,
88  const Vector3& w_body, const double dt,
89  const Vector9& preintegrated,
90  OptionalJacobian<9, 9> A = boost::none,
91  OptionalJacobian<9, 3> B = boost::none,
92  OptionalJacobian<9, 3> C = boost::none);
93 
98  void update(const Vector3& measuredAcc, const Vector3& measuredOmega,
99  const double dt, Matrix9* A, Matrix93* B, Matrix93* C) override;
100 
104  Vector9 biasCorrectedDelta(const imuBias::ConstantBias& bias_i,
105  OptionalJacobian<9, 6> H = boost::none) const override;
106 
107  // Compose the two pre-integrated 9D-vectors zeta01 and zeta02, with derivatives
108  static Vector9 Compose(const Vector9& zeta01, const Vector9& zeta12,
109  double deltaT12,
110  OptionalJacobian<9, 9> H1 = boost::none,
111  OptionalJacobian<9, 9> H2 = boost::none);
112 
115  void mergeWith(const TangentPreintegration& pim, Matrix9* H1, Matrix9* H2);
117 
119  virtual boost::shared_ptr<TangentPreintegration> clone() const {
120  return boost::shared_ptr<TangentPreintegration>();
121  }
122 
124 
125 private:
128  template<class ARCHIVE>
129  void serialize(ARCHIVE & ar, const unsigned int /*version*/) {
130  namespace bs = ::boost::serialization;
131  ar & BOOST_SERIALIZATION_NVP(p_);
132  ar & BOOST_SERIALIZATION_NVP(biasHat_);
133  ar & BOOST_SERIALIZATION_NVP(deltaTij_);
134  ar & bs::make_nvp("preintegrated_", bs::make_array(preintegrated_.data(), preintegrated_.size()));
135  ar & bs::make_nvp("preintegrated_H_biasAcc_", bs::make_array(preintegrated_H_biasAcc_.data(), preintegrated_H_biasAcc_.size()));
136  ar & bs::make_nvp("preintegrated_H_biasOmega_", bs::make_array(preintegrated_H_biasOmega_.data(), preintegrated_H_biasOmega_.size()));
137  }
138 };
139 
140 }
boost::shared_ptr< Params > p_
Parameters.
Definition: PreintegrationBase.h:70
Definition: ImuBias.h:30
virtual boost::shared_ptr< TangentPreintegration > clone() const
Dummy clone for MATLAB.
Definition: TangentPreintegration.h:119
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition: OptionalJacobian.h:39
void mergeWith(const TangentPreintegration &pim, Matrix9 *H1, Matrix9 *H2)
Merge in a different set of measurements and update bias derivatives accordingly The derivatives appl...
Definition: TangentPreintegration.cpp:215
Matrix93 preintegrated_H_biasOmega_
Jacobian of preintegrated_ w.r.t. angular rate bias.
Definition: TangentPreintegration.h:37
Navigation state: Pose (rotation, translation) + velocity NOTE(frank): it does not make sense to make...
Definition: NavState.h:34
Matrix93 preintegrated_H_biasAcc_
Jacobian of preintegrated_ w.r.t. acceleration bias.
Definition: TangentPreintegration.h:36
Template to create a binary predicate.
Definition: Testable.h:110
friend class boost::serialization::access
Serialization function.
Definition: TangentPreintegration.h:127
Vector9 preintegrated_
Preintegrated navigation state, as a 9D vector on tangent space at frame i Order is: theta...
Definition: TangentPreintegration.h:35
static Rot3 Expmap(const Vector3 &v, OptionalJacobian< 3, 3 > H=boost::none)
Exponential map at identity - create a rotation from canonical coordinates using Rodrigues&#39; formula...
Definition: Rot3.h:316
Definition: Rot3.h:56
Bias biasHat_
Acceleration and gyro bias used for preintegration.
Definition: PreintegrationBase.h:73
void update(const Vector3 &measuredAcc, const Vector3 &measuredOmega, const double dt, Matrix9 *A, Matrix93 *B, Matrix93 *C) override
Update preintegrated measurements and get derivatives It takes measured quantities in the j frame Mod...
Definition: TangentPreintegration.cpp:106
PreintegrationBase is the base class for PreintegratedMeasurements (in ImuFactor) and CombinedPreinte...
Definition: PreintegrationBase.h:58
Integrate on the 9D tangent space of the NavState manifold.
Definition: TangentPreintegration.h:28
TangentPreintegration()
Default constructor for serialization.
Definition: TangentPreintegration.h:40
double deltaTij_
Time interval from i to j.
Definition: PreintegrationBase.h:76
Vector9 biasCorrectedDelta(const imuBias::ConstantBias &bias_i, OptionalJacobian< 9, 6 > H=boost::none) const override
Given the estimate of the bias, return a NavState tangent vector summarizing the preintegrated IMU me...
Definition: TangentPreintegration.cpp:143
const Params & p() const
const reference to params
Definition: PreintegrationBase.h:116
NavState retract(const Vector9 &v, OptionalJacobian< 9, 9 > H1=boost::none, OptionalJacobian< 9, 9 > H2=boost::none) const
retract with optional derivatives
Definition: NavState.cpp:109
Global functions in a separate testing namespace.
Definition: chartTesting.h:28