From e7a5066ecb9bcf8aeb2502b6b0a2cca722098b70 Mon Sep 17 00:00:00 2001 From: Arnaud TANGUY Date: Fri, 18 Jul 2025 13:27:36 +0200 Subject: [PATCH 01/57] doc: Fix typo --- doc/_i18n/en/tutorials/usage/schema.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/_i18n/en/tutorials/usage/schema.md b/doc/_i18n/en/tutorials/usage/schema.md index 1ed9c7b0b4..cf9e569e91 100644 --- a/doc/_i18n/en/tutorials/usage/schema.md +++ b/doc/_i18n/en/tutorials/usage/schema.md @@ -4,7 +4,7 @@ JSON Schema is a [specification](https://json-schema.org/) that allows to docume It is used in [mc_rtc](https://jrl-umi3218.github.io/mc_rtc/json.html) to document the expected data for loading objects -- e.g. tasks or constraints -- into the framework. -As you write code within mc_rtc you will likely encounter a scenarion where you load a number of parameters from an {% include link_tutorial.html category="usage" tutorial="mc_rtc_configuration" %} object. +As you write code within mc_rtc you will likely encounter a scenario where you load a number of parameters from an {% include link_tutorial.html category="usage" tutorial="mc_rtc_configuration" %} object. In addition to loading this configuration object into your data structure, you will also likely be interested in: From 4052ad77317f026c12c6f4de8714e8f51118c642 Mon Sep 17 00:00:00 2001 From: Arnaud TANGUY Date: Tue, 25 Mar 2025 09:30:49 +0100 Subject: [PATCH 02/57] ci(doc): install documentation --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 93949a312f..fd4bcb185a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -70,7 +70,7 @@ jobs: shell: bash run: | mkdir -p ${TMPDIR-/tmp}/build-mc-rtc - cmake -S ${GITHUB_WORKSPACE}/mc-rtc-superbuild -B ${TMPDIR-/tmp}/build-mc-rtc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DVERBOSE_TEST_OUTPUT=ON + cmake -S ${GITHUB_WORKSPACE}/mc-rtc-superbuild -B ${TMPDIR-/tmp}/build-mc-rtc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DINSTALL_DOCUMENTATION=ON - name: "[superbuild] Install mc_rtc and related projects" if: matrix.os != 'windows-latest' @@ -141,7 +141,7 @@ jobs: - name: Upload documentation # Only run on master branch and for one configuration - if: matrix.os == 'ubuntu-20.04' && matrix.build-type == 'RelWithDebInfo' && matrix.compiler == 'gcc' && github.ref == 'refs/heads/master' && github.repository == 'jrl-umi3218/mc_rtc' + if: matrix.os == 'ubuntu-22.04' && matrix.build-type == 'RelWithDebInfo' && matrix.compiler == 'gcc' && github.ref == 'refs/heads/master' && github.repository == 'jrl-umi3218/mc_rtc' run: | set -x pushd . From d6b6c7ac91c19a675b6bda7ac75dbbfade6b6019 Mon Sep 17 00:00:00 2001 From: Arnaud TANGUY Date: Tue, 25 Mar 2025 12:25:07 +0100 Subject: [PATCH 03/57] ci(doc): build doc from correct mc_rtc source folder --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fd4bcb185a..689419c74a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -156,7 +156,7 @@ jobs: sudo apt-get install -qq ruby-dev ruby-bundler libxml2-dev bundle install --path vendor git clone -b gh-pages https://gergondet:${{ secrets.GH_PAGES_TOKEN }}@github.com/jrl-umi3218/mc_rtc /tmp/website - bundle exec jekyll build --trace -b /mc_rtc -d /tmp/website + bundle exec jekyll build --trace -b ${TMPDIR-/tmp}/build-mc-rtc/src/mc_rtc -d /tmp/website cd /tmp/website git add . git config --global user.email "arn.tanguy@gmail.com" From ccfa4b162ccac95b6fd8310d472296ca242a34fb Mon Sep 17 00:00:00 2001 From: Arnaud TANGUY Date: Tue, 25 Mar 2025 14:29:42 +0100 Subject: [PATCH 04/57] ci(doc): build doc from correct mc_rtc source folder --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 689419c74a..9cfa9a962a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -145,7 +145,7 @@ jobs: run: | set -x pushd . - cd doc + cd ${TMPDIR-/tmp}/build-mc-rtc/src/mc_rtc/doc cp -r /usr/local/share/doc/mc_rtc/doxygen-html . find . -type f -print0 | xargs -0 sed -i -e's@/usr/local/share/doc/SpaceVecAlg/doxygen-html/@https://jrl-umi3218.github.io/SpaceVecAlg/doxygen/HEAD/@g' find . -type f -print0 | xargs -0 sed -i -e's@/usr/local/share/doc/RBDyn/doxygen-html/@https://jrl-umi3218.github.io/RBDyn/doxygen/HEAD/@g' @@ -156,7 +156,7 @@ jobs: sudo apt-get install -qq ruby-dev ruby-bundler libxml2-dev bundle install --path vendor git clone -b gh-pages https://gergondet:${{ secrets.GH_PAGES_TOKEN }}@github.com/jrl-umi3218/mc_rtc /tmp/website - bundle exec jekyll build --trace -b ${TMPDIR-/tmp}/build-mc-rtc/src/mc_rtc -d /tmp/website + bundle exec jekyll build --trace -b /mc_rtc -d /tmp/website cd /tmp/website git add . git config --global user.email "arn.tanguy@gmail.com" From 5c8baf6f1675ea75a53c451c07f87708404e92a1 Mon Sep 17 00:00:00 2001 From: Arnaud TANGUY Date: Tue, 25 Mar 2025 11:53:56 +0100 Subject: [PATCH 05/57] ci: Build correct remote branch of mc_rtc --- .github/workflows/build-others.yml | 14 +++++++++++--- .github/workflows/build.yml | 11 ++++++++++- .github/workflows/docker/build-docker.sh | 15 --------------- 3 files changed, 21 insertions(+), 19 deletions(-) delete mode 100755 .github/workflows/docker/build-docker.sh diff --git a/.github/workflows/build-others.yml b/.github/workflows/build-others.yml index ab51293545..b25b954eb3 100644 --- a/.github/workflows/build-others.yml +++ b/.github/workflows/build-others.yml @@ -16,6 +16,10 @@ on: branches: - '**' +env: + GITHUB_BRANCH: ${{ github.head_ref || github.ref_name }} + GITHUB_REPOSITORY: ${{ github.repository }} + jobs: build: strategy: @@ -28,7 +32,6 @@ jobs: with: submodules: recursive - name: Clone superbuild - if: matrix.os != 'windows-latest' uses: actions/checkout@v4 with: submodules: recursive @@ -52,8 +55,13 @@ jobs: echo "::group::Build base image" docker build -t mc-rtc-ci-${{matrix.os}} . echo "::endgroup::" - echo "::group::Run install" - docker run mc-rtc-ci-${{matrix.os}} /bin/bash -c '/source/.github/workflows/docker/build-docker.sh' + echo "::group::Build in docker" + WITH_ROS_SUPPORT=ON + if [ ${{ matrix.os }} == "debian_bullseye" ]; then + WITH_ROS_SUPPORT=OFF + fi + echo "WITH_ROS_SUPPORT=${WITH_ROS_SUPPORT}" + docker run mc-rtc-ci-${{matrix.os}} /bin/bash -c "cd /source/mc-rtc-superbuild && ./utils/bootstrap-linux.sh && git config --global user.email 'arn.tanguy@gmail.com' && git config --global user.name 'Arnaud Tanguy (Automated CI update)' && mkdir -p ${TMPDIR-/tmp}/build-mc-rtc && cmake -S /source/mc-rtc-superbuild -B ${TMPDIR-/tmp}/build-mc-rtc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DVERBOSE_TEST_OUTPUT=ON -DWITH_ROS_SUPPORT=${WITH_ROS_SUPPORT} -DMC_RTC_SUPERBUILD_OVERRIDE_mc_rtc_GITHUB=${GITHUB_REPOSITORY} -DMC_RTC_SUPERBUILD_OVERRIDE_mc_rtc_GIT_TAG=origin/${GITHUB_BRANCH} && cmake --build ${TMPDIR-/tmp}/build-mc-rtc --config RelWithDebInfo" echo "::endgroup::" - name: Slack Notification if: failure() diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9cfa9a962a..531fa6796b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,6 +17,10 @@ on: branches: - '**' +env: + GITHUB_BRANCH: ${{ github.head_ref || github.ref_name }} + GITHUB_REPOSITORY: ${{ github.repository }} + jobs: build: strategy: @@ -70,7 +74,12 @@ jobs: shell: bash run: | mkdir -p ${TMPDIR-/tmp}/build-mc-rtc - cmake -S ${GITHUB_WORKSPACE}/mc-rtc-superbuild -B ${TMPDIR-/tmp}/build-mc-rtc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DINSTALL_DOCUMENTATION=ON + cmake -S ${GITHUB_WORKSPACE}/mc-rtc-superbuild \ + -B ${TMPDIR-/tmp}/build-mc-rtc \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DINSTALL_DOCUMENTATION=ON \ + -DMC_RTC_SUPERBUILD_OVERRIDE_mc_rtc_GITHUB=${GITHUB_REPOSITORY} \ + -DMC_RTC_SUPERBUILD_OVERRIDE_mc_rtc_GIT_TAG="origin/${GITHUB_BRANCH}" - name: "[superbuild] Install mc_rtc and related projects" if: matrix.os != 'windows-latest' diff --git a/.github/workflows/docker/build-docker.sh b/.github/workflows/docker/build-docker.sh deleted file mode 100755 index 5c62565dc4..0000000000 --- a/.github/workflows/docker/build-docker.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -ROS_SUPPORT="ON" -if [[ `lsb_release -sc` == "bullseye" ]]; then - ROS_SUPPORT="OFF" -fi - -ls -lr /source && -cd /source/mc-rtc-superbuild && -./utils/bootstrap-linux.sh && -git config --global user.email "arn.tanguy@gmail.com" && -git config --global user.name "Arnaud Tanguy (Automated CI update)" && -mkdir -p ${TMPDIR-/tmp}/build-mc-rtc && -cmake -S /source/mc-rtc-superbuild -B ${TMPDIR-/tmp}/build-mc-rtc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DVERBOSE_TEST_OUTPUT=ON -DWITH_ROS_SUPPORT=${ROS_SUPPORT} && -cmake --build ${TMPDIR-/tmp}/build-mc-rtc --config RelWithDebInfo From 112b0063c8b0c8dd3261467e2e22c780f42913d1 Mon Sep 17 00:00:00 2001 From: Arnaud TANGUY Date: Tue, 25 Mar 2025 17:18:55 +0100 Subject: [PATCH 06/57] ci: get the repository name in pull requests --- .github/workflows/build-others.yml | 6 ++++-- .github/workflows/build.yml | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-others.yml b/.github/workflows/build-others.yml index b25b954eb3..9ddc9607c8 100644 --- a/.github/workflows/build-others.yml +++ b/.github/workflows/build-others.yml @@ -17,8 +17,10 @@ on: - '**' env: + # Branch that triggered this workflow GITHUB_BRANCH: ${{ github.head_ref || github.ref_name }} - GITHUB_REPOSITORY: ${{ github.repository }} + # Repository that triggered this workflow + GITHUB_REPO_TRIGGER: ${{ github.actor }}/${{ github.event.repository.name }} jobs: build: @@ -61,7 +63,7 @@ jobs: WITH_ROS_SUPPORT=OFF fi echo "WITH_ROS_SUPPORT=${WITH_ROS_SUPPORT}" - docker run mc-rtc-ci-${{matrix.os}} /bin/bash -c "cd /source/mc-rtc-superbuild && ./utils/bootstrap-linux.sh && git config --global user.email 'arn.tanguy@gmail.com' && git config --global user.name 'Arnaud Tanguy (Automated CI update)' && mkdir -p ${TMPDIR-/tmp}/build-mc-rtc && cmake -S /source/mc-rtc-superbuild -B ${TMPDIR-/tmp}/build-mc-rtc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DVERBOSE_TEST_OUTPUT=ON -DWITH_ROS_SUPPORT=${WITH_ROS_SUPPORT} -DMC_RTC_SUPERBUILD_OVERRIDE_mc_rtc_GITHUB=${GITHUB_REPOSITORY} -DMC_RTC_SUPERBUILD_OVERRIDE_mc_rtc_GIT_TAG=origin/${GITHUB_BRANCH} && cmake --build ${TMPDIR-/tmp}/build-mc-rtc --config RelWithDebInfo" + docker run mc-rtc-ci-${{matrix.os}} /bin/bash -c "cd /source/mc-rtc-superbuild && ./utils/bootstrap-linux.sh && git config --global user.email 'arn.tanguy@gmail.com' && git config --global user.name 'Arnaud Tanguy (Automated CI update)' && mkdir -p ${TMPDIR-/tmp}/build-mc-rtc && cmake -S /source/mc-rtc-superbuild -B ${TMPDIR-/tmp}/build-mc-rtc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DVERBOSE_TEST_OUTPUT=ON -DWITH_ROS_SUPPORT=${WITH_ROS_SUPPORT} -DMC_RTC_SUPERBUILD_OVERRIDE_mc_rtc_GITHUB=${GITHUB_REPO_TRIGGER} -DMC_RTC_SUPERBUILD_OVERRIDE_mc_rtc_GIT_TAG=origin/${GITHUB_BRANCH} && cmake --build ${TMPDIR-/tmp}/build-mc-rtc --config RelWithDebInfo" echo "::endgroup::" - name: Slack Notification if: failure() diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 531fa6796b..f54b10a442 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,8 +18,10 @@ on: - '**' env: + # Branch that triggered this workflow GITHUB_BRANCH: ${{ github.head_ref || github.ref_name }} - GITHUB_REPOSITORY: ${{ github.repository }} + # Repository that triggered this workflow + GITHUB_REPO_TRIGGER: ${{ github.actor }}/${{ github.event.repository.name }} jobs: build: @@ -78,7 +80,7 @@ jobs: -B ${TMPDIR-/tmp}/build-mc-rtc \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DINSTALL_DOCUMENTATION=ON \ - -DMC_RTC_SUPERBUILD_OVERRIDE_mc_rtc_GITHUB=${GITHUB_REPOSITORY} \ + -DMC_RTC_SUPERBUILD_OVERRIDE_mc_rtc_GITHUB=${GITHUB_REPO_TRIGGER} \ -DMC_RTC_SUPERBUILD_OVERRIDE_mc_rtc_GIT_TAG="origin/${GITHUB_BRANCH}" - name: "[superbuild] Install mc_rtc and related projects" From 0be641f11b6c7cb7d9761108f3843080a02867e3 Mon Sep 17 00:00:00 2001 From: adallard Date: Tue, 16 Apr 2024 10:33:55 +0200 Subject: [PATCH 07/57] [RobotMsh] fix wrong vector conversion for tau, alpha, and alphaD --- include/mc_rtc/gui/RobotMsg.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/include/mc_rtc/gui/RobotMsg.h b/include/mc_rtc/gui/RobotMsg.h index 36643b2d7d..5f1c7c9497 100644 --- a/include/mc_rtc/gui/RobotMsg.h +++ b/include/mc_rtc/gui/RobotMsg.h @@ -58,12 +58,9 @@ struct RobotMsgImpl : public Element { msg_.q.resize(robot.mb().nrParams()); rbd::paramToVector(robot.mbc().q, msg_.q); - msg_.alpha.resize(robot.mb().nrDof()); - rbd::paramToVector(robot.mbc().alpha, msg_.alpha); - msg_.alphaD.resize(msg_.alpha.size()); - rbd::paramToVector(robot.mbc().alphaD, msg_.alphaD); - msg_.tau.resize(msg_.alpha.size()); - rbd::paramToVector(robot.mbc().jointTorque, msg_.tau); + msg_.alpha = rbd::dofToVector(robot.mb(),robot.mbc().alpha); + msg_.alphaD = rbd::dofToVector(robot.mb(),robot.mbc().alphaD); + msg_.tau = rbd::dofToVector(robot.mb(),robot.mbc().jointTorque); } }; From cbb6eab4d28067f52c4ac9c4a0a1a001485d23fb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 16 Apr 2024 10:07:22 +0000 Subject: [PATCH 08/57] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- include/mc_rtc/gui/RobotMsg.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/mc_rtc/gui/RobotMsg.h b/include/mc_rtc/gui/RobotMsg.h index 5f1c7c9497..c25f4270ea 100644 --- a/include/mc_rtc/gui/RobotMsg.h +++ b/include/mc_rtc/gui/RobotMsg.h @@ -58,9 +58,9 @@ struct RobotMsgImpl : public Element { msg_.q.resize(robot.mb().nrParams()); rbd::paramToVector(robot.mbc().q, msg_.q); - msg_.alpha = rbd::dofToVector(robot.mb(),robot.mbc().alpha); - msg_.alphaD = rbd::dofToVector(robot.mb(),robot.mbc().alphaD); - msg_.tau = rbd::dofToVector(robot.mb(),robot.mbc().jointTorque); + msg_.alpha = rbd::dofToVector(robot.mb(), robot.mbc().alpha); + msg_.alphaD = rbd::dofToVector(robot.mb(), robot.mbc().alphaD); + msg_.tau = rbd::dofToVector(robot.mb(), robot.mbc().jointTorque); } }; From b2f49682b47e3753b8ccdd3a91894e9bcba0674d Mon Sep 17 00:00:00 2001 From: ThomasDuvinage Date: Tue, 1 Apr 2025 17:14:28 +0900 Subject: [PATCH 09/57] [cmake] upgrade min cmake version to match cmake4.0.0 requirements --- 3rd-party/qhull/CMakeLists.txt | 2 +- plugins/ROS/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/3rd-party/qhull/CMakeLists.txt b/3rd-party/qhull/CMakeLists.txt index d29b098bb0..a723503b6b 100644 --- a/3rd-party/qhull/CMakeLists.txt +++ b/3rd-party/qhull/CMakeLists.txt @@ -67,7 +67,7 @@ # $Id: //main/2019/qhull/CMakeLists.txt#21 $$Change: 3039 $ # $DateTime: 2020/09/03 21:26:22 $$Author: bbarber $ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.5) project(qhull) set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CXX_VISIBILITY_PRESET default) diff --git a/plugins/ROS/CMakeLists.txt b/plugins/ROS/CMakeLists.txt index 95569311ba..10a89c568a 100644 --- a/plugins/ROS/CMakeLists.txt +++ b/plugins/ROS/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) if(NOT DEFINED PROJECT_VERSION) set(PROJECT_VERSION 1.0.0) From 660c765fc39288c57e8a0b57cec958c31c5fc608 Mon Sep 17 00:00:00 2001 From: Arnaud TANGUY Date: Tue, 1 Apr 2025 18:05:44 +0200 Subject: [PATCH 10/57] Revert "[cmake] upgrade min cmake version to match cmake4.0.0 requirements" This reverts commit 065c1d2187a3a75a21d0758993ee3ff0b6b61a1a. --- 3rd-party/qhull/CMakeLists.txt | 2 +- plugins/ROS/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/3rd-party/qhull/CMakeLists.txt b/3rd-party/qhull/CMakeLists.txt index a723503b6b..d29b098bb0 100644 --- a/3rd-party/qhull/CMakeLists.txt +++ b/3rd-party/qhull/CMakeLists.txt @@ -67,7 +67,7 @@ # $Id: //main/2019/qhull/CMakeLists.txt#21 $$Change: 3039 $ # $DateTime: 2020/09/03 21:26:22 $$Author: bbarber $ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.0) project(qhull) set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CXX_VISIBILITY_PRESET default) diff --git a/plugins/ROS/CMakeLists.txt b/plugins/ROS/CMakeLists.txt index 10a89c568a..95569311ba 100644 --- a/plugins/ROS/CMakeLists.txt +++ b/plugins/ROS/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.1) if(NOT DEFINED PROJECT_VERSION) set(PROJECT_VERSION 1.0.0) From 616ab5503ed189e3411d8cb14791c7e32d6d6001 Mon Sep 17 00:00:00 2001 From: Arnaud TANGUY Date: Tue, 1 Apr 2025 19:52:58 +0200 Subject: [PATCH 11/57] Reapply "[cmake] upgrade min cmake version to match cmake4.0.0 requirements" This reverts commit a8ef33f9c78fedc4fda36a63267042c8a62f1071. --- 3rd-party/qhull/CMakeLists.txt | 2 +- plugins/ROS/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/3rd-party/qhull/CMakeLists.txt b/3rd-party/qhull/CMakeLists.txt index d29b098bb0..a723503b6b 100644 --- a/3rd-party/qhull/CMakeLists.txt +++ b/3rd-party/qhull/CMakeLists.txt @@ -67,7 +67,7 @@ # $Id: //main/2019/qhull/CMakeLists.txt#21 $$Change: 3039 $ # $DateTime: 2020/09/03 21:26:22 $$Author: bbarber $ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.5) project(qhull) set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CXX_VISIBILITY_PRESET default) diff --git a/plugins/ROS/CMakeLists.txt b/plugins/ROS/CMakeLists.txt index 95569311ba..10a89c568a 100644 --- a/plugins/ROS/CMakeLists.txt +++ b/plugins/ROS/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) if(NOT DEFINED PROJECT_VERSION) set(PROJECT_VERSION 1.0.0) From 90004a4114e4539cc341da93e7ea142c52f399bc Mon Sep 17 00:00:00 2001 From: Arnaud TANGUY Date: Thu, 3 Apr 2025 17:59:37 +0200 Subject: [PATCH 12/57] chore: Update mc_rtc_new_fsm_controller according to cmake 4.0 requirements --- utils/mc_rtc_new_controller.in.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/mc_rtc_new_controller.in.py b/utils/mc_rtc_new_controller.in.py index a42ddb0864..7f7d511ed8 100755 --- a/utils/mc_rtc_new_controller.in.py +++ b/utils/mc_rtc_new_controller.in.py @@ -74,7 +74,7 @@ def new_controller( controller_name=controller_name ) fd.write( - """cmake_minimum_required(VERSION 3.1) + """cmake_minimum_required(VERSION 3.10) set(CXX_DISABLE_WERROR 1) set(CMAKE_CXX_STANDARD 11) From 6716aea22f95dc173c60f9ece1509be13a0e0256 Mon Sep 17 00:00:00 2001 From: Arnaud TANGUY Date: Fri, 4 Apr 2025 14:08:51 +0200 Subject: [PATCH 13/57] doc(tutorial): Better description on starting controllers with python3 --- .../first-controller/create-python.html | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/_i18n/en/tutorials/introduction/first-controller/create-python.html b/doc/_i18n/en/tutorials/introduction/first-controller/create-python.html index d1d0e2f3b9..c3c9501c3d 100644 --- a/doc/_i18n/en/tutorials/introduction/first-controller/create-python.html +++ b/doc/_i18n/en/tutorials/introduction/first-controller/create-python.html @@ -46,9 +46,23 @@

Running the controller

} {% endhighlight %} -

Note: if you have enforced Python 2 or Python 3 or if you have installed both then you should explicitly choose Python2 or Python3.

+

Note: if you have enforced Python 2 or Python 3 or if you have installed both then you should explicitly choose Python2 or Python3. E.g for Python3 use:

-

For this to work, we need to make sure the my_first_controller folder is on the Python path. In fact, given this configuration, mc_rtc will create your controller this way:

+{% highlight json %} +{ + "MainRobot": "JVRC1", + "Enabled": ["Python3#my_first_controller.MyFirstController"] +} +{% endhighlight %} + +

For this to work, we need to make sure the my_first_controller folder is on the Python path.

+ +{% highlight bash %} +$ export PYTHONPATH="/path/to/my_first_controller:$PYTHONPATH" +{% endhighlight %} + + +

In fact, given this configuration, mc_rtc will create your controller this way:

{% highlight python %} from my_first_controller import MyFirstController From d55dd6ba3742824a596ed1a3e7b3707269f19287 Mon Sep 17 00:00:00 2001 From: Arnaud TANGUY Date: Fri, 11 Apr 2025 12:35:58 +0200 Subject: [PATCH 14/57] bindings: Set up packaging --- binding/nanobind/CMakeLists.txt | 61 +++++++++++++++++++ binding/nanobind/README.md | 5 ++ binding/nanobind/pyproject.toml | 50 +++++++++++++++ binding/nanobind/src/mc_rtc/__init__.py | 1 + binding/nanobind/src/mc_rtc/mc_rtc_module.cpp | 10 +++ binding/nanobind/tests/test_basic.py | 4 ++ 6 files changed, 131 insertions(+) create mode 100644 binding/nanobind/CMakeLists.txt create mode 100644 binding/nanobind/README.md create mode 100644 binding/nanobind/pyproject.toml create mode 100644 binding/nanobind/src/mc_rtc/__init__.py create mode 100644 binding/nanobind/src/mc_rtc/mc_rtc_module.cpp create mode 100644 binding/nanobind/tests/test_basic.py diff --git a/binding/nanobind/CMakeLists.txt b/binding/nanobind/CMakeLists.txt new file mode 100644 index 0000000000..342b2f3ec5 --- /dev/null +++ b/binding/nanobind/CMakeLists.txt @@ -0,0 +1,61 @@ +# Set the minimum CMake version and policies for highest tested version +cmake_minimum_required(VERSION 3.15...4.0) + +project(mc_rtc LANGUAGES CXX) + +# Warn if the user invokes CMake directly +if (NOT SKBUILD) + message(WARNING "\ + This CMake file is meant to be executed using 'scikit-build-core'. + Running it directly will almost certainly not produce the desired + result. If you are a user trying to install this package, use the + command below, which will install all necessary build dependencies, + compile the package in an isolated environment, and then install it. + ===================================================================== + $ pip install . + ===================================================================== + If you are a software developer, and this is your own package, then + it is usually much more efficient to install the build dependencies + in your environment once and use the following command that avoids + a costly creation of a new virtual environment at every compilation: + ===================================================================== + $ pip install nanobind scikit-build-core[pyproject] + $ pip install --no-build-isolation -ve . + ===================================================================== + You may optionally add -Ceditable.rebuild=true to auto-rebuild when + the package is imported. Otherwise, you need to rerun the above + after editing C++ files.") +endif() + +# Try to import all Python components potentially needed by nanobind +find_package(Python 3.8 + REQUIRED COMPONENTS Interpreter Development.Module + OPTIONAL_COMPONENTS Development.SABIModule) + +# Import nanobind through CMake's find_package mechanism +find_package(nanobind CONFIG REQUIRED) + +# We are now ready to compile the actual extension module +nanobind_add_module( + # Name of the extension + mc_rtc_python + + # Target the stable ABI for Python 3.12+, which reduces + # the number of binary wheels that must be built. This + # does nothing on older Python versions + STABLE_ABI + + # Build libnanobind statically and merge it into the + # extension (which itself remains a shared library) + # + # If your project builds multiple extensions, you can + # replace this flag by NB_SHARED to conserve space by + # reusing a shared libnanobind across libraries + NB_STATIC + + # Source code goes here + src/mc_rtc/mc_rtc_module.cpp +) + +# Install directive for scikit-build-core +install(TARGETS mc_rtc_python LIBRARY DESTINATION mc_rtc) diff --git a/binding/nanobind/README.md b/binding/nanobind/README.md new file mode 100644 index 0000000000..903d6f3863 --- /dev/null +++ b/binding/nanobind/README.md @@ -0,0 +1,5 @@ +# nanobind python bindings for mc_rtc + +## Build + +See https://nanobind.readthedocs.io/en/latest/packaging.html for details diff --git a/binding/nanobind/pyproject.toml b/binding/nanobind/pyproject.toml new file mode 100644 index 0000000000..93cd335f62 --- /dev/null +++ b/binding/nanobind/pyproject.toml @@ -0,0 +1,50 @@ +[build-system] +requires = ["scikit-build-core >=0.10", "nanobind >=1.3.2"] +build-backend = "scikit_build_core.build" + +[project] +name = "mc_rtc" +version = "2.12.0" +description = "Python bindings for the mc_rtc robotics library" +readme = "README.md" +requires-python = ">=3.8" +authors = [ + { name = "Arnaud TANGUY", email = "arn.tanguy@gmail.com" }, +] +classifiers = [ + "License :: BSD", +] +# Optional: runtime dependency specification +# dependencies = [ "cryptography >=41.0" ] + +[project.urls] +Homepage = "https://jrl.cnrs.fr/mc_rtc/" +Repository = "https://github.com/jrl-umi3218/mc_rtc" +Documentation = "https://jrl.cnrs.fr/mc_rtc/" +Issues = "https://github.com/jrl-umi3218/mc_rtc/issues" +Changelog = "https://github.com/jrl-umi3218/mc_rtc/releases/tag/v2.12.0" + +[tool.scikit-build] +# Protect the configuration against future changes in scikit-build-core +minimum-version = "0.4" + +# Setuptools-style build caching in a local directory +build-dir = "build/{wheel_tag}" + +# Build stable ABI wheels for CPython 3.12+ +wheel.py-api = "cp312" + +[tool.cibuildwheel] +# necessary to see build output from the actual compilation +build-verbosity = 1 + +# Run pytest to ensure that the package was correctly built +test-command = "pytest {project}/tests" +test-requires = "pytest" + +# Don't test Python 3.8 wheels on macOS/arm64 +test-skip="cp38-macosx_*:arm64" + +# Needed for full C++17 support +[tool.cibuildwheel.macos.environment] +MACOSX_DEPLOYMENT_TARGET = "10.14" diff --git a/binding/nanobind/src/mc_rtc/__init__.py b/binding/nanobind/src/mc_rtc/__init__.py new file mode 100644 index 0000000000..c11876344c --- /dev/null +++ b/binding/nanobind/src/mc_rtc/__init__.py @@ -0,0 +1 @@ +from .mc_rtc_python import add, __doc__ diff --git a/binding/nanobind/src/mc_rtc/mc_rtc_module.cpp b/binding/nanobind/src/mc_rtc/mc_rtc_module.cpp new file mode 100644 index 0000000000..a2f057fb5f --- /dev/null +++ b/binding/nanobind/src/mc_rtc/mc_rtc_module.cpp @@ -0,0 +1,10 @@ +#include + +namespace nb = nanobind; + +using namespace nb::literals; + +NB_MODULE(mc_rtc_python, m) { + m.doc() = "This is a \"hello world\" example with nanobind"; + m.def("add", [](int a, int b, int c) { return a + b; }, "a"_a, "b"_a, "c"_a); +} diff --git a/binding/nanobind/tests/test_basic.py b/binding/nanobind/tests/test_basic.py new file mode 100644 index 0000000000..0677ada766 --- /dev/null +++ b/binding/nanobind/tests/test_basic.py @@ -0,0 +1,4 @@ +import mc_rtc as m + +def test_add(): + assert m.add(1, 2) == 3 From 719df24bb0c1a65a088b8e466787ac554c88bd85 Mon Sep 17 00:00:00 2001 From: Arnaud TANGUY Date: Fri, 11 Apr 2025 17:58:41 +0200 Subject: [PATCH 15/57] bindings: wip integration of mc_rtc::Configuration --- binding/nanobind/.gitignore | 2 + binding/nanobind/CMakeLists.txt | 6 +- .../include/mc_rtc_python/mc_rtc_module.h | 8 ++ binding/nanobind/include/typelist_visitor.h | 76 ++++++++++++++++ binding/nanobind/src/mc_rtc/Configuration.cpp | 91 +++++++++++++++++++ binding/nanobind/src/mc_rtc/__init__.py | 2 +- binding/nanobind/src/mc_rtc/mc_rtc_module.cpp | 4 +- .../tests/mc_rtc/test_configuration.py | 8 ++ 8 files changed, 194 insertions(+), 3 deletions(-) create mode 100644 binding/nanobind/.gitignore create mode 100644 binding/nanobind/include/mc_rtc_python/mc_rtc_module.h create mode 100644 binding/nanobind/include/typelist_visitor.h create mode 100644 binding/nanobind/src/mc_rtc/Configuration.cpp create mode 100644 binding/nanobind/tests/mc_rtc/test_configuration.py diff --git a/binding/nanobind/.gitignore b/binding/nanobind/.gitignore new file mode 100644 index 0000000000..7e45d7b766 --- /dev/null +++ b/binding/nanobind/.gitignore @@ -0,0 +1,2 @@ +CMakeCache.txt +CMakeFiles/ diff --git a/binding/nanobind/CMakeLists.txt b/binding/nanobind/CMakeLists.txt index 342b2f3ec5..7e42223098 100644 --- a/binding/nanobind/CMakeLists.txt +++ b/binding/nanobind/CMakeLists.txt @@ -1,7 +1,7 @@ # Set the minimum CMake version and policies for highest tested version cmake_minimum_required(VERSION 3.15...4.0) -project(mc_rtc LANGUAGES CXX) +project(mc_rtc_python) # Warn if the user invokes CMake directly if (NOT SKBUILD) @@ -55,7 +55,11 @@ nanobind_add_module( # Source code goes here src/mc_rtc/mc_rtc_module.cpp + src/mc_rtc/Configuration.cpp ) +find_package(mc_rtc REQUIRED) +target_link_libraries(mc_rtc_python PUBLIC mc_rtc::mc_rtc_utils) +target_include_directories(mc_rtc_python PUBLIC $) # Install directive for scikit-build-core install(TARGETS mc_rtc_python LIBRARY DESTINATION mc_rtc) diff --git a/binding/nanobind/include/mc_rtc_python/mc_rtc_module.h b/binding/nanobind/include/mc_rtc_python/mc_rtc_module.h new file mode 100644 index 0000000000..f35ffd6d9a --- /dev/null +++ b/binding/nanobind/include/mc_rtc_python/mc_rtc_module.h @@ -0,0 +1,8 @@ +#pragma once +#include + +namespace mc_rtc_python { + + void bind_configuration(nanobind::module_ & m); + +} diff --git a/binding/nanobind/include/typelist_visitor.h b/binding/nanobind/include/typelist_visitor.h new file mode 100644 index 0000000000..1bb86059f7 --- /dev/null +++ b/binding/nanobind/include/typelist_visitor.h @@ -0,0 +1,76 @@ +#pragma once + +// XXX: Make it independent from nanobind and move to mc_rtc + +#include +#include +#include + +namespace nb = nanobind; + +namespace mc_rtc +{ + namespace internal + { + // Compile-time iteration over a typelist + // Applies a Visitor for each type T + + template struct TypeList { }; + + namespace Detail { + + // Forward declare, in order to pattern match via specialization + template struct TypeVisitor; + + // Pattern match to extract the TypeLists types into Args + template