Skip to content

Commit

Permalink
Merge pull request #380 from dic-iit/conda_forge_ci_python
Browse files Browse the repository at this point in the history
Enable Python bindings in conda-forge CI and fix Python bindings compilation and tests on MSVC
  • Loading branch information
GiulioRomualdi authored Jul 29, 2021
2 parents b23cac8 + 99f00c7 commit a2cda7d
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 14 deletions.
41 changes: 31 additions & 10 deletions .github/workflows/conda-forge-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
- cron: '0 2 * * *'

env:
manif_TAG: 0.0.4
tomlplusplus_TAG: v2.4.0

jobs:
Expand Down Expand Up @@ -37,7 +36,14 @@ jobs:
# Compilation related dependencies
mamba install cmake compilers make ninja pkg-config
# Actual dependencies
mamba install -c robotology idyntree yarp libmatio matio-cpp lie-group-controllers eigen qhull "casadi>=3.5.5" cppad spdlog catch2 nlohmann_json manif
mamba install -c robotology idyntree yarp libmatio matio-cpp lie-group-controllers eigen qhull "casadi>=3.5.5" cppad spdlog catch2 nlohmann_json manif manifpy pybind11 numpy pytest scipy
- name: Windows-only Dependencies [Windows]
if: contains(matrix.os, 'windows')
shell: bash -l {0}
run: |
# Compilation related dependencies
mamba install vs2019_win-64
- name: Dependencies [tomlplusplus - Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
Expand Down Expand Up @@ -74,25 +80,40 @@ jobs:
mkdir -p build
cd build
cmake -GNinja -DBUILD_TESTING:BOOL=ON -DFRAMEWORK_COMPILE_IK:BOOL=OFF \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
-DFRAMEWORK_COMPILE_PYTHON_BINDINGS:BOOL=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
- name: Build [Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
cd build
cmake --build . --config ${{ matrix.build_type }}
- name: Test [Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
cd build
ctest --output-on-failure -C ${{ matrix.build_type }}
- name: Configure [Windows]
if: contains(matrix.os, 'windows')
shell: bash -l {0}
shell: cmd /C call {0}
run: |
mkdir -p build
cd build
cmake -G"Visual Studio 16 2019" -DBUILD_TESTING:BOOL=ON -DFRAMEWORK_COMPILE_IK:BOOL=OFF \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
cmake -GNinja -DBUILD_TESTING:BOOL=ON -DFRAMEWORK_COMPILE_IK:BOOL=OFF -DFRAMEWORK_COMPILE_PYTHON_BINDINGS:BOOL=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
- name: Build
shell: bash -l {0}
- name: Build [Windows]
if: contains(matrix.os, 'windows')
shell: cmd /C call {0}
run: |
cd build
cmake --build . --config ${{ matrix.build_type }}
- name: Test
shell: bash -l {0}
- name: Test [Windows]
if: contains(matrix.os, 'windows')
shell: cmd /C call {0}
run: |
cd build
ctest --output-on-failure -C ${{ matrix.build_type }}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ All notable changes to this project are documented in this file.

### Fix
- Fixed the crashing of `YarpSensorBridge` while trying to access unconfigured control board sensors data by adding some checks (https://github.com/dic-iit/bipedal-locomotion-framework/pull/378)
- Fixed the compilation of Python bindings (enabled by the `FRAMEWORK_COMPILE_PYTHON_BINDINGS` CMake option) when compiling with Visual Studio (https://github.com/dic-iit/bipedal-locomotion-framework/pull/380).

## [0.2.0] - 2021-06-15
### Added
Expand Down
10 changes: 10 additions & 0 deletions bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ set_target_properties(pybind11_blf PROPERTIES

if(FRAMEWORK_TEST_PYTHON_BINDINGS)
add_subdirectory(tests)

# For testing on Windows we copy the blf .dll in the same
# directory of the bindings
if(WIN32)
add_custom_command(TARGET pybind11_blf POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
$<TARGET_FILE_DIR:BipedalLocomotion::Math>
$<TARGET_FILE_DIR:pybind11_blf>)
endif()
endif()

# Output package is:
Expand All @@ -56,3 +65,4 @@ install(TARGETS pybind11_blf DESTINATION ${PYTHON_INSTDIR})
# Install the __init__.py file
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/all.py"
DESTINATION ${PYTHON_INSTDIR})

8 changes: 4 additions & 4 deletions bindings/python/FloatingBaseEstimators/src/LeggedOdometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ void CreateLeggedOdometry(pybind11::module& module)
py::arg("encoder_speeds"))
.def("advance", &LeggedOdometry::advance)
.def("reset_estimator",
py::overload_cast<const InternalState&>(&LeggedOdometry::resetEstimator),
py::overload_cast<const InternalState&>(&FloatingBaseEstimator::resetEstimator),
py::arg("new_state"))
.def("reset_estimator",
py::overload_cast<const Eigen::Quaterniond&, const Eigen::Vector3d&>(
&LeggedOdometry::resetEstimator),
py::arg("new_imu_orientation"),
py::arg("new_imu_position"))
&FloatingBaseEstimator::resetEstimator),
py::arg("new_base_orientation"),
py::arg("new_base_position"))
.def("reset_estimator", py::overload_cast<>(&LeggedOdometry::resetEstimator))
.def("reset_estimator",
py::overload_cast<const std::string&, const Eigen::Quaterniond&, const Eigen::Vector3d&>(
Expand Down

0 comments on commit a2cda7d

Please sign in to comment.