Skip to content

Commit 82b2173

Browse files
committed
Install the package +floatingBaseBalancingTorqueControlWithSimulator
- 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.
1 parent ad0088b commit 82b2173

File tree

2 files changed

+28
-6
lines changed

2 files changed

+28
-6
lines changed

CMakeLists.txt

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ option(WBC_EXPORT_AUTOGENERATED "Enable the target to export code generated with
88
option(WBC_INSTALL_ALL_HOME_POS "Installation of all available home positions" ON)
99

1010
# ======================================
11-
# Install home positions and WBC library
11+
# Install home positions and WBC library
1212
# ======================================
1313

1414
find_package(YARP REQUIRED)
@@ -18,12 +18,26 @@ add_subdirectory(utilities)
1818
add_subdirectory(library)
1919
add_subdirectory(config)
2020

21+
# Install the example controller model (YOGA+matlab-simulator)
22+
set(FLOATING_BASE_BALANCING_TORQCTRL_INSTALL_MATLAB_FILESDIR ${CMAKE_INSTALL_PREFIX}/mex/+wbc/examples CACHE
23+
STRING "Location (relative to the install prefix) in which the Matlab .m files and simulink .mdl models are installed.")
24+
set(M_FILES_DIR ${whole-body-controllers_SOURCE_DIR}/controllers/+floatingBaseBalancingTorqueControlWithSimulator)
25+
26+
install(
27+
DIRECTORY ${M_FILES_DIR}
28+
DESTINATION ${FLOATING_BASE_BALANCING_TORQCTRL_INSTALL_MATLAB_FILESDIR}
29+
USE_SOURCE_PERMISSIONS
30+
FILES_MATCHING
31+
PATTERN "*.m"
32+
PATTERN "*.jpeg"
33+
PATTERN "*.mdl")
34+
2135
# ======================
22-
# Autogeneration routine
36+
# Autogeneration routine
2337
# ======================
2438

2539
if(NOT WBC_EXPORT_AUTOGENERATED)
26-
# Fake installation.
40+
# Fake installation.
2741
install(CODE "MESSAGE(\"Disabled exporting of autogenerated c++ code from Simulink.\")")
2842
return()
2943
endif()

controllers/+floatingBaseBalancingTorqueControlWithSimulator/README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,17 @@ Currently, the only supported robot model is `iCubGazeboV2_5` which has the prop
4141

4242
### How to run the demo
4343

44-
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:
44+
You don't need any module external module running outside of Matlab.
45+
46+
For running the simulation from the source module (for developpers wishing to perform any modification), follow the few steps below:
4547
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.
4648
```
4749
> setenv(`YARP_ROBOT_NAME`,`iCubGazeboV2_5`)
4850
```
4951
50-
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:
52+
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:
5153
```
52-
yarp resource --find model.urdf
54+
system('yarp resource --find model.urdf')
5355
```
5456
5557
then, check that the path and the model name are correct.
@@ -58,6 +60,12 @@ You don't need any module external module running outside of Matlab. For running
5860
4. Open the Simulink model `torqueControlBalancingWithSimu.mdl`.
5961
5. Run the model.
6062
63+
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:
64+
- 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:
65+
```
66+
>> floatingBaseBalancingTorqueControlWithSimulator.torqueControlBalancingWithSimu
67+
```
68+
6169
### Configuration file
6270
6371
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.

0 commit comments

Comments
 (0)