From 27e786aae2b88162f3d88de2087468a8d5fb8943 Mon Sep 17 00:00:00 2001 From: Ankur Roy Chowdhury Date: Thu, 2 Mar 2023 13:05:07 -0800 Subject: [PATCH 01/11] A few minor fixes to allow compiling 'boost-free' gtsam without compiling 'gtsam_unstable'. --- CMakeLists.txt | 5 +++-- gtsam/base/Matrix.cpp | 1 + gtsam/discrete/DecisionTree-inl.h | 1 + gtsam/hybrid/HybridSmoother.cpp | 4 +++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ebe27443a..eeaf05772 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,8 +95,6 @@ add_subdirectory(gtsam) # Build Tests add_subdirectory(tests) -# Build examples -add_subdirectory(examples) # Build timing add_subdirectory(timing) @@ -104,6 +102,9 @@ add_subdirectory(timing) # Build gtsam_unstable if (GTSAM_BUILD_UNSTABLE) add_subdirectory(gtsam_unstable) + + # Build examples (Note: 'examples' require `gtsam_unstable` be built since it links against it.) + add_subdirectory(examples) endif() # This is the new wrapper diff --git a/gtsam/base/Matrix.cpp b/gtsam/base/Matrix.cpp index 3c6e64dbc..247c53cce 100644 --- a/gtsam/base/Matrix.cpp +++ b/gtsam/base/Matrix.cpp @@ -30,6 +30,7 @@ #include #include #include +#include using namespace std; diff --git a/gtsam/discrete/DecisionTree-inl.h b/gtsam/discrete/DecisionTree-inl.h index cfaa806b8..9d618dea0 100644 --- a/gtsam/discrete/DecisionTree-inl.h +++ b/gtsam/discrete/DecisionTree-inl.h @@ -33,6 +33,7 @@ #include #include #include +#include namespace gtsam { diff --git a/gtsam/hybrid/HybridSmoother.cpp b/gtsam/hybrid/HybridSmoother.cpp index 549c71714..b06e4de4e 100644 --- a/gtsam/hybrid/HybridSmoother.cpp +++ b/gtsam/hybrid/HybridSmoother.cpp @@ -27,7 +27,9 @@ namespace gtsam { Ordering HybridSmoother::getOrdering( const HybridGaussianFactorGraph &newFactors) { HybridGaussianFactorGraph factors(hybridBayesNet()); - factors += newFactors; + for(auto& factor: newFactors){ + factors.push_back(factor); + } // Get all the discrete keys from the factors KeySet allDiscrete = factors.discreteKeySet(); From f95ffed82ea00d1b367dc7bde8a57da2846894d5 Mon Sep 17 00:00:00 2001 From: Ankur Roy Chowdhury Date: Thu, 2 Mar 2023 13:56:09 -0800 Subject: [PATCH 02/11] Moves examples/FixedLagSmootherExample.cpp -> gtsam_unstable/examples/FixedLagSmootherExample.cpp --- CMakeLists.txt | 7 +++---- examples/CMakeLists.txt | 2 +- gtsam_unstable/examples/CMakeLists.txt | 2 +- .../examples}/FixedLagSmootherExample.cpp | 0 4 files changed, 5 insertions(+), 6 deletions(-) rename {examples => gtsam_unstable/examples}/FixedLagSmootherExample.cpp (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index eeaf05772..7a8be6250 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,16 +95,15 @@ add_subdirectory(gtsam) # Build Tests add_subdirectory(tests) - # Build timing add_subdirectory(timing) +# Build examples +add_subdirectory(examples) + # Build gtsam_unstable if (GTSAM_BUILD_UNSTABLE) add_subdirectory(gtsam_unstable) - - # Build examples (Note: 'examples' require `gtsam_unstable` be built since it links against it.) - add_subdirectory(examples) endif() # This is the new wrapper diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 4b4a81c59..52d90deb9 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -20,4 +20,4 @@ if (NOT GTSAM_USE_BOOST_FEATURES) ) endif() -gtsamAddExamplesGlob("*.cpp" "${excluded_examples}" "gtsam;gtsam_unstable;${Boost_PROGRAM_OPTIONS_LIBRARY}") +gtsamAddExamplesGlob("*.cpp" "${excluded_examples}" "gtsam;${Boost_PROGRAM_OPTIONS_LIBRARY}") diff --git a/gtsam_unstable/examples/CMakeLists.txt b/gtsam_unstable/examples/CMakeLists.txt index 967937b22..ca6244aa0 100644 --- a/gtsam_unstable/examples/CMakeLists.txt +++ b/gtsam_unstable/examples/CMakeLists.txt @@ -9,4 +9,4 @@ if (NOT GTSAM_USE_BOOST_FEATURES) endif() -gtsamAddExamplesGlob("*.cpp" "${excluded_examples}" "gtsam_unstable") +gtsamAddExamplesGlob("*.cpp" "${excluded_examples}" "gtsam") diff --git a/examples/FixedLagSmootherExample.cpp b/gtsam_unstable/examples/FixedLagSmootherExample.cpp similarity index 100% rename from examples/FixedLagSmootherExample.cpp rename to gtsam_unstable/examples/FixedLagSmootherExample.cpp From 683523d36b2454e8f8bf250aff1e8ce287809c52 Mon Sep 17 00:00:00 2001 From: Ankur Roy Chowdhury Date: Thu, 2 Mar 2023 14:08:24 -0800 Subject: [PATCH 03/11] Undo spurious change --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a8be6250..ebe27443a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,12 +95,12 @@ add_subdirectory(gtsam) # Build Tests add_subdirectory(tests) -# Build timing -add_subdirectory(timing) - # Build examples add_subdirectory(examples) +# Build timing +add_subdirectory(timing) + # Build gtsam_unstable if (GTSAM_BUILD_UNSTABLE) add_subdirectory(gtsam_unstable) From ec91f96f3da710533782a44e6718d805f6fa5082 Mon Sep 17 00:00:00 2001 From: Ankur Roy Chowdhury Date: Thu, 2 Mar 2023 14:15:25 -0800 Subject: [PATCH 04/11] import missing header --- gtsam_unstable/examples/CMakeLists.txt | 2 +- gtsam_unstable/partition/GenericGraph.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/gtsam_unstable/examples/CMakeLists.txt b/gtsam_unstable/examples/CMakeLists.txt index ca6244aa0..967937b22 100644 --- a/gtsam_unstable/examples/CMakeLists.txt +++ b/gtsam_unstable/examples/CMakeLists.txt @@ -9,4 +9,4 @@ if (NOT GTSAM_USE_BOOST_FEATURES) endif() -gtsamAddExamplesGlob("*.cpp" "${excluded_examples}" "gtsam") +gtsamAddExamplesGlob("*.cpp" "${excluded_examples}" "gtsam_unstable") diff --git a/gtsam_unstable/partition/GenericGraph.cpp b/gtsam_unstable/partition/GenericGraph.cpp index 4d9bf4f63..62b0fb971 100644 --- a/gtsam_unstable/partition/GenericGraph.cpp +++ b/gtsam_unstable/partition/GenericGraph.cpp @@ -7,6 +7,7 @@ */ #include #include +#include #include From e075f18011f8bdbc05bb2db1c92a522b9ac6f230 Mon Sep 17 00:00:00 2001 From: Ankur Roy Chowdhury Date: Thu, 2 Mar 2023 18:08:08 -0800 Subject: [PATCH 05/11] Adds a 'no-unstable' configuration to CI --- .github/workflows/build-special.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/build-special.yml b/.github/workflows/build-special.yml index 7582bf41c..95359424c 100644 --- a/.github/workflows/build-special.yml +++ b/.github/workflows/build-special.yml @@ -28,6 +28,7 @@ jobs: ubuntu-clang-cayleymap, ubuntu-clang-system-libs, ubuntu-no-boost, + ubuntu-no-unstable, ] build_type: [Debug, Release] @@ -69,6 +70,12 @@ jobs: version: "14" flag: no_boost + - name: ubuntu-no-unstable + os: ubuntu-22.04 + compiler: clang + version: "14" + flag: no_unstable + steps: - name: Checkout uses: actions/checkout@v3 @@ -151,6 +158,12 @@ jobs: echo "GTSAM_USE_BOOST_FEATURES=OFF" >> $GITHUB_ENV echo "GTSAM will not use BOOST" + - name: Turn off unstable + if: matrix.flag == 'no_unstable' + run: | + echo "GTSAM_BUILD_UNSTABLE=OFF" >> $GITHUB_ENV + echo "GTSAM 'unstable' will not be built." + - name: Build & Test run: | bash .github/scripts/unix.sh -t From fac35909943f0b3b61080697be7df02c3dbfd5ef Mon Sep 17 00:00:00 2001 From: Ankur Roy Chowdhury Date: Mon, 6 Mar 2023 14:58:50 -0800 Subject: [PATCH 06/11] 'push_back' entire factor graph instead of individual 'factors' --- gtsam/hybrid/HybridSmoother.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/gtsam/hybrid/HybridSmoother.cpp b/gtsam/hybrid/HybridSmoother.cpp index b06e4de4e..b1164c821 100644 --- a/gtsam/hybrid/HybridSmoother.cpp +++ b/gtsam/hybrid/HybridSmoother.cpp @@ -27,9 +27,8 @@ namespace gtsam { Ordering HybridSmoother::getOrdering( const HybridGaussianFactorGraph &newFactors) { HybridGaussianFactorGraph factors(hybridBayesNet()); - for(auto& factor: newFactors){ - factors.push_back(factor); - } + factors.push_back(newFactors); + // Get all the discrete keys from the factors KeySet allDiscrete = factors.discreteKeySet(); @@ -74,8 +73,7 @@ void HybridSmoother::update(HybridGaussianFactorGraph graph, HybridBayesNet prunedBayesNetFragment = bayesNetFragment->prune(*maxNrLeaves); // Set the bayes net fragment to the pruned version - bayesNetFragment = - std::make_shared(prunedBayesNetFragment); + bayesNetFragment = std::make_shared(prunedBayesNetFragment); } // Add the partial bayes net to the posterior bayes net. From cb8cd25b28f85c59d9690add7e6890b88fa44015 Mon Sep 17 00:00:00 2001 From: Ankur Roy Chowdhury Date: Mon, 6 Mar 2023 15:21:11 -0800 Subject: [PATCH 07/11] Get rid of 'shadow-field' errors/warnings --- gtsam/navigation/PreintegrationCombinedParams.h | 4 ++-- gtsam/navigation/PreintegrationParams.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gtsam/navigation/PreintegrationCombinedParams.h b/gtsam/navigation/PreintegrationCombinedParams.h index 30441ec36..151f554f7 100644 --- a/gtsam/navigation/PreintegrationCombinedParams.h +++ b/gtsam/navigation/PreintegrationCombinedParams.h @@ -51,8 +51,8 @@ struct GTSAM_EXPORT PreintegrationCombinedParams : PreintegrationParams { /// See two named constructors below for good values of n_gravity in body /// frame - PreintegrationCombinedParams(const Vector3& n_gravity) - : PreintegrationParams(n_gravity), + PreintegrationCombinedParams(const Vector3& n_gravity_) + : PreintegrationParams(n_gravity_), biasAccCovariance(I_3x3), biasOmegaCovariance(I_3x3), biasAccOmegaInt(I_6x6) {} diff --git a/gtsam/navigation/PreintegrationParams.h b/gtsam/navigation/PreintegrationParams.h index 4350c7ebd..8435d0bad 100644 --- a/gtsam/navigation/PreintegrationParams.h +++ b/gtsam/navigation/PreintegrationParams.h @@ -40,12 +40,12 @@ struct GTSAM_EXPORT PreintegrationParams: PreintegratedRotationParams { /// The Params constructor insists on getting the navigation frame gravity vector /// For convenience, two commonly used conventions are provided by named constructors below - PreintegrationParams(const Vector3& n_gravity) + PreintegrationParams(const Vector3& n_gravity_) : PreintegratedRotationParams(), accelerometerCovariance(I_3x3), integrationCovariance(I_3x3), use2ndOrderCoriolis(false), - n_gravity(n_gravity) {} + n_gravity(n_gravity_) {} // Default Params for a Z-down navigation frame, such as NED: gravity points along positive Z-axis static std::shared_ptr MakeSharedD(double g = 9.81) { From e69d0dc33af7b5196217b630f117a764dd7eb0b9 Mon Sep 17 00:00:00 2001 From: Ankur Roy Chowdhury Date: Mon, 6 Mar 2023 16:45:49 -0800 Subject: [PATCH 08/11] Fix import --- gtsam/nonlinear/FixedLagSmoother.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtsam/nonlinear/FixedLagSmoother.h b/gtsam/nonlinear/FixedLagSmoother.h index cb657f141..ba17b474b 100644 --- a/gtsam/nonlinear/FixedLagSmoother.h +++ b/gtsam/nonlinear/FixedLagSmoother.h @@ -20,7 +20,7 @@ // \callgraph #pragma once -#include +#include #include #include #include From 348677a7bd48aa4af6775db5b662321e0b701f70 Mon Sep 17 00:00:00 2001 From: Ankur Roy Chowdhury Date: Mon, 6 Mar 2023 17:00:21 -0800 Subject: [PATCH 09/11] Conditionally include 'gtsam_unstable/dllexport.h' --- gtsam/nonlinear/FixedLagSmoother.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gtsam/nonlinear/FixedLagSmoother.h b/gtsam/nonlinear/FixedLagSmoother.h index ba17b474b..f628815a4 100644 --- a/gtsam/nonlinear/FixedLagSmoother.h +++ b/gtsam/nonlinear/FixedLagSmoother.h @@ -20,6 +20,10 @@ // \callgraph #pragma once +#ifdef GTSAN_BUILD_UNSTABLE +#include +#endif + #include #include #include From 910e71a87897fea9664a3652ac5adc6c8dfc84b0 Mon Sep 17 00:00:00 2001 From: Ankur Roy Chowdhury Date: Tue, 7 Mar 2023 11:14:40 -0800 Subject: [PATCH 10/11] seperately include 'gtsam_unstable/dllexport.h' inside IncrementalFixedLagSmoother.h --- gtsam/nonlinear/FixedLagSmoother.h | 4 ---- gtsam_unstable/nonlinear/IncrementalFixedLagSmoother.h | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/gtsam/nonlinear/FixedLagSmoother.h b/gtsam/nonlinear/FixedLagSmoother.h index f628815a4..ba17b474b 100644 --- a/gtsam/nonlinear/FixedLagSmoother.h +++ b/gtsam/nonlinear/FixedLagSmoother.h @@ -20,10 +20,6 @@ // \callgraph #pragma once -#ifdef GTSAN_BUILD_UNSTABLE -#include -#endif - #include #include #include diff --git a/gtsam_unstable/nonlinear/IncrementalFixedLagSmoother.h b/gtsam_unstable/nonlinear/IncrementalFixedLagSmoother.h index bc1c48524..8a14d60c2 100644 --- a/gtsam_unstable/nonlinear/IncrementalFixedLagSmoother.h +++ b/gtsam_unstable/nonlinear/IncrementalFixedLagSmoother.h @@ -22,6 +22,7 @@ #include #include +#include "" namespace gtsam { From ae22dc1b6f53cffbe4b91409c45d64a7122da1b6 Mon Sep 17 00:00:00 2001 From: Ankur Roy Chowdhury Date: Tue, 7 Mar 2023 11:31:58 -0800 Subject: [PATCH 11/11] Use quotes to include 'gtsam_instable/dllexport.h' --- gtsam_unstable/nonlinear/IncrementalFixedLagSmoother.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtsam_unstable/nonlinear/IncrementalFixedLagSmoother.h b/gtsam_unstable/nonlinear/IncrementalFixedLagSmoother.h index 8a14d60c2..20747324a 100644 --- a/gtsam_unstable/nonlinear/IncrementalFixedLagSmoother.h +++ b/gtsam_unstable/nonlinear/IncrementalFixedLagSmoother.h @@ -22,7 +22,7 @@ #include #include -#include "" +#include "gtsam_unstable/dllexport.h" namespace gtsam {