26#include <gtsam/base/std_optional_serialization.h>
29#include "gtsam/dllexport.h"
41 const Vector3& measuredOmega;
43 const std::optional<Pose3>& body_P_sensor;
75 const Vector3& biasHat = Vector3::Zero(),
96 const Vector3& biasHat = Vector3::Zero(),
101struct GTSAM_EXPORT PreintegratedRotationParams {
113 std::optional<Vector3> omega_coriolis = {},
114 std::optional<Pose3> body_P_sensor = {})
115 : gyroscopeCovariance(gyroscope_covariance),
116 omegaCoriolis(omega_coriolis),
117 body_P_sensor(body_P_sensor) {}
119 virtual ~PreintegratedRotationParams() {}
121 virtual void print(
const std::string& s)
const;
122 virtual bool equals(
const PreintegratedRotationParams& other,
double tol=1e-9)
const;
124 void setGyroscopeCovariance(
const Matrix3& cov) { gyroscopeCovariance = cov; }
125 void setOmegaCoriolis(
const Vector3& omega) { omegaCoriolis = omega; }
126 void setBodyPSensor(
const Pose3& pose) { body_P_sensor = pose; }
128 const Matrix3& getGyroscopeCovariance()
const {
return gyroscopeCovariance; }
129 std::optional<Vector3> getOmegaCoriolis()
const {
return omegaCoriolis; }
130 std::optional<Pose3> getBodyPSensor()
const {
return body_P_sensor; }
133#if GTSAM_ENABLE_BOOST_SERIALIZATION
135 friend class boost::serialization::access;
136 template<
class ARCHIVE>
137 void serialize(ARCHIVE & ar,
const unsigned int ) {
138 ar & BOOST_SERIALIZATION_NVP(gyroscopeCovariance);
139 ar & BOOST_SERIALIZATION_NVP(body_P_sensor);
142 bool omegaCoriolisFlag = omegaCoriolis.has_value();
143 ar & boost::serialization::make_nvp(
"omegaCoriolisFlag", omegaCoriolisFlag);
144 if (omegaCoriolisFlag) {
145 ar & BOOST_SERIALIZATION_NVP(*omegaCoriolis);
162 std::shared_ptr<Params>
p_;
182 double deltaTij,
const Rot3& deltaRij,
183 const Matrix3& delRdelBiasOmega)
193 return p_ == other.
p_;
199 const std::shared_ptr<Params>& params()
const {
return p_; }
200 const double& deltaTij()
const {
return deltaTij_; }
201 const Rot3& deltaRij()
const {
return deltaRij_; }
202 const Matrix3& delRdelBiasOmega()
const {
return delRdelBiasOmega_; }
207 void print(
const std::string& s)
const;
208 bool equals(
const PreintegratedRotation& other,
double tol)
const;
215 void resetIntegration();
225 void integrateGyroMeasurement(
const Vector3& measuredOmega,
226 const Vector3& biasHat,
double deltaT,
227 OptionalJacobian<3, 3> F = {});
235 Rot3 biascorrectedDeltaRij(
const Vector3& biasOmegaIncr,
236 OptionalJacobian<3, 3> H = {})
const;
243#ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V43
248 Vector3 integrateCoriolis(
const Rot3& wRi,
249 OptionalJacobian<3, 3> H = {})
const;
252 inline Rot3 incrementalRotation(
253 const Vector3& measuredOmega,
const Vector3& bias,
double deltaT,
254 OptionalJacobian<3, 3> D_incrR_integratedOmega)
const {
255 internal::IncrementalRotation f{measuredOmega, deltaT, p_->body_P_sensor};
256 Rot3 incrR = f(bias, D_incrR_integratedOmega);
258 if (D_incrR_integratedOmega) *D_incrR_integratedOmega /= -deltaT;
264 void integrateMeasurement(
const Vector3& measuredOmega,
265 const Vector3& biasHat,
double deltaT,
266 OptionalJacobian<3, 3> D_incrR_integratedOmega,
267 OptionalJacobian<3, 3> F);
274#if GTSAM_ENABLE_BOOST_SERIALIZATION
276 friend class boost::serialization::access;
277 template <
class ARCHIVE>
278 void serialize(ARCHIVE& ar,
const unsigned int ) {
279 ar& BOOST_SERIALIZATION_NVP(p_);
280 ar& BOOST_SERIALIZATION_NVP(deltaTij_);
281 ar& BOOST_SERIALIZATION_NVP(deltaRij_);
282 ar& BOOST_SERIALIZATION_NVP(delRdelBiasOmega_);
typedef and functions to augment Eigen's MatrixXd
Macros for Matrix constants to avoid excessive template instantiation.
3D Pose manifold SO(3) x R^3 and group SE(3)
Global functions in a separate testing namespace.
Definition chartTesting.h:28
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition Matrix.cpp:143
Rot3 integrateSequentialRotations(const Vector ×, ConstMatrixView measuredOmegas, const Vector3 &biasHat, const Rot3 &body_R_sensor)
Integrate timed gyroscope samples using sequential trapezoidal rotation increments.
Definition PreintegratedRotation.cpp:145
Eigen::Ref< const Matrix, 0, Eigen::Stride< Eigen::Dynamic, Eigen::Dynamic > > ConstMatrixView
Dynamic-stride const Matrix view for accepting NumPy arrays without copies.
Definition Matrix.h:42
Rot3 integrateSingleSpeedConing(const Vector ×, ConstMatrixView measuredOmegas, const Vector3 &biasHat, const Rot3 &body_R_sensor)
Integrate timed gyroscope samples with a single-speed coning correction.
Definition PreintegratedRotation.cpp:164
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition Group.h:37
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition OptionalJacobian.h:40
A helper that implements the traits interface for GTSAM types.
Definition Testable.h:152
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
Definition Rot3.h:65
Function object for incremental rotation.
Definition PreintegratedRotation.h:40
Rot3 operator()(const Vector3 &bias, OptionalJacobian< 3, 3 > H_bias={}) const
Integrate angular velocity, but corrected by bias.
Definition PreintegratedRotation.cpp:76
Parameters for pre-integration: Usage: Create just a single Params and pass a shared pointer to the c...
Definition PreintegratedRotation.h:101
Matrix3 gyroscopeCovariance
Continuous-time "Covariance" of gyroscope measurements The units for stddev are σ = rad/s/√Hz.
Definition PreintegratedRotation.h:104
std::optional< Vector3 > omegaCoriolis
Navigation-frame angular velocity in radians per second.
Definition PreintegratedRotation.h:107
std::optional< Pose3 > body_P_sensor
The pose of the sensor in the body frame.
Definition PreintegratedRotation.h:108
PreintegratedRotation is the base class for all PreintegratedMeasurements classes (in AHRSFactor,...
Definition PreintegratedRotation.h:156
Matrix3 delRdelBiasOmega_
Jacobian of preintegrated rotation w.r.t. angular rate bias.
Definition PreintegratedRotation.h:166
PreintegratedRotation(const std::shared_ptr< Params > &p, double deltaTij, const Rot3 &deltaRij, const Matrix3 &delRdelBiasOmega)
Explicit initialization of all class members.
Definition PreintegratedRotation.h:181
std::shared_ptr< Params > p_
Parameters.
Definition PreintegratedRotation.h:162
double deltaTij_
Time interval from i to j.
Definition PreintegratedRotation.h:164
bool matchesParamsWith(const PreintegratedRotation &other) const
check parameters equality: checks whether shared pointer points to same Params object.
Definition PreintegratedRotation.h:192
PreintegratedRotation()
Default constructor for serialization.
Definition PreintegratedRotation.h:173
Rot3 deltaRij_
Preintegrated relative orientation (in frame i).
Definition PreintegratedRotation.h:165
PreintegratedRotation(const std::shared_ptr< Params > &p)
Default constructor, resets integration to zero.
Definition PreintegratedRotation.h:176
void resetIntegration()
Re-initialize PreintegratedMeasurements.
Definition PreintegratedRotation.cpp:55