diff --git a/.github/workflows/linux_ci.yml b/.github/workflows/linux_ci.yml index e76aa44..29a7e8c 100644 --- a/.github/workflows/linux_ci.yml +++ b/.github/workflows/linux_ci.yml @@ -17,22 +17,19 @@ jobs: matrix: # Github Actions requires a single row to be added to the build matrix. # See https://help.github.com/en/articles/workflow-syntax-for-github-actions. - name: [ - ubuntu-20.04-gcc-9, - ubuntu-20.04-clang-10, - ] + name: [ubuntu-24.04-gcc-14, ubuntu-24.04-clang-16] build_type: [Debug, Release] include: - - name: ubuntu-20.04-gcc-9 - os: ubuntu-20.04 + - name: ubuntu-24.04-gcc-14 + os: ubuntu-24.04 compiler: gcc - version: "9" + version: "14" - - name: ubuntu-20.04-clang-10 - os: ubuntu-20.04 + - name: ubuntu-24.04-clang-16 + os: ubuntu-24.04 compiler: clang - version: "10" + version: "16" steps: - name: Setup Compiler @@ -72,13 +69,21 @@ jobs: - name: Install GTSAM run: | - git clone https://github.com/borglab/gtsam.git - cd gtsam && mkdir build && cd $_ - cmake -DGTSAM_ALLOW_DEPRECATED_SINCE_V43=OFF -DGTSAM_WITH_TBB=OFF -DGTSAM_BUILD_UNSTABLE=OFF .. && sudo make -j4 install - cd ../../ + set -e + git clone https://github.com/borglab/gtsam.git /tmp/gtsam_source + cd /tmp/gtsam_source + mkdir build && cd $_ + cmake -DGTSAM_ALLOW_DEPRECATED_SINCE_V43=OFF \ + -DGTSAM_WITH_TBB=OFF \ + -DGTSAM_BUILD_UNSTABLE=OFF \ + -DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF .. + sudo make -j4 install + sudo ldconfig + cd ${{ github.workspace }} + rm -rf /tmp/gtsam_source - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Build Directory run: mkdir build diff --git a/.github/workflows/macos_ci.yml b/.github/workflows/macos_ci.yml index 034909c..ccf1e8a 100644 --- a/.github/workflows/macos_ci.yml +++ b/.github/workflows/macos_ci.yml @@ -17,14 +17,14 @@ jobs: matrix: # Github Actions requires a single row to be added to the build matrix. # See https://help.github.com/en/articles/workflow-syntax-for-github-actions. - name: [macOS-12-xcode-14.2] + name: [macos-14-xcode-15.4] build_type: [Debug, Release] include: - - name: macOS-12-xcode-14.2 - os: macOS-12 + - name: macos-14-xcode-15.4 + os: macos-14 compiler: xcode - version: "14.2" + version: "15.4" steps: - name: Setup Compiler diff --git a/.github/workflows/python_ci.yml b/.github/workflows/python_ci.yml index 65a1614..315b3d9 100644 --- a/.github/workflows/python_ci.yml +++ b/.github/workflows/python_ci.yml @@ -11,17 +11,16 @@ jobs: CTEST_OUTPUT_ON_FAILURE: ON CTEST_PARALLEL_LEVEL: 2 CMAKE_BUILD_TYPE: ${{ matrix.build_type }} - PYTHON_VERSION: ${{ matrix.python_version }} strategy: fail-fast: false matrix: # Github Actions requires a single row to be added to the build matrix. # See https://help.github.com/en/articles/workflow-syntax-for-github-actions. - name: [ubuntu-22.04-gcc-9, ubuntu-22.04-clang-12, macOS-12-xcode-14.2] + name: [ubuntu-22.04-gcc-9, ubuntu-22.04-clang-12, macos-14-xcode-15.4] build_type: [Debug, Release] - python_version: [3] + python_version: [3.11] include: - name: ubuntu-22.04-gcc-9 os: ubuntu-22.04 @@ -33,19 +32,19 @@ jobs: compiler: clang version: "12" - - name: ubuntu-22.04-clang-12 - os: ubuntu-22.04 - compiler: clang - version: "12" - build_type: Debug - python_version: "3" - - - name: macOS-12-xcode-14.2 - os: macOS-12 + - name: macos-14-xcode-15.4 + os: macos-14 compiler: xcode - version: "14.2" + version: "15.4" steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: actions/setup-python@v6 + with: + python-version: ${{ matrix.python_version }} + - name: Install Dependencies (Linux) if: runner.os == 'Linux' run: | @@ -82,49 +81,52 @@ jobs: brew tap borglab/core - name: Python Dependencies + shell: bash run: | - # Install dependencies for gtwrap - pip3 install -U setuptools numpy pyparsing pyyaml + pip install --upgrade pip + pip install -U "setuptools<70" wheel "numpy>=1.11.0" pyparsing "pybind11-stubgen>=2.5.1" - - name: GTSAM (Linux) + - name: Install GTSAM (Linux) if: runner.os == 'Linux' run: | - # Install gtsam - git clone https://github.com/borglab/gtsam.git /home/runner/work/gtsam - cd /home/runner/work/gtsam + git clone https://github.com/borglab/gtsam.git /tmp/gtsam_source + cd /tmp/gtsam_source mkdir build && cd $_ - cmake -D GTSAM_BUILD_EXAMPLES_ALWAYS=OFF -DGTSAM_BUILD_PYTHON=ON .. - sudo make -j$(nproc) install && sudo make python-install + cmake -DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF \ + -DGTSAM_BUILD_PYTHON=ON \ + -DWRAP_PYTHON_VERSION=${{ matrix.python_version }} \ + -DGTSAM_WITH_TBB=OFF \ + .. + sudo make -j4 install + make -j4 python-install sudo ldconfig - cd $GITHUB_WORKSPACE # go back to home directory + cd ${{ github.workspace }} # go back to home directory + sudo rm -rf /tmp/gtsam_source - - name: GTSAM (macOS) + - name: Install GTSAM (macOS) if: runner.os == 'macOS' run: | - # Install gtsam - git clone https://github.com/borglab/gtsam.git /Users/runner/work/gtsam - cd /Users/runner/work/gtsam + set -e + git clone https://github.com/borglab/gtsam.git ${{ github.workspace }}/gtsam + cd ${{ github.workspace }}/gtsam mkdir build && cd $_ - cmake -D GTSAM_BUILD_EXAMPLES_ALWAYS=OFF -DGTSAM_BUILD_PYTHON=ON -DPYTHON_EXECUTABLE=/usr/local/bin/python3 .. - make -j$(sysctl -n hw.physicalcpu) install && make python-install - cd $GITHUB_WORKSPACE # go back to home directory - - - name: Checkout - uses: actions/checkout@v3 + cmake -DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF \ + -DGTSAM_BUILD_PYTHON=ON \ + -DWRAP_PYTHON_VERSION=${{ matrix.python_version }} \ + -DGTSAM_WITH_TBB=OFF \ + .. + sudo make -j4 install + make -j4 python-install + cd ${{ github.workspace }} # go back to home directory - name: Build Directory - run: mkdir build + run: mkdir -p build - - name: Configure (Linux) - if: runner.os == 'Linux' - run: | - cmake -DGPMP2_BUILD_PYTHON_TOOLBOX=ON .. - working-directory: ./build - - - name: Configure (macOS) - if: runner.os == 'macOS' + - name: Configure run: | - cmake -DGPMP2_BUILD_PYTHON_TOOLBOX=ON -DPYTHON_EXECUTABLE=/usr/local/bin/python3 .. + cmake -DGPMP2_BUILD_PYTHON_TOOLBOX=ON \ + -DWRAP_PYTHON_VERSION=${{ matrix.python_version }} \ + .. working-directory: ./build - name: Build diff --git a/.gitignore b/.gitignore index ffc8f08..8689290 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ build* *.pyc *.asv **/.DS_Store +.vscode \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 0626334..1a0fa76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.12) enable_testing() project(gpmp2 LANGUAGES CXX C @@ -14,11 +14,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) #TODO(Varun) Verify C++17 is enabled on Windows as well # Look at GtsamBuildTypes L153 -# Mac ONLY. Define Relative Path on Mac OS -if(NOT DEFINED CMAKE_MACOSX_RPATH) - set(CMAKE_MACOSX_RPATH 0) -endif() - # version indicator set(GPMP2_VERSION_MAJOR 1) set(GPMP2_VERSION_MINOR 0) @@ -42,7 +37,7 @@ if(GPMP2_ENABLE_BOOST_SERIALIZATION) endif() if(GPMP2_BUILD_STATIC_LIBRARY AND GPMP2_BUILD_MATLAB_TOOLBOX) - message(FATAL_ERROR "Matlab toolbox needs static lib to be built") + message(FATAL_ERROR "Matlab toolbox needs shared lib to be built") endif() @@ -52,11 +47,12 @@ include_directories(${GTSAM_INCLUDE_DIR}) set(GTSAM_LIBRARIES gtsam) # TODO: automatic search libs find_package(GTSAMCMakeTools) -include(GtsamMakeConfigFile) include(GtsamBuildTypes) +include(GtsamMakeConfigFile) include(GtsamTesting) +include(GtsamPrinting) -# for unittest scripts +# for unit tests and scripts set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${GTSAM_DIR}/../GTSAMCMakeTools") # Boost - same requirement as gtsam @@ -68,8 +64,7 @@ include_directories(${Boost_INCLUDE_DIR}) configure_file("gpmp2/config.h.in" "gpmp2/config.h") list(APPEND gpmp2_srcs "${PROJECT_BINARY_DIR}/gpmp2/config.h") include_directories(BEFORE ${PROJECT_BINARY_DIR}) # So we can include generated config header files -install(FILES "${PROJECT_BINARY_DIR}/gpmp2/config.h" DESTINATION include/gpmp2) - +install(FILES "${PROJECT_BINARY_DIR}/gpmp2/config.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gpmp2) # include current source folder, at the very beginning include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/gpmp2/geometry/DynamicLieTraits.h b/gpmp2/geometry/DynamicLieTraits.h index eaa1eb0..d189e42 100644 --- a/gpmp2/geometry/DynamicLieTraits.h +++ b/gpmp2/geometry/DynamicLieTraits.h @@ -74,6 +74,8 @@ struct DynamicLieGroupTraits { ChartJacobian H = {}) { return m.inverse(H); } + + static Eigen::MatrixXd AdjointMap(const Class& m) { return m.AdjointMap(); } /// @} }; diff --git a/gpmp2/geometry/ProductDynamicLieGroup.h b/gpmp2/geometry/ProductDynamicLieGroup.h index 42a320f..52bc81c 100644 --- a/gpmp2/geometry/ProductDynamicLieGroup.h +++ b/gpmp2/geometry/ProductDynamicLieGroup.h @@ -10,6 +10,7 @@ #include #include +#include #include // pair @@ -18,11 +19,11 @@ namespace gpmp2 { /// Template to construct the product Lie group of two other Lie groups /// Assumes Lie group structure for G and H, at least one is dynamic size types template -class ProductDynamicLieGroup : public std::pair { +class ProductDynamicLieGroup : public gtsam::ProductLieGroup { private: - GTSAM_CONCEPT_ASSERT((gtsam::IsLieGroup)); - GTSAM_CONCEPT_ASSERT((gtsam::IsLieGroup)); - typedef std::pair Base; + GTSAM_CONCEPT_ASSERT(gtsam::IsLieGroup); + GTSAM_CONCEPT_ASSERT(gtsam::IsLieGroup); + typedef gtsam::ProductLieGroup Base; protected: // static dimensions diff --git a/gpmp2/geometry/tests/testDynamicVector.cpp b/gpmp2/geometry/tests/testDynamicVector.cpp index 037bb8b..2cb8289 100644 --- a/gpmp2/geometry/tests/testDynamicVector.cpp +++ b/gpmp2/geometry/tests/testDynamicVector.cpp @@ -25,10 +25,10 @@ GTSAM_CONCEPT_LIE_INST(DynamicVector) /* ************************************************************************** */ TEST(DynamicVector, Concept) { - GTSAM_CONCEPT_ASSERT((IsGroup)); - GTSAM_CONCEPT_ASSERT((IsManifold)); - GTSAM_CONCEPT_ASSERT((IsLieGroup)); - GTSAM_CONCEPT_ASSERT((IsVectorSpace)); + GTSAM_CONCEPT_ASSERT(IsGroup); + GTSAM_CONCEPT_ASSERT(IsManifold); + GTSAM_CONCEPT_ASSERT(IsLieGroup); + GTSAM_CONCEPT_ASSERT(IsVectorSpace); } /* ************************************************************************** */ diff --git a/gpmp2/geometry/tests/testPose2Vector.cpp b/gpmp2/geometry/tests/testPose2Vector.cpp index f3ecb02..862d9e8 100644 --- a/gpmp2/geometry/tests/testPose2Vector.cpp +++ b/gpmp2/geometry/tests/testPose2Vector.cpp @@ -22,9 +22,9 @@ using namespace gpmp2; /* ************************************************************************** */ TEST(Pose2Vector, Lie) { - GTSAM_CONCEPT_ASSERT((IsGroup)); - GTSAM_CONCEPT_ASSERT((IsManifold)); - GTSAM_CONCEPT_ASSERT((IsLieGroup)); + GTSAM_CONCEPT_ASSERT(IsGroup); + GTSAM_CONCEPT_ASSERT(IsManifold); + GTSAM_CONCEPT_ASSERT(IsLieGroup); } /* ************************************************************************** */ diff --git a/gpmp2/geometry/tests/testProductDynamicLieGroup.cpp b/gpmp2/geometry/tests/testProductDynamicLieGroup.cpp index 447837e..a9dcb9e 100644 --- a/gpmp2/geometry/tests/testProductDynamicLieGroup.cpp +++ b/gpmp2/geometry/tests/testProductDynamicLieGroup.cpp @@ -47,9 +47,9 @@ struct traits : internal::DynamicLieGroupTraits { //****************************************************************************** TEST(ProductDynamicLieGroup, ProductLieGroup) { - GTSAM_CONCEPT_ASSERT((IsGroup)); - GTSAM_CONCEPT_ASSERT((IsManifold)); - GTSAM_CONCEPT_ASSERT((IsLieGroup)); + GTSAM_CONCEPT_ASSERT(IsGroup); + GTSAM_CONCEPT_ASSERT(IsManifold); + GTSAM_CONCEPT_ASSERT(IsLieGroup); Product pair1(Point2(0, 0), Pose2()); Vector5 d; d << 1, 2, 0.1, 0.2, 0.3; diff --git a/gpmp2/gp/GaussianProcessInterpolatorLie.h b/gpmp2/gp/GaussianProcessInterpolatorLie.h index d23e249..f0c8871 100644 --- a/gpmp2/gp/GaussianProcessInterpolatorLie.h +++ b/gpmp2/gp/GaussianProcessInterpolatorLie.h @@ -26,7 +26,7 @@ namespace gpmp2 { template class GaussianProcessInterpolatorLie { private: - GTSAM_CONCEPT_ASSERT((gtsam::IsLieGroup)); + GTSAM_CONCEPT_ASSERT(gtsam::IsLieGroup); typedef GaussianProcessInterpolatorLie This; size_t dof_; diff --git a/gpmp2/gp/GaussianProcessPriorLie.h b/gpmp2/gp/GaussianProcessPriorLie.h index 4697ea2..acc9e67 100644 --- a/gpmp2/gp/GaussianProcessPriorLie.h +++ b/gpmp2/gp/GaussianProcessPriorLie.h @@ -24,7 +24,7 @@ template class GaussianProcessPriorLie : public gtsam::NoiseModelFactorN { private: - GTSAM_CONCEPT_ASSERT((gtsam::IsLieGroup)); + GTSAM_CONCEPT_ASSERT(gtsam::IsLieGroup); typedef GaussianProcessPriorLie This; typedef gtsam::NoiseModelFactorN Base; diff --git a/python/requirements.txt b/python/requirements.txt index f39221c..3644a1a 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -1,2 +1,4 @@ -numpy -gtsam \ No newline at end of file +numpy>=1.11.0 +gtsam +pyparsing>=2.4.2 +pybind11-stubgen>=2.5.1