34#ifdef GTSAM_LIEGROUP_PREINTEGRATION
36#elif defined(GTSAM_TANGENT_PREINTEGRATION)
72template <
class Pre
integrationType>
84 Eigen::Matrix<double, 15, 15> preintMeasCov_;
86 template <
class PIM>
friend class CombinedImuFactorT;
102 const std::shared_ptr<Params>&
p,
104 const Eigen::Matrix<double, 15, 15>& preintMeasCov =
105 Eigen::Matrix<double, 15, 15>::Zero())
106 : PreintegrationType(
p, biasHat), preintMeasCov_(preintMeasCov) {
107 this->PreintegrationType::resetIntegration();
117 const PreintegrationType& base,
118 const Eigen::Matrix<double, 15, 15>& preintMeasCov)
119 : PreintegrationType(base), preintMeasCov_(preintMeasCov) {
120 this->PreintegrationType::resetIntegration();
135 Params&
p()
const {
return *std::static_pointer_cast<Params>(this->p_); }
141 Matrix preintMeasCov()
const {
return preintMeasCov_; }
176 if (!this->
params() || !this->p().omegaCoriolis ||
177 this->p().omegaCoriolis->isZero(0.0)) {
193 Eigen::Matrix<double, 15, 15> physicalChart =
194 Eigen::Matrix<double, 15, 15>::Identity();
195 if (this->
params() && this->p().omegaCoriolis) {
196 const Matrix3 rotation = predictedAttitude.
matrix();
197 physicalChart.template block<3, 3>(6, 3) =
198 -rotation.transpose() *
201 Eigen::Matrix<double, 15, 15> chartJacobian =
202 Eigen::Matrix<double, 15, 15>::Identity();
203 chartJacobian.bottomRightCorner<6, 6>() = -I_6x6;
205 if constexpr (std::is_same_v<PreintegrationType, TangentPreintegration>) {
206 Matrix9 preintegrationChartJacobian;
208 NavState(), this->preintegrated_, {},
209 &preintegrationChartJacobian);
210 chartJacobian.topLeftCorner<9, 9>() = preintegrationChartJacobian;
213 physicalChart *= chartJacobian;
214 return physicalChart * preintMeasCov_ * physicalChart.transpose();
222 const std::string& s =
"Preintegrated Measurements:")
const override;
225 double tol = 1e-9)
const;
242 const Vector3& measuredOmega,
243 const double dt)
override;
247#ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V43
250 std::cerr <<
"Warning: setBiasAccOmegaInit() is deprecated and no longer used." << std::endl;
251 PreintegrationType::resetIntegration();
252 preintMeasCov_.setZero();
257#if GTSAM_ENABLE_BOOST_SERIALIZATION
259 friend class boost::serialization::access;
260 template <
class ARCHIVE>
261 void serialize(ARCHIVE& ar,
const unsigned int ) {
262 namespace bs = ::boost::serialization;
263 ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(PreintegrationType);
264 ar& BOOST_SERIALIZATION_NVP(preintMeasCov_);
290template <
class PIM = Pre
integratedCombinedMeasurements>
293 imuBias::ConstantBias, imuBias::ConstantBias> {
332 pose_i, vel_i, pose_j, vel_j, bias_i, bias_j),
352 template <
class Measurement = PIM>
356 const Rot3& predictedAttitude)
360 pose_i, vel_i, pose_j, vel_j, bias_i, bias_j),
366 gtsam::NonlinearFactor::shared_ptr
clone()
const override {
367 return std::make_shared<This>(*
this);
380 double tol = 1e-9)
const override;
393 const Pose3& pose_j,
const Vector3& vel_j,
402#if GTSAM_ENABLE_BOOST_SERIALIZATION
404 friend class boost::serialization::access;
405 template <
class ARCHIVE>
406 void serialize(ARCHIVE& ar,
const unsigned int ) {
408 ar& boost::serialization::make_nvp(
409 "NoiseModelFactor6", boost::serialization::base_object<Base>(*
this));
410 ar& BOOST_SERIALIZATION_NVP(pim_);
417using CombinedImuFactor = CombinedImuFactorT<>;
421GTSAM_EXPORT std::ostream& operator<<(std::ostream& os,
const CombinedImuFactorT<PIM>& f);
431 const Vector3& vel_i,
const Pose3& pose_j,
const Vector3& vel_j,
437 Matrix6 Hbias_i, Hbias_j;
439 H6 ? &Hbias_j : 0, H5 ? &Hbias_i : 0).vector();
441 Matrix96 D_r_pose_i, D_r_pose_j, D_r_bias_i;
442 Matrix93 D_r_vel_i, D_r_vel_j;
446 pim, pose_i, vel_i, pose_j, vel_j, bias_i, n_gravity,
447 H1 ? &D_r_pose_i :
nullptr, H2 ? &D_r_vel_i :
nullptr,
448 H3 ? &D_r_pose_j :
nullptr, H4 ? &D_r_vel_j :
nullptr,
449 H5 ? &D_r_bias_i :
nullptr, D_r_gvec);
454 H1->block<9, 6>(0, 0) = D_r_pose_i;
456 H1->block<6, 6>(9, 0).setZero();
460 H2->block<9, 3>(0, 0) = D_r_vel_i;
462 H2->block<6, 3>(9, 0).setZero();
466 H3->block<9, 6>(0, 0) = D_r_pose_j;
468 H3->block<6, 6>(9, 0).setZero();
472 H4->block<9, 3>(0, 0) = D_r_vel_j;
474 H4->block<6, 3>(9, 0).setZero();
478 H5->block<9, 6>(0, 0) = D_r_bias_i;
480 H5->block<6, 6>(9, 0) = Hbias_i;
484 H6->block<9, 6>(0, 0).setZero();
486 H6->block<6, 6>(9, 0) = Hbias_j;
498 :
public Testable<PreintegrationCombinedParams> {};
500template <
class Pre
integrationType>
502 :
public Testable<PreintegratedCombinedMeasurementsT<PreintegrationType>> {};
GTSAM_EXPORT NavState navStateComponentWiseRetract(const NavState &state, const Vector9 &v, OptionalJacobian< 9, 9 > H1={}, OptionalJacobian< 9, 9 > H2={})
Component-wise NavState retraction independent of the optimization chart.
Definition NavState.cpp:147
Vector9 preintegrationErrorAndJacobians(const PIM &pim, const Pose3 &pose_i, const Vector3 &vel_i, const Pose3 &pose_j, const Vector3 &vel_j, const imuBias::ConstantBias &bias_i, const Vector3 &n_gravity, OptionalJacobian< 9, 6 > H1={}, OptionalJacobian< 9, 3 > H2={}, OptionalJacobian< 9, 6 > H3={}, OptionalJacobian< 9, 3 > H4={}, OptionalJacobian< 9, 6 > H5={}, OptionalJacobian< 9, 3 > H6={})
Assemble pose/velocity Jacobians for an explicit gravity vector.
Definition PreintegrationBase.h:275
Vector combinedImuError(const PIM &pim, const Pose3 &pose_i, const Vector3 &vel_i, const Pose3 &pose_j, const Vector3 &vel_j, const imuBias::ConstantBias &bias_i, const imuBias::ConstantBias &bias_j, const Vector3 &n_gravity, OptionalMatrixType H1, OptionalMatrixType H2, OptionalMatrixType H3, OptionalMatrixType H4, OptionalMatrixType H5, OptionalMatrixType H6, Matrix93 *D_r_gvec)
Shared 15-dof error and block-Jacobian assembly for CombinedImuFactorT and CombinedImuFactorWithGravi...
Definition CombinedImuFactor.h:430
IMU preintegration using the SE_2(3) group structure of NavState.
Base class for noise model factors with N variables.
Global functions in a separate testing namespace.
Definition chartTesting.h:28
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Definition Key.cpp:30
Matrix * OptionalMatrixType
This typedef will be used everywhere boost::optional<Matrix&> reference was used previously.
Definition NonlinearFactor.h:57
NoiseModelFactorT< Vector, ValueTypes... > NoiseModelFactorN
Noise model factor with N value types and dynamic-sized error vector.
Definition NoiseModelFactorN.h:561
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition Matrix.cpp:143
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
Matrix3 skewSymmetric(double wx, double wy, double wz)
skew symmetric matrix returns this: 0 -wz wy wz 0 -wx -wy wx 0
Definition Matrix.h:365
std::uint64_t Key
Integer nonlinear key type.
Definition types.h:43
All noise models live in the noiseModel namespace.
Definition LossFunctions.cpp:33
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition Group.h:37
A helper that implements the traits interface for GTSAM types.
Definition Testable.h:152
A 3D pose (R,t) : (Rot3,Point3).
Definition Pose3.h:42
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
Definition Rot3.h:65
Matrix3 matrix() const
return 3*3 rotation matrix
Definition Rot3M.cpp:261
PreintegratedCombinedMeasurements integrates the IMU measurements (rotation rates and accelerations) ...
Definition CombinedImuFactor.h:73
bool equals(const PreintegratedCombinedMeasurementsT< PreintegrationType > &expected, double tol=1e-9) const
equals
Definition CombinedImuFactor.cpp:69
PreintegratedCombinedMeasurementsT(const PreintegrationType &base, const Eigen::Matrix< double, 15, 15 > &preintMeasCov)
Construct preintegrated directly from members: base class and preintMeasCov.
Definition CombinedImuFactor.h:116
Matrix residualCovariance() const
Express the propagated covariance in the combined IMU factor residual chart.
Definition CombinedImuFactor.h:174
void integrateMeasurement(const Vector3 &measuredAcc, const Vector3 &measuredOmega, const double dt) override
Add a single IMU measurement to the preintegration.
Definition CombinedImuFactor.cpp:239
Matrix residualCovarianceAt(const Rot3 &predictedAttitude) const
Definition CombinedImuFactor.h:192
PreintegratedCombinedMeasurementsT()
Default constructor only for serialization and wrappers.
Definition CombinedImuFactor.h:93
void resetIntegration() override
Params & p() const
Definition CombinedImuFactor.h:135
PreintegratedCombinedMeasurementsT(const std::shared_ptr< Params > &p, const imuBias::ConstantBias &biasHat=imuBias::ConstantBias(), const Eigen::Matrix< double, 15, 15 > &preintMeasCov=Eigen::Matrix< double, 15, 15 >::Zero())
Default constructor, initializes the class with no measurements.
Definition CombinedImuFactor.h:101
~PreintegratedCombinedMeasurementsT() override
Virtual destructor.
Definition CombinedImuFactor.h:124
CombinedImuFactor is a 6-ways factor involving previous state (pose and velocity of the vehicle,...
Definition CombinedImuFactor.h:293
std::shared_ptr< This > shared_ptr
Definition CombinedImuFactor.h:308
Vector evaluateError(const Pose3 &pose_i, const Vector3 &vel_i, const Pose3 &pose_j, const Vector3 &vel_j, const imuBias::ConstantBias &bias_i, const imuBias::ConstantBias &bias_j, OptionalMatrixType H1, OptionalMatrixType H2, OptionalMatrixType H3, OptionalMatrixType H4, OptionalMatrixType H5, OptionalMatrixType H6) const override
implement functions needed to derive from Factor
Definition CombinedImuFactor.cpp:285
bool equals(const NonlinearFactor &expected, double tol=1e-9) const override
equals
Definition CombinedImuFactor.cpp:278
gtsam::NonlinearFactor::shared_ptr clone() const override
Definition CombinedImuFactor.h:366
CombinedImuFactorT(Key pose_i, Key vel_i, Key pose_j, Key vel_j, Key bias_i, Key bias_j, const PIM &preintegratedMeasurements)
Constructor.
Definition CombinedImuFactor.h:328
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
print
Definition CombinedImuFactor.cpp:265
CombinedImuFactorT(Key pose_i, Key vel_i, Key pose_j, Key vel_j, Key bias_i, Key bias_j, const Measurement &preintegratedMeasurements, const Rot3 &predictedAttitude)
Construct a Combined factor whose rotating-frame covariance is expressed at a supplied nominal endpoi...
Definition CombinedImuFactor.h:353
const PIM & preintegratedMeasurements() const
Definition CombinedImuFactor.h:385
CombinedImuFactorT()
Default constructor - only use for serialization.
Definition CombinedImuFactor.h:311
IMU preintegration using the SE_2(3) Lie-group structure of NavState.
Definition LieGroupPreintegration.h:32
IMU pre-integration on NavState manifold.
Definition ManifoldPreintegration.h:33
Navigation state: Pose (rotation, translation) + velocity Following Barrau20icra, this class belongs ...
Definition NavState.h:45
NavState predict(const NavState &state_i, const imuBias::ConstantBias &bias_i, const Vector3 &n_gravity, OptionalJacobian< 9, 9 > H1={}, OptionalJacobian< 9, 6 > H2={}, OptionalJacobian< 9, 3 > H3={}) const
Predict state at time j, for a given gravity vector in the nav frame.
Definition PreintegrationBase.cpp:205
const std::shared_ptr< Params > & params() const
shared pointer to params
Definition PreintegrationBase.h:98
Parameters for pre-integration using PreintegratedCombinedMeasurements: Usage: Create just a single P...
Definition PreintegrationCombinedParams.h:37
Integrate on the 9D tangent space of the NavState manifold.
Definition TangentPreintegration.h:28
virtual Vector evaluateError(const ValueTypes &... x, OptionalMatrixTypeT< ValueTypes >... H) const=0
Nonlinear factor base class.
Definition NonlinearFactor.h:70
Gaussian implements the mathematical model |R*x|^2 = |y|^2 with R'*R=inv(Sigma) where y = whiten(x) =...
Definition NoiseModel.h:192