3232
3333#include < gtsam/base/Matrix.h>
3434#include < gtsam/basis/Chebyshev2.h>
35+ #include < gtsam/geometry/Gal3.h>
3536#include < gtsam/navigation/ImuBias.h>
3637#include < gtsam/navigation/ImuFactor.h>
3738#include < gtsam/navigation/NavState.h>
3839#include < gtsam/navigation/PreintegrationBase.h>
39- #include < gtsam/navigation/PreintegrationParams .h>
40+ #include < gtsam/navigation/PreintegrationCombinedParams .h>
4041
4142#include < optional>
4243#include < vector>
@@ -47,8 +48,17 @@ namespace gtsam {
4748class GTSAM_EXPORT PreintegratedImuMeasurementsG : public PreintegrationBase {
4849 using Base = PreintegrationBase;
4950 using Params = PreintegrationBase::Params;
50-
51- std::shared_ptr<Params> p_;
51+ using Matrix10 = Eigen::Matrix<double , 10 , 10 >;
52+ using Matrix20 = Eigen::Matrix<double , 20 , 20 >;
53+
54+ protected:
55+ std::shared_ptr<Params> p_; // /< Preintegration parameters
56+ Gal3 preintMatrix_; // /< Preintegration Matrix (Galilean group element)
57+ Matrix20 preintBiasJacobian_; // /< Jacobian w.r.t. bias states
58+ Matrix10 preintMeasCov_; // /< Preintegration covariance
59+ // /< The dimension of the preintegration covariance matrix is 10x10
60+ // /< Because it includes Galilean Group (n=10)
61+ // /< preintROTATION, preintVELOCITY, preintPOSITION, preintTIME
5262
5363 public:
5464 // Constructors (stubs)
@@ -57,29 +67,33 @@ class GTSAM_EXPORT PreintegratedImuMeasurementsG : public PreintegrationBase {
5767 const imuBias::ConstantBias& biasHat = {});
5868
5969 // Public (const) accessors – stubs
60- double deltaTij () const {
61- throw std::runtime_error (" Not implemented: deltaTij" );
62- }
63- Rot3 deltaRij () const override {
64- throw std::runtime_error (" Not implemented: deltaRij" );
65- }
66- Vector3 deltaPij () const override {
67- throw std::runtime_error (" Not implemented: deltaPij" );
68- }
69- Vector3 deltaVij () const override {
70- throw std::runtime_error (" Not implemented: deltaVij" );
71- }
70+ double deltaTij () const { return preintMatrix_.time (); }
71+ Rot3 deltaRij () const override { return preintMatrix_.rotation (); }
72+ Vector3 deltaPij () const override { return preintMatrix_.translation (); }
73+ Vector3 deltaVij () const override { return preintMatrix_.velocity (); }
7274 NavState deltaXij () const override {
73- throw std::runtime_error (" Not implemented: deltaXij" );
74- }
75- Matrix9 preintMeasCov () const {
76- throw std::runtime_error (" Not implemented: preintMeasCov" );
75+ return NavState (preintMatrix_.rotation (), preintMatrix_.translation (),
76+ preintMatrix_.velocity ());
7777 }
78+ Matrix9 preintMeasCov () const { return preintMeasCov_.block <9 , 9 >(0 , 0 ); }
7879
7980 // Bias correction (first‑order) – stub
8081 Vector9 biasCorrectedDelta (const imuBias::ConstantBias& bias_i,
8182 OptionalJacobian<9 , 6 > H = {}) const override {
82- throw std::runtime_error (" Not implemented: biasCorrectedDelta" );
83+ const imuBias::ConstantBias biasIncr = bias_i - biasHat_;
84+ Gal3 correctedPreintMatrix =
85+ Gal3::Expmap (preintBiasJacobian_.block <10 , 6 >(0 , 0 ) * biasIncr.vector ())
86+ .compose (preintMatrix_);
87+
88+ Vector9 xi;
89+ NavState::dR (xi) = Rot3::Logmap (correctedPreintMatrix.rotation ());
90+ NavState::dP (xi) = correctedPreintMatrix.translation ();
91+ NavState::dV (xi) = correctedPreintMatrix.velocity ();
92+
93+ if (H) {
94+ throw std::runtime_error (" Not implemented: biasCorrectedDelta Jacobian" );
95+ }
96+ return xi;
8397 }
8498
8599 // integration API
@@ -94,10 +108,9 @@ class GTSAM_EXPORT PreintegratedImuMeasurementsG : public PreintegrationBase {
94108 bool equals (const PreintegratedImuMeasurementsG& other,
95109 double tol = 1e-9 ) const ;
96110
97- void update (const Vector3& measuredAcc, const Vector3& measuredOmega,
98- const double dt, Matrix9* A, Matrix93* B, Matrix93* C) override {
99- throw std::runtime_error (" Not implemented: update" );
100- }
111+ // void update(const Vector3& measuredAcc, const Vector3& measuredOmega,
112+ // const double dt, Matrix9* A, Matrix93* B, Matrix93* C) override
113+ // {}
101114};
102115
103116// Tell GTSAM about PreintegratedImuMeasurementsG print/equals:
0 commit comments