Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install all the generated models #3

Merged
merged 4 commits into from
Jul 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,28 @@ cmake_minimum_required(VERSION 2.8.9)

project(icub-models)

# Install meshes
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/iCub/meshes/simmechanics DESTINATION share/iCub/meshes)
macro(SUBDIRLIST result curdir)
file(GLOB children RELATIVE ${curdir} ${curdir}/*)
set(dirlist "")
foreach(child ${children})
if(IS_DIRECTORY ${curdir}/${child})
list(APPEND dirlist ${child})
endif()
endforeach()
set(${result} ${dirlist})
endmacro()

# Install robots URDF files
set(ROBOTS_TO_INSTALL "")
list(APPEND ROBOTS_TO_INSTALL "iCubGenova04")
# Copy the iCub folder in the build tree
file(COPY ${CMAKE_SOURCE_DIR}/iCub DESTINATION ${CMAKE_BINARY_DIR})

foreach (robot ${ROBOTS_TO_INSTALL})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/iCub/robots/${robot}/model.urdf DESTINATION share/iCub/robots/${robot})
endforeach ()
# Generate and move in the build tree the model.config for each robot
SUBDIRLIST(ROBOTS_NAMES ${CMAKE_BINARY_DIR}/iCub/robots)
foreach (ROBOT_DIRNAME ${ROBOTS_NAMES})
set(ROBOT_NAME ${ROBOT_DIRNAME})
configure_file(${CMAKE_SOURCE_DIR}/model.config.in
${CMAKE_BINARY_DIR}/iCub/robots/${ROBOT_NAME}/model.config
@ONLY)
endforeach()

# Install package.xml for ROS compatibility
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/iCub/package.xml DESTINATION share/iCub)
# Install the whole iCub directory
install(DIRECTORY ${CMAKE_BINARY_DIR}/iCub DESTINATION share)
66 changes: 38 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,49 @@
# icub-models
Repository containing models generated by https://github.com/robotology-playground/icub-model-generator .

## Usage
Repository containing models generated by https://github.com/robotology-playground/icub-model-generator .

## Usage

The model in the repo can be used either directly from the repo, or by installing them.
While the files can be used directly by pointing your software to their location, they are
tipically used by software that uses either YARP or ROS. For this reason, the models
are installed as part of the `iCub` ROS package following the instructions in
https://github.com/gerkey/ros1_external_use#installing-for-use-by-tools-like-roslaunch
While the files can be used directly by pointing your software to their location, they are
tipically used by software that uses either YARP or ROS. For this reason, the models
are installed as part of the `iCub` ROS package following the instructions in
https://github.com/gerkey/ros1_external_use#installing-for-use-by-tools-like-roslaunch
and following the YARP guidelines on installing configuration files in http://www.yarp.it/yarp_data_dirs.html .
To make sure that this models are found by the software even when they are not installed in
system directories, tipically the [`YARP_DATA_DIRS`](http://www.yarp.it/yarp_data_dirs.html) and the
[`ROS_PACKAGE_PATH`](http://wiki.ros.org/ROS/EnvironmentVariables#ROS_PACKAGE_PATH) enviromental variables are modified appropriatly.
To make sure that this models are found by the software even when they are not installed in
system directories, tipically the [`YARP_DATA_DIRS`](http://www.yarp.it/yarp_data_dirs.html) and the
[`ROS_PACKAGE_PATH`](http://wiki.ros.org/ROS/EnvironmentVariables#ROS_PACKAGE_PATH) enviromental variables are modified appropriatly.


### From the source repo
In case the models are used from the repo, if <icub-models> is the location of the repo, then
<icub-models>/iCub needs to be appened to the YARP_DATA_DIRS env variable and <icub-models> needs to be appended
to ROS_PACKAGE_PATH env variable. On *nix system, this can be achived by adding to the `.bashrc` or equivalent
file the following two lines:
~~~
export YARP_DATA_DIRS=${YARP_DATA_DIRS}:<icub-models>/iCub
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:<icub-models>
~~~

### By installing the models
To install the models, you must use `CMake`.
The installation can be performed by the following commands:
~~~

In the case models are used from the repo, the first step is configure it with the following commands:

```
mkdir build
cd build
cmake ..
```

If `<icub-models>` is the location of the repo, then `<icub-models>/build/iCub` needs to be appened to the `YARP_DATA_DIRS` env variable and `<icub-models>/build` needs to be appended to `ROS_PACKAGE_PATH` env variable. On *nix system, this can be achived by adding to the `.bashrc` or equivalent file the following two lines:

```
export YARP_DATA_DIRS=${YARP_DATA_DIRS}:<icub-models>/build/iCub
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:<icub-models>/build/
```

### By installing the models

To install the models, from the `build` directory execute:

```
cmake -DCMAKE_INSTALL_PREFIX=<prefix> ..
cmake --build . --target install
~~~
cmake --build . --target install
```

Once you installed to a given prefix, you can modify the `YARP_DATA_DIRS` and `ROS_PACKAGE_PATH` enviromental variables as in the following:
~~~
export YARP_DATA_DIRS=${YARP_DATA_DIRS}:<prefix>/share/iCub
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:<prefix>
~~~

```
export YARP_DATA_DIRS=${YARP_DATA_DIRS}:<prefix>/share/iCub
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:<prefix>
```
Loading