Skip to content

Commit

Permalink
MANN: support Windows (#686)
Browse files Browse the repository at this point in the history
  • Loading branch information
traversaro authored Jun 22, 2023
1 parent df2d78f commit 91ad0cf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/conda-forge-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
liblie-group-controllers eigen qhull "casadi>=3.5.5" cppad spdlog \
nlohmann_json manif manifpy=*=*_12 pybind11 numpy pytest scipy opencv pcl \
tomlplusplus libunicycle-footstep-planner "icub-models>=1.23.4" \
ros-humble-rclcpp
ros-humble-rclcpp onnxruntime-cpp
- name: Linux-only Dependencies [Linux]
if: contains(matrix.os, 'ubuntu')
Expand All @@ -52,7 +52,7 @@ jobs:
mamba install manifpy=*=*_12 expat-cos6-x86_64 libselinux-cos6-x86_64 libxau-cos6-x86_64 libxcb-cos6-x86_64 \
libxdamage-cos6-x86_64 libxext-cos6-x86_64 libxfixes-cos6-x86_64 \
libxxf86vm-cos6-x86_64 mesalib mesa-libgl-cos6-x86_64 \
mesa-libgl-devel-cos6-x86_64 onnxruntime-cpp
mesa-libgl-devel-cos6-x86_64
- name: maxOS-only Dependencies [macOS]
if: contains(matrix.os, 'macos')
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ All notable changes to this project are documented in this file.

## [unreleased]
### Added
- Implement a class to perform inference with the [MANN network](https://github.com/ami-iit/mann-pytorch) (https://github.com/ami-iit/bipedal-locomotion-framework/pull/652)
- Implement a class to perform inference with the [MANN network](https://github.com/ami-iit/mann-pytorch) (https://github.com/ami-iit/bipedal-locomotion-framework/pull/652, https://github.com/ami-iit/bipedal-locomotion-framework/pull/686)
- Add some useful methods to the `SubModel` and `SubModelKinDynWrapper` classes (https://github.com/ami-iit/bipedal-locomotion-framework/pull/661)
- Implement `Dynamics`, `ZeroVelocityDynamics`, and `JointVelocityStateDynamics` classes in `RobotDynamicsEstimator` (https://github.com/ami-iit/bipedal-locomotion-framework/pull/662)
- Implement `AccelerometerMeasurementDynamics` and `GyroscopeMeasurementDynamics` classes in `RobotDynamicsEstimator` (https://github.com/ami-iit/bipedal-locomotion-framework/pull/666)
Expand Down
3 changes: 1 addition & 2 deletions cmake/Findonnxruntime.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ find_path(onnxruntime_INCLUDE_DIR
PATH_SUFFIXES onnxruntime/core/session)
mark_as_advanced(onnxruntime_INCLUDE_DIR)
find_library(onnxruntime_LIBRARY
NAMES onnxruntime)
mark_as_advanced(onnxruntime_LIBRARY)
NAMES onnxruntime onnxruntime_conda)
mark_as_advanced(onnxruntime_LIBRARY)

find_package_handle_standard_args(onnxruntime DEFAULT_MSG onnxruntime_INCLUDE_DIR onnxruntime_LIBRARY)
Expand Down
7 changes: 6 additions & 1 deletion src/ML/src/MANN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,13 @@ bool MANN::initialize(
return false;
}

// Ort::Session's constructor is OS-dependent, wants wchar_t* on Windows and char* on other OSs
// Note: this only works with single-byte characters, such as ASCII or ISO-8859-1,
// see https://stackoverflow.com/questions/2573834/c-convert-string-or-char-to-wstring-or-wchar-t
std::basic_string<ORTCHAR_T> networkModelPathAsOrtString(networkModelPath.begin(), networkModelPath.end());

m_pimpl->session = std::make_unique<Ort::Session>(m_pimpl->env,
networkModelPath.c_str(),
networkModelPathAsOrtString.c_str(),
Ort::SessionOptions{nullptr});

if (m_pimpl->session == nullptr)
Expand Down

0 comments on commit 91ad0cf

Please sign in to comment.