Skip to content

Commit

Permalink
Install the package +floatingBaseBalancingTorqueControlWithSimulator
Browse files Browse the repository at this point in the history
- minor hack: in the main CMakeLists.txt of the whole-body-controllers, the script returns to the caller before running 'add_subdirectory(controllers)'. As a result, the respective CMakeLists.txt doesn't run, so we had to add the copy commands directly to the main CMakeLists.txt.
  • Loading branch information
nunoguedelha committed May 11, 2021
1 parent ad0088b commit 82b2173
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
20 changes: 17 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ option(WBC_EXPORT_AUTOGENERATED "Enable the target to export code generated with
option(WBC_INSTALL_ALL_HOME_POS "Installation of all available home positions" ON)

# ======================================
# Install home positions and WBC library
# Install home positions and WBC library
# ======================================

find_package(YARP REQUIRED)
Expand All @@ -18,12 +18,26 @@ add_subdirectory(utilities)
add_subdirectory(library)
add_subdirectory(config)

# Install the example controller model (YOGA+matlab-simulator)
set(FLOATING_BASE_BALANCING_TORQCTRL_INSTALL_MATLAB_FILESDIR ${CMAKE_INSTALL_PREFIX}/mex/+wbc/examples CACHE
STRING "Location (relative to the install prefix) in which the Matlab .m files and simulink .mdl models are installed.")
set(M_FILES_DIR ${whole-body-controllers_SOURCE_DIR}/controllers/+floatingBaseBalancingTorqueControlWithSimulator)

install(
DIRECTORY ${M_FILES_DIR}
DESTINATION ${FLOATING_BASE_BALANCING_TORQCTRL_INSTALL_MATLAB_FILESDIR}
USE_SOURCE_PERMISSIONS
FILES_MATCHING
PATTERN "*.m"
PATTERN "*.jpeg"
PATTERN "*.mdl")

# ======================
# Autogeneration routine
# Autogeneration routine
# ======================

if(NOT WBC_EXPORT_AUTOGENERATED)
# Fake installation.
# Fake installation.
install(CODE "MESSAGE(\"Disabled exporting of autogenerated c++ code from Simulink.\")")
return()
endif()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@ Currently, the only supported robot model is `iCubGazeboV2_5` which has the prop

### How to run the demo

You don't need any module external module running outside of Matlab. For running the simulation from the source module (for developpers wishing to perform any modification), follow the few steps below:
You don't need any module external module running outside of Matlab.

For running the simulation from the source module (for developpers wishing to perform any modification), follow the few steps below:
1. Set the `YARP_ROBOT_NAME` environment variable to the desired model. The default and only currently supported model is `iCubGazeboV2_5`. There is no direct link with Gazebo. This model is suitable for the `matlab-whole-body-simulator` because of the modified inertia of the intermediate small and light links within the 3-DoF joints (shoulder pitch-roll-yaw, hip pitch-roll-yaw, etc), tuned for stabilising the dynamics of the simulation.
```
> setenv(`YARP_ROBOT_NAME`,`iCubGazeboV2_5`)
```
2. Verify that the target robot model is available. You can check if the controller is targeting the correct robot model by typing on a terminal:
2. Verify that the target robot model is available. You can check if the controller is targeting the correct robot model by typing on the Matlab command line:
```
yarp resource --find model.urdf
system('yarp resource --find model.urdf')
```
then, check that the path and the model name are correct.
Expand All @@ -58,6 +60,12 @@ You don't need any module external module running outside of Matlab. For running
4. Open the Simulink model `torqueControlBalancingWithSimu.mdl`.
5. Run the model.
For running the simulation from the installed module (e.g. in case of a user, without any experience in simulation nor control, just trying the simulator for the first time), skip steps 3. and 4. and execute instead:
- still in Matlab, and from any location except from [whole-body-controllers/controllers](../) (for avoiding file naming collision with [this folder](./)), open the model directly from the Matlab command line:
```
>> floatingBaseBalancingTorqueControlWithSimulator.torqueControlBalancingWithSimu
```
### Configuration file
At start, the module calls the initialization file `initTorqueControlBalancingWithSimu.m`. Once opened, this file contains some configuration variables. Please follow the instruction inside the script to properly configure your simulation.
Expand Down

0 comments on commit 82b2173

Please sign in to comment.