From 2867b2d67a1ebef70bdcdc3db791bed6395a596a Mon Sep 17 00:00:00 2001 From: Pierre Gergondet Date: Thu, 24 Sep 2020 15:26:04 +0800 Subject: [PATCH 01/10] [ci] Use binaries to speed up CI - vcpkg on Windows/macOS - Ubuntu packages on Ubuntu --- .github/workflows/build.yml | 41 ++++++++++----------------- .github/workflows/package.yml | 3 ++ .github/workflows/sources/package.yml | 3 ++ vcpkg.json | 12 ++++++++ 4 files changed, 33 insertions(+), 26 deletions(-) create mode 100644 vcpkg.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index baf85a431..1ce44619f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,7 +32,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-16.04, ubuntu-18.04, macos-latest, windows-latest] + os: [ubuntu-16.04, ubuntu-18.04, ubuntu-20.04, macos-latest, windows-latest] build-type: [Debug, RelWithDebInfo] compiler: [gcc, clang] exclude: @@ -44,42 +44,31 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 with: submodules: recursive - - name: Cleanup windows environment - shell: bash - run: | - set -x - rm -rf /c/hostedtoolcache/windows/Boost/1.72.0/lib/cmake/Boost-1.72.0 - if: matrix.os == 'windows-latest' - name: Install dependencies uses: jrl-umi3218/github-actions/install-dependencies@master with: compiler: ${{ matrix.compiler }} build-type: ${{ matrix.build-type }} ubuntu: | - apt: cython cython3 python-nose python3-nose python-numpy python3-numpy python-coverage python3-coverage python-setuptools python3-setuptools libeigen3-dev doxygen doxygen-latex libboost-all-dev libtinyxml2-dev libyaml-cpp-dev + apt: cython cython3 python-nose python3-nose python-numpy python3-numpy python-coverage python3-coverage python-setuptools python3-setuptools doxygen doxygen-latex libboost-all-dev libeigen-qld-dev libsch-core-dev librbdyn-dev python-eigen-qld python3-eigen-qld python-sch-core python3-sch-core python-rbdyn python3-rbdyn + apt-mirrors: + multi-contact: + mirror: https://dl.bintray.com/gergondet/multi-contact-head + key: 892EA6EE273707C6495A6FB6220D644C64666806 macos: | cask: gfortran - brew: eigen boost tinyxml2 yaml-cpp - pip: Cython coverage nose numpy + vcpkg: + repo: jrl-umi3218/vcpkg + user: ${{ github.actor }} + token: ${{ github.token }} windows: | - pip: Cython coverage nose numpy - github: - - path: eigenteam/eigen-git-mirror - ref: 3.3.7 - - path: leethomason/tinyxml2 - ref: 7.1.0 - - path: jbeder/yaml-cpp - ref: 29dcf92f870ee51cce8d68f8fcfe228942e8dfe1 - github: | - - path: jrl-umi3218/Eigen3ToPython - - path: jrl-umi3218/SpaceVecAlg - - path: jrl-umi3218/sch-core - - path: jrl-umi3218/eigen-qld - - path: jrl-umi3218/sch-core-python - - path: jrl-umi3218/RBDyn + vcpkg: + repo: jrl-umi3218/vcpkg + user: ${{ github.actor }} + token: ${{ github.token }} - name: Build and test uses: jrl-umi3218/github-actions/build-cmake-project@master with: diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index b45693427..241ef9cfc 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -5,6 +5,9 @@ on: types: - package-master - package-release + pull_request: + branches: + - "**" push: paths-ignore: - doc/** diff --git a/.github/workflows/sources/package.yml b/.github/workflows/sources/package.yml index 50fe807d0..a3c20699c 100644 --- a/.github/workflows/sources/package.yml +++ b/.github/workflows/sources/package.yml @@ -20,6 +20,9 @@ name: Package Tasks on: repository_dispatch: types: [package-master, package-release] + pull_request: + branches: + - "**" push: paths-ignore: # Changes to those files don't mandate rebuilding a package diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 000000000..bd589041f --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "tasks", + "version-string": "1.3.0", + "homepage": "https://github.com/jrl-umi3218/Tasks", + "description": "Real time control of robots using constrained optimization", + "dependencies": [ + "boost-timer", + "eigen-qld", + "rbdyn", + "sch-core" + ] +} From a07a5559fcd2d8c64592ba84cbbd22aa36009a21 Mon Sep 17 00:00:00 2001 From: Pierre Gergondet Date: Thu, 24 Sep 2020 17:32:20 +0800 Subject: [PATCH 02/10] [vcpkg] Add boost-test to manifest --- vcpkg.json | 1 + 1 file changed, 1 insertion(+) diff --git a/vcpkg.json b/vcpkg.json index bd589041f..21045263a 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -4,6 +4,7 @@ "homepage": "https://github.com/jrl-umi3218/Tasks", "description": "Real time control of robots using constrained optimization", "dependencies": [ + "boost-test", "boost-timer", "eigen-qld", "rbdyn", From 9a22d436e49ccdc518dac1dfc534a4efc7a12447 Mon Sep 17 00:00:00 2001 From: Pierre Gergondet Date: Thu, 24 Sep 2020 18:25:39 +0800 Subject: [PATCH 03/10] [ci] Disable Python bindings on Windows/macOS --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1ce44619f..683d6c34b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -74,6 +74,8 @@ jobs: with: compiler: ${{ matrix.compiler }} build-type: ${{ matrix.build-type }} + windows-options: -DPYTHON_BINDING:BOOL=OFF + macos-options: -DPYTHON_BINDING:BOOL=OFF - name: Upload documentation # Only run on master branch and for one configuration if: matrix.os == 'ubuntu-18.04' && matrix.build-type == 'RelWithDebInfo' && matrix.compiler == 'gcc' && github.ref == 'refs/heads/master' From c847b3d8ecbe7349fbfdd5e2805692be06b12138 Mon Sep 17 00:00:00 2001 From: Pierre Gergondet Date: Thu, 24 Sep 2020 19:40:42 +0800 Subject: [PATCH 04/10] [bindings] Swap contact constraint type in Python test It should be fine but there's some strange issue on focal with clang and RelWithDebInfo... --- binding/python/tests/TestQPMultiRobot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binding/python/tests/TestQPMultiRobot.py b/binding/python/tests/TestQPMultiRobot.py index 7a7cdbf1b..2f2a894f2 100644 --- a/binding/python/tests/TestQPMultiRobot.py +++ b/binding/python/tests/TestQPMultiRobot.py @@ -365,7 +365,7 @@ def test(self): multiCoM = tasks.qp.MultiCoMTask(mbs, [0,1], comD, 10, 500) multiCoM.updateInertialParameters(mbs) - contCstrSpeed = tasks.qp.ContactSpeedConstr(0.001) + contCstrSpeed = tasks.qp.ContactAccConstr() solver.addTask(posture1Task) solver.addTask(posture2Task) From af76baa83a78983879eb4ef160c1b96d3868f517 Mon Sep 17 00:00:00 2001 From: Pierre Gergondet Date: Thu, 24 Sep 2020 21:48:43 +0800 Subject: [PATCH 05/10] [tests] Don't force Boost dynamic linkage --- tests/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index af9609861..7b6af5c6c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -5,14 +5,12 @@ enable_testing() find_package(Boost REQUIRED COMPONENTS unit_test_framework timer system) -add_definitions(-DBOOST_TEST_DYN_LINK) set(HEADERS arms.h) macro(addUnitTest name) add_executable(${name} ${name}.cpp ${HEADERS}) target_link_libraries(${name} PRIVATE Tasks Boost::unit_test_framework) - target_compile_definitions(${name} PRIVATE -DBOOST_TEST_DYN_LINK) add_test(${name}Unit ${name}) # Adding a project configuration file (for MSVC only) generate_msvc_dot_user_file(${name}) From 827ca5abed897034cc416d8d72dc8b6c0f58e27f Mon Sep 17 00:00:00 2001 From: Pierre Gergondet Date: Fri, 25 Sep 2020 11:22:03 +0800 Subject: [PATCH 06/10] [tests] Conditionally add BOOST_ALL_DYN_LINK --- tests/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 7b6af5c6c..efc9031eb 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -11,6 +11,9 @@ set(HEADERS arms.h) macro(addUnitTest name) add_executable(${name} ${name}.cpp ${HEADERS}) target_link_libraries(${name} PRIVATE Tasks Boost::unit_test_framework) + if(NOT Boost_USE_STATIC_LIBS) + target_compile_definitions(${name} PRIVATE -DBOOST_ALL_DYN_LINK) + endif() add_test(${name}Unit ${name}) # Adding a project configuration file (for MSVC only) generate_msvc_dot_user_file(${name}) From 4a164bd882aae8be614ed5cddbe8d3579fef17b7 Mon Sep 17 00:00:00 2001 From: Pierre Gergondet Date: Fri, 25 Sep 2020 11:53:33 +0800 Subject: [PATCH 07/10] [cmake] Add vcpkg installed path if defined --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index eb6083373..6b97fa3d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,9 @@ endif() # of the main library when launching ctest with RUN_TESTS if(MSVC) set(CMAKE_MSVCIDE_RUN_PATH "\$(SolutionDir)/src/\$(Configuration)") + if(_VCPKG_INSTALLED_DIR) + set(CMAKE_MSVCIDE_RUN_PATH "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin;${CMAKE_MSVCIDE_RUN_PATH}") + endif() endif(MSVC) add_subdirectory(src) From 547852b1a8e754a2473e66c744e8f5eae8841f2c Mon Sep 17 00:00:00 2001 From: Pierre Gergondet Date: Fri, 25 Sep 2020 15:02:43 +0800 Subject: [PATCH 08/10] [tests] Switch a constraint type --- tests/QPMultiRobotTest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/QPMultiRobotTest.cpp b/tests/QPMultiRobotTest.cpp index 212d1df29..e924ebe0e 100644 --- a/tests/QPMultiRobotTest.cpp +++ b/tests/QPMultiRobotTest.cpp @@ -126,7 +126,7 @@ BOOST_AUTO_TEST_CASE(TwoArmContactTest) qp::OrientationTask oriTask(mbs, 1, "b3", oriD); qp::SetPointTask oriTaskSp(mbs, 1, &oriTask, 1000., 1.); - qp::ContactSpeedConstr contCstrSpeed(0.001); + qp::ContactAccConstr contCstrSpeed; contCstrSpeed.addToSolver(solver); solver.addTask(&oriTaskSp); @@ -375,7 +375,7 @@ BOOST_AUTO_TEST_CASE(TwoArmMultiCoMTest) // call this method just for test coverage multiCoM.updateInertialParameters(mbs); - qp::ContactSpeedConstr contCstrSpeed(0.001); + qp::ContactAccConstr contCstrSpeed; solver.addTask(&posture1Task); solver.addTask(&posture2Task); From 3fb8bd4e6bbbdfeb6e5e87402ab75eef505a6897 Mon Sep 17 00:00:00 2001 From: Pierre Gergondet Date: Fri, 25 Sep 2020 15:56:14 +0800 Subject: [PATCH 09/10] Explictly get an Eigen::Vector6d Avoid a bug with clang and MSVC Revert "[tests] Switch a constraint type" This reverts commit 547852b1a8e754a2473e66c744e8f5eae8841f2c. Revert "[bindings] Swap contact constraint type in Python test" This reverts commit c847b3d8ecbe7349fbfdd5e2805692be06b12138. --- binding/python/tests/TestQPMultiRobot.py | 2 +- src/QPContactConstr.cpp | 2 +- tests/QPMultiRobotTest.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/binding/python/tests/TestQPMultiRobot.py b/binding/python/tests/TestQPMultiRobot.py index 2f2a894f2..7a7cdbf1b 100644 --- a/binding/python/tests/TestQPMultiRobot.py +++ b/binding/python/tests/TestQPMultiRobot.py @@ -365,7 +365,7 @@ def test(self): multiCoM = tasks.qp.MultiCoMTask(mbs, [0,1], comD, 10, 500) multiCoM.updateInertialParameters(mbs) - contCstrSpeed = tasks.qp.ContactAccConstr() + contCstrSpeed = tasks.qp.ContactSpeedConstr(0.001) solver.addTask(posture1Task) solver.addTask(posture2Task) diff --git a/src/QPContactConstr.cpp b/src/QPContactConstr.cpp index 46bde327c..020cda232 100644 --- a/src/QPContactConstr.cpp +++ b/src/QPContactConstr.cpp @@ -106,7 +106,7 @@ void ContactConstr::ContactData::update(const std::vector auto X_b1_b2_current = X_0_b2 * X_0_b1.inv(); auto X_b2_cf_current = X_b1_cf * X_b1_b2_current.inv(); // Only apply the motion allowed by the DoF selection - auto error = revDof * sva::transformError(X_b2_cf_current.inv(), X_b2_cf.inv()).vector(); + Eigen::Vector6d error = revDof * sva::transformError(X_b2_cf_current.inv(), X_b2_cf.inv()).vector(); auto offset = sva::PTransformd(sva::RotX(error(0)) * sva::RotY(error(1)) * sva::RotZ(error(2)), Eigen::Vector3d(error(3), error(4), error(5))); X_b2_cf = offset * X_b2_cf; diff --git a/tests/QPMultiRobotTest.cpp b/tests/QPMultiRobotTest.cpp index e924ebe0e..212d1df29 100644 --- a/tests/QPMultiRobotTest.cpp +++ b/tests/QPMultiRobotTest.cpp @@ -126,7 +126,7 @@ BOOST_AUTO_TEST_CASE(TwoArmContactTest) qp::OrientationTask oriTask(mbs, 1, "b3", oriD); qp::SetPointTask oriTaskSp(mbs, 1, &oriTask, 1000., 1.); - qp::ContactAccConstr contCstrSpeed; + qp::ContactSpeedConstr contCstrSpeed(0.001); contCstrSpeed.addToSolver(solver); solver.addTask(&oriTaskSp); @@ -375,7 +375,7 @@ BOOST_AUTO_TEST_CASE(TwoArmMultiCoMTest) // call this method just for test coverage multiCoM.updateInertialParameters(mbs); - qp::ContactAccConstr contCstrSpeed; + qp::ContactSpeedConstr contCstrSpeed(0.001); solver.addTask(&posture1Task); solver.addTask(&posture2Task); From 1a36700f2a16b4a383bee082311eef501de649b8 Mon Sep 17 00:00:00 2001 From: Pierre Gergondet Date: Sat, 26 Sep 2020 17:21:10 +0800 Subject: [PATCH 10/10] [cmake] Add vcpkg debug install path first to run debug tests --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b97fa3d7..23e8d1cc1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,9 @@ endif() if(MSVC) set(CMAKE_MSVCIDE_RUN_PATH "\$(SolutionDir)/src/\$(Configuration)") if(_VCPKG_INSTALLED_DIR) - set(CMAKE_MSVCIDE_RUN_PATH "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin;${CMAKE_MSVCIDE_RUN_PATH}") + set(VCPKG_INSTALL_PREFIX "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_PREFIX}") + # Only debug actually exists but we make sure it's first in that case + set(CMAKE_MSVCIDE_RUN_PATH "${VCPKG_INSTALL_PREFIX}/\$(Configuration)/bin;${VCPKG_INSTALL_PREFIX}/bin;${CMAKE_MSVCIDE_RUN_PATH}") endif() endif(MSVC)