From f2f1bbaf8ce2a6538e801af3ea76d13ddb6291a8 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sat, 28 Jan 2023 16:27:07 -0500 Subject: [PATCH 1/4] update examples to use C++11 --- gtsam_unstable/examples/SmartRangeExample_plaza1.cpp | 10 ++++++++-- gtsam_unstable/examples/SmartRangeExample_plaza2.cpp | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/gtsam_unstable/examples/SmartRangeExample_plaza1.cpp b/gtsam_unstable/examples/SmartRangeExample_plaza1.cpp index 2fccf6b18..984637ef0 100644 --- a/gtsam_unstable/examples/SmartRangeExample_plaza1.cpp +++ b/gtsam_unstable/examples/SmartRangeExample_plaza1.cpp @@ -234,8 +234,11 @@ int main(int argc, char** argv) { } } countK = 0; - for (const auto& [key, point] : result.extract()) + for (const auto& key_point : result.extract()) { + auto key = key_point.first; + const Point2 point = key_point.second; os2 << key << "\t" << point.x() << "\t" << point.y() << "\t1" << endl; + } if (smart) { for(size_t jj: ids) { Point2 landmark = smartFactors[jj]->triangulate(result); @@ -256,8 +259,11 @@ int main(int argc, char** argv) { // Write result to file Values result = isam.calculateEstimate(); ofstream os("rangeResult.txt"); - for (const auto& [key, pose] : result.extract()) + for (const auto& key_pose : result.extract()) { + auto key = key_pose.first; + const Pose2 pose = key_pose.second; os << key << "\t" << pose.x() << "\t" << pose.y() << "\t" << pose.theta() << endl; + } exit(0); } diff --git a/gtsam_unstable/examples/SmartRangeExample_plaza2.cpp b/gtsam_unstable/examples/SmartRangeExample_plaza2.cpp index 1e6f77b31..b7f1fb1e3 100644 --- a/gtsam_unstable/examples/SmartRangeExample_plaza2.cpp +++ b/gtsam_unstable/examples/SmartRangeExample_plaza2.cpp @@ -202,11 +202,17 @@ int main(int argc, char** argv) { // Write result to file Values result = isam.calculateEstimate(); ofstream os2("rangeResultLM.txt"); - for (const auto& [key, point] : result.extract()) + for (const auto& key_point : result.extract()) { + auto key = key_point.first; + const Point2 point = key_point.second; os2 << key << "\t" << point.x() << "\t" << point.y() << "\t1" << endl; + } ofstream os("rangeResult.txt"); - for (const auto& [key, pose] : result.extract()) + for (const auto& key_pose : result.extract()) { + auto key = key_pose.first; + const Pose2 pose = key_pose.second; os << key << "\t" << pose.x() << "\t" << pose.y() << "\t" << pose.theta() << endl; + } exit(0); } From a1ed2f9866202f35cef66057a8cb37603e8b932b Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sat, 28 Jan 2023 16:27:27 -0500 Subject: [PATCH 2/4] fix warnings --- gtsam/slam/InitializePose3.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gtsam/slam/InitializePose3.cpp b/gtsam/slam/InitializePose3.cpp index e8ec9181c..878bbd44c 100644 --- a/gtsam/slam/InitializePose3.cpp +++ b/gtsam/slam/InitializePose3.cpp @@ -206,12 +206,11 @@ Values InitializePose3::computeOrientationsGradient( // Return correct rotations const Rot3& Rref = inverseRot.at(initialize::kAnchorKey); // This will be set to the identity as so far we included no prior Values estimateRot; - for (const auto key_R : inverseRot) { + for (const auto& key_R : inverseRot) { const Key& key = key_R.first; - const Rot3& Ri = key_R.second; if (key != initialize::kAnchorKey) { const Rot3& R = inverseRot.at(key); - if(setRefFrame) + if (setRefFrame) estimateRot.insert(key, Rref.compose(R.inverse())); else estimateRot.insert(key, R.inverse()); From 09d5380514d744a77db605ad815021699e483312 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sat, 28 Jan 2023 16:27:41 -0500 Subject: [PATCH 3/4] only print cmake compile options for current build version --- cmake/GtsamPrinting.cmake | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/cmake/GtsamPrinting.cmake b/cmake/GtsamPrinting.cmake index c68679667..2181652e5 100644 --- a/cmake/GtsamPrinting.cmake +++ b/cmake/GtsamPrinting.cmake @@ -51,11 +51,10 @@ function(print_build_options_for_target target_name_) # print_padded(GTSAM_COMPILE_DEFINITIONS_PRIVATE) print_padded(GTSAM_COMPILE_DEFINITIONS_PUBLIC) - foreach(build_type ${GTSAM_CMAKE_CONFIGURATION_TYPES}) - string(TOUPPER "${build_type}" build_type_toupper) - # print_padded(GTSAM_COMPILE_OPTIONS_PRIVATE_${build_type_toupper}) - print_padded(GTSAM_COMPILE_OPTIONS_PUBLIC_${build_type_toupper}) - # print_padded(GTSAM_COMPILE_DEFINITIONS_PRIVATE_${build_type_toupper}) - print_padded(GTSAM_COMPILE_DEFINITIONS_PUBLIC_${build_type_toupper}) - endforeach() + string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type_toupper) + # print_padded(GTSAM_COMPILE_OPTIONS_PRIVATE_${build_type_toupper}) + print_padded(GTSAM_COMPILE_OPTIONS_PUBLIC_${build_type_toupper}) + # print_padded(GTSAM_COMPILE_DEFINITIONS_PRIVATE_${build_type_toupper}) + print_padded(GTSAM_COMPILE_DEFINITIONS_PUBLIC_${build_type_toupper}) + endfunction() From 60ed2422267f49f8436a1d4f8f6de8be635d1e64 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sat, 28 Jan 2023 16:27:56 -0500 Subject: [PATCH 4/4] remove commented Cmake commands --- cmake/HandleTBB.cmake | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cmake/HandleTBB.cmake b/cmake/HandleTBB.cmake index 52ee75494..fb944ba5b 100644 --- a/cmake/HandleTBB.cmake +++ b/cmake/HandleTBB.cmake @@ -7,10 +7,6 @@ if (GTSAM_WITH_TBB) if(TBB_FOUND) set(GTSAM_USE_TBB 1) # This will go into config.h -# if ((${TBB_VERSION} VERSION_GREATER "2021.1") OR (${TBB_VERSION} VERSION_EQUAL "2021.1")) -# message(FATAL_ERROR "TBB version greater than 2021.1 (oneTBB API) is not yet supported. Use an older version instead.") -# endif() - if ((${TBB_VERSION_MAJOR} GREATER 2020) OR (${TBB_VERSION_MAJOR} EQUAL 2020)) set(TBB_GREATER_EQUAL_2020 1) else()