From 1bb26f86afd26b6a786bf2748c1f939bde4f6173 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Sun, 9 Jun 2024 21:34:37 -0700 Subject: [PATCH] Attempt to resolve Windows linking --- gtsam/navigation/PreintegratedRotation.cpp | 6 ++- gtsam/navigation/PreintegratedRotation.h | 50 +++++++++---------- .../tests/testPreintegratedRotation.cpp | 6 +-- 3 files changed, 30 insertions(+), 32 deletions(-) diff --git a/gtsam/navigation/PreintegratedRotation.cpp b/gtsam/navigation/PreintegratedRotation.cpp index 374a09359..ebf98bc15 100644 --- a/gtsam/navigation/PreintegratedRotation.cpp +++ b/gtsam/navigation/PreintegratedRotation.cpp @@ -68,7 +68,8 @@ bool PreintegratedRotation::equals(const PreintegratedRotation& other, && equal_with_abs_tol(delRdelBiasOmega_, other.delRdelBiasOmega_, tol); } -Rot3 PreintegratedRotation::IncrementalRotation::operator()( +namespace internal { +Rot3 IncrementalRotation::operator()( const Vector3& bias, OptionalJacobian<3, 3> H_bias) const { // First we compensate the measurements for the bias Vector3 correctedOmega = measuredOmega - bias; @@ -93,12 +94,13 @@ Rot3 PreintegratedRotation::IncrementalRotation::operator()( } return incrR; } +} // namespace internal void PreintegratedRotation::integrateGyroMeasurement( const Vector3& measuredOmega, const Vector3& biasHat, double deltaT, OptionalJacobian<3, 3> F) { Matrix3 H_bias; - IncrementalRotation f{measuredOmega, deltaT, p_->body_P_sensor}; + internal::IncrementalRotation f{measuredOmega, deltaT, p_->body_P_sensor}; const Rot3 incrR = f(biasHat, H_bias); // Update deltaTij and rotation diff --git a/gtsam/navigation/PreintegratedRotation.h b/gtsam/navigation/PreintegratedRotation.h index a36674062..3ff3eb3f1 100644 --- a/gtsam/navigation/PreintegratedRotation.h +++ b/gtsam/navigation/PreintegratedRotation.h @@ -176,32 +176,6 @@ class GTSAM_EXPORT PreintegratedRotation { /// @} - /// @name Internal, exposed for testing only - /// @{ - - /** - * @brief Function object for incremental rotation. - * @param measuredOmega The measured angular velocity (as given by the sensor) - * @param deltaT The time interval over which the rotation is integrated. - * @param body_P_sensor Optional transform between body and IMU. - */ - struct IncrementalRotation { - const Vector3& measuredOmega; - const double deltaT; - const std::optional& body_P_sensor; - - /** - * @brief Integrate angular velocity, but corrected by bias. - * @param bias The bias estimate - * @param H_bias Jacobian of the rotation w.r.t. bias. - * @return The incremental rotation - */ - Rot3 operator()(const Vector3& bias, - OptionalJacobian<3, 3> H_bias = {}) const; - }; - - /// @} - /// @name Deprecated API /// @{ @@ -250,4 +224,28 @@ class GTSAM_EXPORT PreintegratedRotation { template <> struct traits : public Testable {}; +namespace internal { +/** + * @brief Function object for incremental rotation. + * @param measuredOmega The measured angular velocity (as given by the sensor) + * @param deltaT The time interval over which the rotation is integrated. + * @param body_P_sensor Optional transform between body and IMU. + */ +struct IncrementalRotation { + const Vector3& measuredOmega; + const double deltaT; + const std::optional& body_P_sensor; + + /** + * @brief Integrate angular velocity, but corrected by bias. + * @param bias The bias estimate + * @param H_bias Jacobian of the rotation w.r.t. bias. + * @return The incremental rotation + */ + Rot3 operator()(const Vector3& bias, + OptionalJacobian<3, 3> H_bias = {}) const; +}; + +} // namespace internal + } /// namespace gtsam diff --git a/gtsam/navigation/tests/testPreintegratedRotation.cpp b/gtsam/navigation/tests/testPreintegratedRotation.cpp index b6486d030..1e27ca1e4 100644 --- a/gtsam/navigation/tests/testPreintegratedRotation.cpp +++ b/gtsam/navigation/tests/testPreintegratedRotation.cpp @@ -52,8 +52,7 @@ TEST(PreintegratedRotation, integrateGyroMeasurement) { // Check the value. Matrix3 H_bias; - PreintegratedRotation::IncrementalRotation f{measuredOmega, deltaT, - p->getBodyPSensor()}; + internal::IncrementalRotation f{measuredOmega, deltaT, p->getBodyPSensor()}; const Rot3 incrR = f(bias, H_bias); Rot3 expected = Rot3::Roll(omega * deltaT); EXPECT(assert_equal(expected, incrR, 1e-9)); @@ -98,8 +97,7 @@ TEST(PreintegratedRotation, integrateGyroMeasurementWithTransform) { // Check the value. Matrix3 H_bias; - PreintegratedRotation::IncrementalRotation f{measuredOmega, deltaT, - p->getBodyPSensor()}; + internal::IncrementalRotation f{measuredOmega, deltaT, p->getBodyPSensor()}; Rot3 expected = Rot3::Pitch(omega * deltaT); EXPECT(assert_equal(expected, f(bias, H_bias), 1e-9));