Skip to content

Commit

Permalink
Add install step (#44)
Browse files Browse the repository at this point in the history
* add install plugins to CMakeLists files

* add install step to CI

* change the name of libHandler.so to gz-sim-yarp-handler

* enable rpath

* include GNUInstallDirs module

* delete DESTINATION parameters

* Update README.md

* Update README of tutorials

* Update README.md

* Update README.md

Co-authored-by: Silvio Traversaro <[email protected]>

---------

Co-authored-by: Silvio Traversaro <[email protected]>
  • Loading branch information
lucapa17 and traversaro authored Aug 30, 2023
1 parent 011f6fd commit 7ec7572
Show file tree
Hide file tree
Showing 21 changed files with 163 additions and 72 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ jobs:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

# This is commented until we fix https://github.com/robotology/gz-yarp-plugins/issues/28
# - name: Install
# run: |
# cd build
# cmake --build . --config ${{ matrix.build_type }} --target install

- name: Install
run: |
cd build
cmake --build . --config ${{ matrix.build_type }} --target install
9 changes: 4 additions & 5 deletions .github/workflows/conda-forge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ jobs:
cd build
ctest -E "^LaserTest|^CameraTest" --repeat until-pass:5 --output-on-failure -C ${{ matrix.build_type }} .
# This is commented until we fix https://github.com/robotology/gz-yarp-plugins/issues/28
# - name: Install
# run: |
# cd build
# cmake --build . --config ${{ matrix.build_type }} --target install
- name: Install
run: |
cd build
cmake --build . --config ${{ matrix.build_type }} --target install
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,21 @@ set(GZ_PLUGIN_VER ${gz-plugin2_VERSION_MAJOR})
gz_find_package(gz-sim7 REQUIRED)
set(GZ_SIM_VER ${gz-sim7_VERSION_MAJOR})

# Defines the CMAKE_INSTALL_LIBDIR, CMAKE_INSTALL_BINDIR and many other useful macros.
# See https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
include(GNUInstallDirs)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")

# Enable RPATH support for installed binaries and libraries
include(AddInstallRPATHSupport)
add_install_rpath_support(BIN_DIRS "${CMAKE_INSTALL_FULL_BINDIR}"
LIB_DIRS "${CMAKE_INSTALL_FULL_LIBDIR}"
INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}"
USE_LINK_PATH)

# Support shared libraries on Windows
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

Expand Down
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

**This repository contains a preliminary work in progress of integration of Modern Gazebo (gz) and YARP devices, a port of some functionalities of https://github.com/robotology/gazebo-yarp-plugins to Modern Gazebo. The repo is working in progress, and public interfaces can change without warning.**

## Install/Uninstall Gazebo Garden
## Quick start
- [Install Gazebo Garden](#install_gazebo)
- [Install YARP](#install_yarp)
- [Install gz-sim-yarp-plugins](#install_gz-sim-yarp-plugins)


### <a name="install_gazebo"></a> Install Gazebo Garden
#### Binary Installation in Ubuntu (or WSL)
First install some necessary tools:
```
Expand All @@ -21,7 +27,7 @@ sudo apt-get install gz-garden
sudo apt remove gz-garden && sudo apt autoremove
```

## Install YARP
### <a name="install_yarp"></a> Install YARP

#### Binary Installation in Ubuntu (or WSL)
```
Expand All @@ -35,10 +41,18 @@ sudo apt install yarp
sudo apt remove yarp && sudo apt autoremove
```

## Compilation
## <a name="install_gz-sim-yarp-plugins"></a> Install gz-sim-yarp-plugins
~~~
mkdir build
cd build
cmake ..
cmake -DCMAKE_INSTALL_PREFIX=<desired_install_prefix> ..
make
make install
~~~
To notify Gazebo of the new plugins compiled, it is necessary to modify the GZ_SIM_SYSTEM_PLUGIN_PATH environment variable:
```
export GZ_SIM_SYSTEM_PLUGIN_PATH=${GZ_SIM_SYSTEM_PLUGIN_PATH}:/path/to/the/install/folder/lib
```
where `/path/to/the/install/folder/lib` is the directory containing the `libgz-sim-yarp-forcetorque-system.so`, `libgz-sim-yarp-camera-system.so`... files (by default `/usr/local/lib`)

To avoid having to modify this environment variable each time, you can place this command in the `.bashrc` file in your home directory.
10 changes: 6 additions & 4 deletions libraries/singleton-devices/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@

add_library(Handler SHARED Handler.cc Handler.hh)
target_compile_features(Handler PRIVATE cxx_std_17)
add_library(gz-sim-yarp-handler SHARED Handler.cc Handler.hh)
target_compile_features(gz-sim-yarp-handler PRIVATE cxx_std_17)

target_link_libraries(Handler
target_link_libraries(gz-sim-yarp-handler
PRIVATE gz-plugin${GZ_PLUGIN_VER}::gz-plugin${GZ_PLUGIN_VER}
PRIVATE gz-sim${GZ_SIM_VER}::gz-sim${GZ_SIM_VER}
PRIVATE
${YARP_LIBRARIES}
YARP::YARP_os
YARP::YARP_init)
YARP::YARP_init)

install(TARGETS gz-sim-yarp-handler)
7 changes: 5 additions & 2 deletions plugins/camera/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@ target_link_libraries(gz-sim-yarp-camera-system
${YARP_LIBRARIES}
YARP::YARP_os
YARP::YARP_init
Handler
HandlerCamera)
gz-sim-yarp-handler
gz-sim-yarp-handler-camera)

# Add install target
install(TARGETS gz-sim-yarp-camera-system)
11 changes: 7 additions & 4 deletions plugins/camera/singleton-camera/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
add_library(HandlerCamera SHARED Handler.cc Handler.hh)
target_compile_features(HandlerCamera PRIVATE cxx_std_17)
add_library(gz-sim-yarp-handler-camera SHARED Handler.cc Handler.hh)
target_compile_features(gz-sim-yarp-handler-camera PRIVATE cxx_std_17)

target_link_libraries(HandlerCamera
target_link_libraries(gz-sim-yarp-handler-camera
PRIVATE gz-plugin${GZ_PLUGIN_VER}::gz-plugin${GZ_PLUGIN_VER}
PRIVATE gz-sim${GZ_SIM_VER}::gz-sim${GZ_SIM_VER}
PRIVATE
${YARP_LIBRARIES}
YARP::YARP_os
YARP::YARP_init)
YARP::YARP_init)

# Add install target
install(TARGETS gz-sim-yarp-handler-camera)
7 changes: 5 additions & 2 deletions plugins/forcetorque/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@ target_link_libraries(gz-sim-yarp-forcetorque-system
${YARP_LIBRARIES}
YARP::YARP_os
YARP::YARP_init
Handler
HandlerForceTorque)
gz-sim-yarp-handler
gz-sim-yarp-handler-forcetorque)

# Add install target
install(TARGETS gz-sim-yarp-forcetorque-system)
10 changes: 6 additions & 4 deletions plugins/forcetorque/singleton-forcetorque/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@

add_library(HandlerForceTorque SHARED Handler.cc Handler.hh)
target_compile_features(HandlerForceTorque PRIVATE cxx_std_17)
add_library(gz-sim-yarp-handler-forcetorque SHARED Handler.cc Handler.hh)
target_compile_features(gz-sim-yarp-handler-forcetorque PRIVATE cxx_std_17)

target_link_libraries(HandlerForceTorque
target_link_libraries(gz-sim-yarp-handler-forcetorque
PRIVATE gz-plugin${GZ_PLUGIN_VER}::gz-plugin${GZ_PLUGIN_VER}
PRIVATE gz-sim${GZ_SIM_VER}::gz-sim${GZ_SIM_VER}
PRIVATE
${YARP_LIBRARIES}
YARP::YARP_os
YARP::YARP_init)
YARP::YARP_init)

install(TARGETS gz-sim-yarp-handler-forcetorque)
7 changes: 5 additions & 2 deletions plugins/imu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@ target_link_libraries(gz-sim-yarp-imu-system
${YARP_LIBRARIES}
YARP::YARP_os
YARP::YARP_init
Handler
HandlerIMU)
gz-sim-yarp-handler
gz-sim-yarp-handler-imu)

# Add install target
install(TARGETS gz-sim-yarp-imu-system)
11 changes: 7 additions & 4 deletions plugins/imu/singleton-imu/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@

add_library(HandlerIMU SHARED Handler.cc Handler.hh)
target_compile_features(HandlerIMU PRIVATE cxx_std_17)
add_library(gz-sim-yarp-handler-imu SHARED Handler.cc Handler.hh)
target_compile_features(gz-sim-yarp-handler-imu PRIVATE cxx_std_17)

target_link_libraries(HandlerIMU
target_link_libraries(gz-sim-yarp-handler-imu
PRIVATE gz-plugin${GZ_PLUGIN_VER}::gz-plugin${GZ_PLUGIN_VER}
PRIVATE gz-sim${GZ_SIM_VER}::gz-sim${GZ_SIM_VER}
PRIVATE
${YARP_LIBRARIES}
YARP::YARP_os
YARP::YARP_init)
YARP::YARP_init)

# Add install target
install(TARGETS gz-sim-yarp-handler-imu)
7 changes: 5 additions & 2 deletions plugins/laser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@ target_link_libraries(gz-sim-yarp-laser-system
${YARP_LIBRARIES}
YARP::YARP_os
YARP::YARP_init
Handler
HandlerLaser)
gz-sim-yarp-handler
gz-sim-yarp-handler-laser)

# Add install target
install(TARGETS gz-sim-yarp-laser-system)
9 changes: 6 additions & 3 deletions plugins/laser/singleton-laser/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@

add_library(HandlerLaser SHARED Handler.cc Handler.hh)
target_compile_features(HandlerLaser PRIVATE cxx_std_17)
add_library(gz-sim-yarp-handler-laser SHARED Handler.cc Handler.hh)
target_compile_features(gz-sim-yarp-handler-laser PRIVATE cxx_std_17)

target_link_libraries(HandlerLaser
target_link_libraries(gz-sim-yarp-handler-laser
PRIVATE gz-plugin${GZ_PLUGIN_VER}::gz-plugin${GZ_PLUGIN_VER}
PRIVATE gz-sim${GZ_SIM_VER}::gz-sim${GZ_SIM_VER}
PRIVATE
${YARP_LIBRARIES}
YARP::YARP_os
YARP::YARP_init)

# Add install target
install(TARGETS gz-sim-yarp-handler-laser)
5 changes: 4 additions & 1 deletion plugins/robotinterface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ target_link_libraries(gz-sim-yarp-robotinterface-system
${YARP_LIBRARIES}
YARP::YARP_os
YARP::YARP_init
Handler)
gz-sim-yarp-handler)

install(TARGETS gz-sim-yarp-robotinterface-system)

13 changes: 9 additions & 4 deletions tutorial/camera/model/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
~~~
- 2nd terminal:
~~~
export LIBGL_ALWAYS_SOFTWARE=1
cd build
export GZ_SIM_SYSTEM_PLUGIN_PATH=`pwd`:`pwd`/lib
cd ../tutorial/camera/model
cd tutorial/camera/model
gz sim model.sdf
~~~
- 3rd terminal:
Expand All @@ -29,5 +26,13 @@ Finally start the simulation in Gazebo.
- Gazebo simulation
![Gazebo simulation](imgs/simulation.png "Gazebo simulation")

If you are using Linux on WSLg and you have the following error
~~~
OGRE EXCEPTION(9:UnimplementedException): in GL3PlusTextureGpu::copyTo at ./RenderSystems/GL3Plus/src/OgreGL3PlusTextureGpu.cpp (line 685)
~~~
try forcing software rendering:
~~~
export LIBGL_ALWAYS_SOFTWARE=1
~~~


14 changes: 9 additions & 5 deletions tutorial/camera/model_horizontal_flip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
~~~
- 2nd terminal:
~~~
export LIBGL_ALWAYS_SOFTWARE=1
cd build
export GZ_SIM_SYSTEM_PLUGIN_PATH=`pwd`:`pwd`/lib
cd ../tutorial/camera/model_horizontal_flip
cd tutorial/camera/model_horizontal_flip
gz sim model.sdf
~~~
- 3rd terminal:
Expand All @@ -29,5 +26,12 @@ Finally start the simulation in Gazebo.
- Gazebo simulation
![Gazebo simulation](imgs/simulation.png "Gazebo simulation")


If you are using Linux on WSLg and you have the following error
~~~
OGRE EXCEPTION(9:UnimplementedException): in GL3PlusTextureGpu::copyTo at ./RenderSystems/GL3Plus/src/OgreGL3PlusTextureGpu.cpp (line 685)
~~~
try forcing software rendering:
~~~
export LIBGL_ALWAYS_SOFTWARE=1
~~~

16 changes: 11 additions & 5 deletions tutorial/camera/model_vertical_flip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
~~~
- 2nd terminal:
~~~
export LIBGL_ALWAYS_SOFTWARE=1
cd build
export GZ_SIM_SYSTEM_PLUGIN_PATH=`pwd`:`pwd`/lib
cd ../tutorial/camera/model_vertical_flip
cd tutorial/camera/model_vertical_flip
gz sim model.sdf
~~~
- 3rd terminal:
Expand All @@ -27,4 +24,13 @@ Finally start the simulation in Gazebo.
- yarpview window
![yarpview window](imgs/yarpview_vertical_flip.png "yarpview window")
- Gazebo simulation
![Gazebo simulation](imgs/simulation.png "Gazebo simulation")
![Gazebo simulation](imgs/simulation.png "Gazebo simulation")

If you are using Linux on WSLg and you have the following error
~~~
OGRE EXCEPTION(9:UnimplementedException): in GL3PlusTextureGpu::copyTo at ./RenderSystems/GL3Plus/src/OgreGL3PlusTextureGpu.cpp (line 685)
~~~
try forcing software rendering:
~~~
export LIBGL_ALWAYS_SOFTWARE=1
~~~
14 changes: 10 additions & 4 deletions tutorial/forcetorque/model_one_sensor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
~~~
- 2nd terminal:
~~~
export LIBGL_ALWAYS_SOFTWARE=1
cd build
export GZ_SIM_SYSTEM_PLUGIN_PATH=`pwd`:`pwd`/lib
cd ../tutorial/forcetorque/model_one_sensor
cd tutorial/forcetorque/model_one_sensor
gz sim model.sdf
~~~
- 3rd terminal:
Expand All @@ -29,6 +26,15 @@ Finally start the simulation in Gazebo. The output is:
...
~~~

If you are using Linux on WSLg and you have the following error
~~~
OGRE EXCEPTION(9:UnimplementedException): in GL3PlusTextureGpu::copyTo at ./RenderSystems/GL3Plus/src/OgreGL3PlusTextureGpu.cpp (line 685)
~~~
try forcing software rendering:
~~~
export LIBGL_ALWAYS_SOFTWARE=1
~~~

## Run model in Gazebo Garden without YARP integration
Run the model:
```
Expand Down
14 changes: 10 additions & 4 deletions tutorial/forcetorque/model_two_sensors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
~~~
- 2nd terminal:
~~~
export LIBGL_ALWAYS_SOFTWARE=1
cd build
export GZ_SIM_SYSTEM_PLUGIN_PATH=`pwd`:`pwd`/lib
cd ../tutorial/forcetorque/model_two_sensors
cd tutorial/forcetorque/model_two_sensors
gz sim model2sensors.sdf
~~~
- 3rd terminal:
Expand Down Expand Up @@ -42,3 +39,12 @@
() () () () () (((0.0 0.0 -98.0 0.0 0.0 0.0) 8.68900000000000005684)) () () () ()
() () () () () (((0.0 0.0 -98.0 0.0 0.0 0.0) 8.77299999999999968736)) () () () ()
~~~
If you are using Linux on WSLg and you have the following error
~~~
OGRE EXCEPTION(9:UnimplementedException): in GL3PlusTextureGpu::copyTo at ./RenderSystems/GL3Plus/src/OgreGL3PlusTextureGpu.cpp (line 685)
~~~
try forcing software rendering:
~~~
export LIBGL_ALWAYS_SOFTWARE=1
~~~
Loading

0 comments on commit 7ec7572

Please sign in to comment.