Skip to content

Commit

Permalink
Issue #576: Rework after review.
Browse files Browse the repository at this point in the history
- Further updated environment variables in the cmake/templates.
- Removed transitive dependencies from the project cmake configuration.
- Remove tabs from the conda activate/deactivate msh files.
- Updated documentation.
  • Loading branch information
nunoguedelha committed Apr 24, 2021
1 parent 7105c8d commit a0b850d
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 38 deletions.
8 changes: 1 addition & 7 deletions cmake/Buildmatlab-whole-body-simulator.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,14 @@
include(YCMEPHelper)
include(FindOrBuildPackage)

find_or_build_package(YARP QUIET)
find_or_build_package(yarp-matlab-bindings QUIET)
find_or_build_package(WBToolbox QUIET)
find_or_build_package(iDynTree QUIET)
find_or_build_package(qpOASES QUIET)
find_or_build_package(icub-models QUIET)
find_or_build_package(whole-body-controllers QUIET)

set(matlab-whole-body-simulator_DEPENDS "")
list(APPEND matlab-whole-body-simulator_DEPENDS YARP)
list(APPEND matlab-whole-body-simulator_DEPENDS yarp-matlab-bindings)
list(APPEND matlab-whole-body-simulator_DEPENDS WBToolbox)
list(APPEND matlab-whole-body-simulator_DEPENDS iDynTree)
list(APPEND matlab-whole-body-simulator_DEPENDS qpOASES)
list(APPEND matlab-whole-body-simulator_DEPENDS icub-models)
list(APPEND matlab-whole-body-simulator_DEPENDS whole-body-controllers)

Expand All @@ -26,7 +20,7 @@ ycm_ep_helper(matlab-whole-body-simulator TYPE GIT
TAG master
COMPONENT dynamics
FOLDER src
DEPENDS matlab-whole-body-simulator_DEPENDS)
DEPENDS ${matlab-whole-body-simulator_DEPENDS})

# Metadata for conda package generation
# If we do not set the package name, by default the repo name would be used
Expand Down
5 changes: 4 additions & 1 deletion cmake/template/addPathsToUserEnvVariables.ps1.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Add-ValueToUserEnvVariable CMAKE_PREFIX_PATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREF
# Setup the path of blockfactory plugins
Add-ValueToUserEnvVariable BLOCKFACTORY_PLUGIN_PATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\@BLOCKFACTORY_PLUGIN_PATH_DIRECTORY@\blockfactory";

# Setup to find resources in URDF and SDF files
# Setup to find resources in URDF and SDF files
Add-ValueToUserEnvVariable ROS_PACKAGE_PATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\share"
Add-ValueToUserEnvVariable AMENT_PREFIX_PATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\share"
Add-ValueToUserEnvVariable GAZEBO_MODEL_PATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\share\gazebo\models"
Expand Down Expand Up @@ -74,8 +74,11 @@ Add-ValueToUserEnvVariable PYTHONPATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"@ROB
@endcmakeif ROBOTOLOGY_USES_PYTHON

@cmakeif ROBOTOLOGY_USES_MATLAB
Add-ValueToUserEnvVariable YARP_DATA_DIRS $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\share\RRbot";
Add-ValueToUserEnvVariable GAZEBO_MODEL_PATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\share\RRbot\robots";
Add-ValueToUserEnvVariable MATLABPATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\mex";
Add-ValueToUserEnvVariable MATLABPATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\mex\+wbc\simulink";
Add-ValueToUserEnvVariable MATLABPATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\mex\+mwbs\RobotDynamicsWithContacts";
Add-ValueToUserEnvVariable MATLABPATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\share\WBToolbox";
Add-ValueToUserEnvVariable MATLABPATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\share\WBToolbox\images";
@endcmakeif ROBOTOLOGY_USES_MATLAB
Expand Down
3 changes: 3 additions & 0 deletions cmake/template/removePathsFromUserEnvVariables.ps1.in
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,11 @@ Remove-ValueFromUserEnvVariable PYTHONPATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX
@endcmakeif ROBOTOLOGY_USES_PYTHON

@cmakeif ROBOTOLOGY_USES_MATLAB
Remove-ValueFromUserEnvVariable YARP_DATA_DIRS $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\share\RRbot";
Remove-ValueFromUserEnvVariable GAZEBO_MODEL_PATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\share\RRbot\robots";
Remove-ValueFromUserEnvVariable MATLABPATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\mex";
Remove-ValueFromUserEnvVariable MATLABPATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\mex\+wbc\simulink";
Remove-ValueFromUserEnvVariable MATLABPATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\mex\+mwbs\RobotDynamicsWithContacts";
Remove-ValueFromUserEnvVariable MATLABPATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\share\WBToolbox";
Remove-ValueFromUserEnvVariable MATLABPATH $ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX"\share\WBToolbox\images";
@endcmakeif ROBOTOLOGY_USES_MATLAB
Expand Down
3 changes: 3 additions & 0 deletions cmake/template/setup.bat.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ set "PYTHONPATH=%PYTHONPATH%;%ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX%\@ROBOTOLOGY_
@endcmakeif ROBOTOLOGY_USES_PYTHON

@cmakeif ROBOTOLOGY_USES_MATLAB
rem Set YARP and Gazebo related env variables
set "YARP_DATA_DIRS=%YARP_DATA_DIRS%;%ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX%\share\RRbot"
set "GAZEBO_MODEL_PATH=%GAZEBO_MODEL_PATH%;%ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX%\share\RRbot\robots"
rem Configure the Matlab
set "MATLABPATH=%MATLABPATH%;%ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX%\mex;%ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX%\mex\+wbc\simulink;%ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX%\mex\+mwbs\RobotDynamicsWithContacts;%ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX%\share\WBToolbox;%ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX%\share\WBToolbox\images"
@endcmakeif ROBOTOLOGY_USES_MATLAB
2 changes: 1 addition & 1 deletion cmake/template/setup.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export PYTHONPATH=${PYTHONPATH:+${PYTHONPATH}:}${ROBOTOLOGY_SUPERBUILD_INSTALL_P
@endcmakeif ROBOTOLOGY_USES_PYTHON

@cmakeif ROBOTOLOGY_USES_MATLAB
# YARP and Gazebo related env variables
# Set YARP and Gazebo related env variables
export YARP_DATA_DIRS=$YARP_DATA_DIRS:${ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX}/share/RRbot
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:${ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX}/share/RRbot/robots
# Configure the Matlab path
Expand Down
12 changes: 6 additions & 6 deletions conda/multisheller/matlab-whole-body-simulator_activate.msh
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ if_(is_set("COMSPEC")).then_([
sys.list_append("YARP_DATA_DIRS", path.join(env("CONDA_PREFIX"), "Library\\share\\RRbot")),
sys.list_append("ROS_PACKAGE_PATH", path.join(env("CONDA_PREFIX"), "Library\\share")),
sys.list_append("AMENT_PREFIX_PATH", path.join(env("CONDA_PREFIX"), "Library\\share")),
sys.list_append("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "Library\\share\\RRbot\\robots")),
sys.list_append("MATLABPATH", path.join(env("CONDA_PREFIX"), "Library\\mex\\+mwbs\\RobotDynamicsWithContacts"))
sys.list_append("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "Library\\share\\RRbot\\robots")),
sys.list_append("MATLABPATH", path.join(env("CONDA_PREFIX"), "Library\\mex\\+mwbs\\RobotDynamicsWithContacts"))
]).else_([
sys.list_append("YARP_DATA_DIRS", path.join(env("CONDA_PREFIX"), "share/RRbot")),
sys.list_append("ROS_PACKAGE_PATH", path.join(env("CONDA_PREFIX"), "share")),
sys.list_append("AMENT_PREFIX_PATH", path.join(env("CONDA_PREFIX"), "share")),
sys.list_append("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "share/RRbot/robots")),
sys.list_append("MATLABPATH", path.join(env("CONDA_PREFIX"), "mex/+mwbs/RobotDynamicsWithContacts"))
sys.list_append("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "share/RRbot/robots")),
sys.list_append("MATLABPATH", path.join(env("CONDA_PREFIX"), "mex/+mwbs/RobotDynamicsWithContacts"))
])

# For some reason setting two times the same variable inside the same if does not work in command prompt
# As a workaround, we move each GAZEBO_MODEL_PATH set to a separate if
if_(is_set("COMSPEC")).then_([
sys.list_append("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "Library\\share"))
sys.list_append("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "Library\\share"))
]).else_([
sys.list_append("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "share"))
sys.list_append("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "share"))
])
12 changes: 6 additions & 6 deletions conda/multisheller/matlab-whole-body-simulator_deactivate.msh
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ if_(is_set("COMSPEC")).then_([
sys.list_remove("YARP_DATA_DIRS", path.join(env("CONDA_PREFIX"), "Library\\share\\RRbot")),
sys.list_remove("ROS_PACKAGE_PATH", path.join(env("CONDA_PREFIX"), "Library\\share")),
sys.list_remove("AMENT_PREFIX_PATH", path.join(env("CONDA_PREFIX"), "Library\\share")),
sys.list_remove("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "Library\\share\\RRbot\\robots")),
sys.list_remove("MATLABPATH", path.join(env("CONDA_PREFIX"), "Library\\mex\\+mwbs\\RobotDynamicsWithContacts"))
sys.list_remove("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "Library\\share\\RRbot\\robots")),
sys.list_remove("MATLABPATH", path.join(env("CONDA_PREFIX"), "Library\\mex\\+mwbs\\RobotDynamicsWithContacts"))
]).else_([
sys.list_remove("YARP_DATA_DIRS", path.join(env("CONDA_PREFIX"), "share/RRbot")),
sys.list_remove("ROS_PACKAGE_PATH", path.join(env("CONDA_PREFIX"), "share")),
sys.list_remove("AMENT_PREFIX_PATH", path.join(env("CONDA_PREFIX"), "share")),
sys.list_remove("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "share/RRbot/robots")),
sys.list_remove("MATLABPATH", path.join(env("CONDA_PREFIX"), "mex/+mwbs/RobotDynamicsWithContacts"))
sys.list_remove("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "share/RRbot/robots")),
sys.list_remove("MATLABPATH", path.join(env("CONDA_PREFIX"), "mex/+mwbs/RobotDynamicsWithContacts"))
])

# For some reason setting two times the same variable inside the same if does not work in command prompt
# As a workaround, we move each GAZEBO_MODEL_PATH set to a separate if
if_(is_set("COMSPEC")).then_([
sys.list_remove("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "Library\\share"))
sys.list_remove("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "Library\\share"))
]).else_([
sys.list_remove("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "share"))
sys.list_remove("GAZEBO_MODEL_PATH", path.join(env("CONDA_PREFIX"), "share"))
])
14 changes: 9 additions & 5 deletions doc/cmake-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ All these options are named `ROBOTOLOGY_ENABLE_<profile>` .
|:------------:|:-----------:|:---------------------:|:-------------:|:----:|
| `ROBOTOLOGY_ENABLE_CORE` | The core robotology software packages, necessary for most users. | [`YARP`](https://github.com/robotology/yarp), [`ICUB`](https://github.com/robotology/icub-main), [`ICUBcontrib`](https://github.com/robotology/icub-contrib-common), [`icub-models`](https://github.com/robotology/icub-models) and [`robots-configurations`](https://github.com/robotology/robots-configuration). [`GazeboYARPPlugins`](https://github.com/robotology/GazeboYARPPlugins) and [`icub-gazebo`](https://github.com/robotology/icub-gazebo) if the `ROBOTOLOGY_USES_GAZEBO` option is enabled. [`gym-ignition`](https://github.com/robotology/gym-ignition) if the `ROBOTOLOGY_USES_IGNITION` option is enabled. | `ON` | [Documentation on Core profile.](#core) |
| `ROBOTOLOGY_ENABLE_ROBOT_TESTING` | The robotology software packages related to robot testing. | [`RobotTestingFramework`](https://github.com/robotology/robot-testing-framework), [`icub-tests`](https://github.com/robotology/icub-tests), [`blocktest`](https://github.com/robotology/blocktest) and [`blocktest-yarp-plugins`](https://github.com/robotology/blocktest-yarp-plugins) | `OFF` | [Documentation on Robot Testing profile.](#robot-testing) |
| `ROBOTOLOGY_ENABLE_DYNAMICS` | The robotology software packages related to balancing, walking and force control. | [`iDynTree`](https://github.com/robotology/idyntree), [`blockfactory`](https://github.com/robotology/blockfactory), [`wb-Toolbox`](https://github.com/robotology/wb-Toolbox), [`whole-body-controllers`](https://github.com/robotology/whole-body-controllers), [`walking-controllers`](https://github.com/robotology/walking-controllers), [`matioCpp`](https://github.com/dic-iit/matio-cpp), [`bipedal-locomotion-framework`](https://github.com/dic-iit/bipedal-locomotion-framework), [`YARP_telemetry`](https://github.com/robotology/yarp-telemetry). | `OFF` | [Documentation on Dynamics profile.](#dynamics) |
| `ROBOTOLOGY_ENABLE_DYNAMICS` | The robotology software packages related to balancing, walking and force control. | [`iDynTree`](https://github.com/robotology/idyntree), [`blockfactory`](https://github.com/robotology/blockfactory), [`wb-Toolbox`](https://github.com/robotology/wb-Toolbox), [`whole-body-controllers`](https://github.com/robotology/whole-body-controllers), [`walking-controllers`](https://github.com/robotology/walking-controllers), [`matioCpp`](https://github.com/dic-iit/matio-cpp), [`bipedal-locomotion-framework`](https://github.com/dic-iit/bipedal-locomotion-framework), [`YARP_telemetry`](https://github.com/robotology/yarp-telemetry). Furthermore, [`osqp-matlab`](https://github.com/dic-iit/osqp-matlab-cmake-buildsystem) and [`matlab-whole-body-simulator`](https://github.com/dic-iit/matlab-whole-body-simulator) if `ROBOTOLOGY_USES_MATLAB` option is enabled. | `OFF` | [Documentation on Dynamics profile.](#dynamics) |
| `ROBOTOLOGY_ENABLE_DYNAMICS_FULL_DEPS` | Optional dependencies for [`bipedal-locomotion-framework`](https://github.com/dic-iit/bipedal-locomotion-framework). | [`manif`](https://github.com/artivis/manif), [`qhull`](https://github.com/qhull/qhull), [`casadi`](https://github.com/casadi/casadi). [`CppAD`](https://github.com/coin-or/CppAD). | `OFF` | [Documentation on Dynamics full deps profile.](#dynamics-full-deps) |
| `ROBOTOLOGY_ENABLE_ICUB_HEAD` | The robotology software packages needed on the system that is running on the head of the iCub robot, or in general to communicate directly with iCub low-level devices. | [`icub-firmware`](https://github.com/robotology/icub-firmware), [`icub-firmware-shared`](https://github.com/robotology/icub-firmware-shared), [`diagnostic-daemon`](https://github.com/robotology/diagnostic-daemon). Furthermore, several additional devices are compiled in `YARP` and `ICUB` if this option is enabled. | `OFF` | [Documentation on iCub Head profile.](#icub-head) |
| `ROBOTOLOGY_ENABLE_ICUB_BASIC_DEMOS` | The robotology software packages needed to run basic demonstrations with the iCub robot. | [`icub-basic-demos`](https://github.com/robotology/icub-basic-demos), [`speech`](https://github.com/robotology/speech), [`funny-things`](https://github.com/robotology/funny-things). | `OFF` | [Documentation on iCub Basic Demos profile.](#icub-basic-demos) |
Expand Down Expand Up @@ -237,8 +237,8 @@ This option is set to `OFF` on all platforms as it is still experimental.

### System Dependencies

Different Ignition distributions can be installed alongside.
The projects included in the superbuild might require different distributions.
Different Ignition distributions can be installed alongside.
The projects included in the superbuild might require different distributions.
From the superbuild point of view, we currently do not allow enabling projects that only support a specific Ignition distribution, therefore all required distributions have to be found in the system.

#### Using conda
Expand Down Expand Up @@ -277,10 +277,14 @@ can install some projects that depend on MATLAB, in particular:
* the MATLAB bindings of qpOASES, contained in the [robotology-dependencies/qpOASES](https://github.com/robotology-dependencies/qpOASES) fork,
* The [WB-Toolbox](https://github.com/robotology/WB-Toolbox) Simulink toolbox,
* The [whole-body-controllers](https://github.com/robotology/whole-body-controllers) Simulink-based balancing controllers. Note that whole-body-controllers can be installed and compiled also without MATLAB, but its functionalities are reduced.
* The [matlab-whole-body-simulator](https://github.com/dic-iit/matlab-whole-body-simulator) Simulink-based whole-body dynamics simulator with contacts handling.

To use this software, you can simply enable its compilation using the `ROBOTOLOGY_USES_MATLAB` CMake option.
Once this software has been compiled by the superbuild, you just need to add some directories of the robotology-superbuild install (typically `$ROBOTOLOGY_SUPERBUILD_SOURCE_DIR/build/install`) to [the MATLAB path](https://www.mathworks.com/help/matlab/matlab_env/what-is-the-matlab-search-path.html).
In particular you need to add to the MATLAB path the `$ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX/mex` directory and all the subdirectories `$ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX/share/WBToolbox`.
In particular you need to add to the MATLAB path:
* the `$ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX/mex` directory,
* the `$ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX/share/WBToolbox` directory and all its subdirectories (except the packages which are folder names starting with "+"),
* the libraries `$ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX/mex/+wbc/simulink` and `$ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX/mex/+mwbs/RobotDynamicsWithContacts`.

#### Start MATLAB from the launcher or the application menu

Expand All @@ -289,6 +293,7 @@ You could add this line to your MATLAB script that uses the robotology-superbuil
~~~
addpath(['<ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX>' '/mex'])
addpath(['<ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX>' '/mex/+wbc/simulink'])
addpath(['<ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX>' '/mex/+mwbs/RobotDynamicsWithContacts'])
addpath(['<ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX>' '/share/WBToolbox'])
addpath(['<ROBOTOLOGY_SUPERBUILD_INSTALL_PREFIX>' '/share/WBToolbox/images'])
~~~
Expand Down Expand Up @@ -419,4 +424,3 @@ No additional configuration is required to use the software installed by the `R
### Check the installation
Open a terminal, and check that amoung the device listed by `yarpdev --list` the `esdcan` YARP device is listed.
Loading

0 comments on commit a0b850d

Please sign in to comment.