From a48864452bd6e5d4226693eda16f9d9f45cb488a Mon Sep 17 00:00:00 2001 From: Duy-Nguyen Ta Date: Fri, 2 Aug 2013 13:28:29 +0000 Subject: [PATCH] fix GTSAM_POSE3_EXPMAP warnings. Add GTSAM_ROT3_EXPMAP option. --- CMakeLists.txt | 7 ++----- gtsam/config.h.in | 7 ++++++- gtsam/geometry/Rot3.h | 19 ++++++++++++------- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4fc7fc6bc..b1678a5c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,11 +53,12 @@ if(GTSAM_UNSTABLE_AVAILABLE) endif() option(GTSAM_BUILD_SHARED_LIBRARY "Enable/Disable building of a shared version of gtsam" ON) option(GTSAM_BUILD_STATIC_LIBRARY "Enable/Disable building of a static version of gtsam" OFF) -option(GTSAM_USE_QUATERNIONS "Enable/Disable using an internal Quaternion representation for rotations instead of rotation matrices" OFF) +option(GTSAM_USE_QUATERNIONS "Enable/Disable using an internal Quaternion representation for rotations instead of rotation matrices. If enable, Rot3::EXPMAP is enforced by default." OFF) if(NOT MSVC) option(GTSAM_BUILD_CONVENIENCE_LIBRARIES "Enable/Disable use of convenience libraries for faster development rebuilds, but slower install" OFF) endif() option(GTSAM_POSE3_EXPMAP "Enable/Disable using Pose3::EXPMAP as the default mode. If disabled, Pose3::FIRST_ORDER will be used." OFF) +option(GTSAM_ROT3_EXPMAP "Ignore if GTSAM_USE_QUATERNIONS is OFF (Rot3::EXPMAP by default). Otherwise, enable Rot3::EXPMAP, or if disabled, use Rot3::CAYLEY." OFF) option(GTSAM_ENABLE_CONSISTENCY_CHECKS "Enable/Disable expensive consistency checks" OFF) # Options relating to MATLAB wrapper @@ -181,10 +182,6 @@ if(GTSAM_ENABLE_CONSISTENCY_CHECKS) add_definitions(-DGTSAM_EXTRA_CONSISTENCY_CHECKS) endif() -if(GTSAM_POSE3_EXPMAP) - add_definitions(-DGTSAM_POSE3_EXPMAP) -endif() - ############################################################################### # Add components diff --git a/gtsam/config.h.in b/gtsam/config.h.in index 9ecfcb3d7..120e06565 100644 --- a/gtsam/config.h.in +++ b/gtsam/config.h.in @@ -25,4 +25,9 @@ #cmakedefine GTSAM_USE_QUATERNIONS // Whether GTSAM is compiled to use Pose3::EXPMAP as the default coordinates mode for Pose3's retract and localCoordinates (otherwise, Pose3::FIRST_ORDER will be used) -#cmakedefine GTSAM_POSE3_EXPMAP \ No newline at end of file +#cmakedefine GTSAM_POSE3_EXPMAP + +// Whether GTSAM is compiled to use Rot3::EXPMAP as the default coordinates mode for Rot3's retract and localCoordinates (otherwise, Pose3::CAYLEY will be used) +#ifndef GTSAM_USE_QUATERNIONS + #cmakedefine GTSAM_ROT3_EXPMAP +#endif \ No newline at end of file diff --git a/gtsam/geometry/Rot3.h b/gtsam/geometry/Rot3.h index 9316ab33d..f4a25ff94 100644 --- a/gtsam/geometry/Rot3.h +++ b/gtsam/geometry/Rot3.h @@ -25,13 +25,18 @@ // You can override the default coordinate mode using this flag #ifndef ROT3_DEFAULT_COORDINATES_MODE -#ifdef GTSAM_USE_QUATERNIONS -// Exponential map is very cheap for quaternions -#define ROT3_DEFAULT_COORDINATES_MODE Rot3::EXPMAP -#else -// For rotation matrices, the Cayley transform is a fast retract alternative -#define ROT3_DEFAULT_COORDINATES_MODE Rot3::CAYLEY -#endif + #ifdef GTSAM_USE_QUATERNIONS + // Exponential map is very cheap for quaternions + #define ROT3_DEFAULT_COORDINATES_MODE Rot3::EXPMAP + #else + // If user doesn't require GTSAM_ROT3_EXPMAP in cmake when building + #ifndef GTSAM_ROT3_EXPMAP + // For rotation matrices, the Cayley transform is a fast retract alternative + #define ROT3_DEFAULT_COORDINATES_MODE Rot3::CAYLEY + #else + #define ROT3_DEFAULT_COORDINATES_MODE Rot3::EXPMAP + #endif + #endif #endif #include