diff --git a/.github/workflows/apt.yml b/.github/workflows/apt.yml index 227091e..5386788 100644 --- a/.github/workflows/apt.yml +++ b/.github/workflows/apt.yml @@ -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 diff --git a/.github/workflows/conda-forge.yml b/.github/workflows/conda-forge.yml index 59a0ee0..71e6b16 100644 --- a/.github/workflows/conda-forge.yml +++ b/.github/workflows/conda-forge.yml @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 1aacdc4..74e918b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/README.md b/README.md index 66ef483..896b879 100644 --- a/README.md +++ b/README.md @@ -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) + + +### Install Gazebo Garden #### Binary Installation in Ubuntu (or WSL) First install some necessary tools: ``` @@ -21,7 +27,7 @@ sudo apt-get install gz-garden sudo apt remove gz-garden && sudo apt autoremove ``` -## Install YARP +### Install YARP #### Binary Installation in Ubuntu (or WSL) ``` @@ -35,10 +41,18 @@ sudo apt install yarp sudo apt remove yarp && sudo apt autoremove ``` -## Compilation +## Install gz-sim-yarp-plugins ~~~ mkdir build cd build -cmake .. +cmake -DCMAKE_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. diff --git a/libraries/singleton-devices/CMakeLists.txt b/libraries/singleton-devices/CMakeLists.txt index 35c9fe7..ddcf15c 100644 --- a/libraries/singleton-devices/CMakeLists.txt +++ b/libraries/singleton-devices/CMakeLists.txt @@ -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) \ No newline at end of file + YARP::YARP_init) + +install(TARGETS gz-sim-yarp-handler) diff --git a/plugins/camera/CMakeLists.txt b/plugins/camera/CMakeLists.txt index 7a0b982..e2c4fcb 100644 --- a/plugins/camera/CMakeLists.txt +++ b/plugins/camera/CMakeLists.txt @@ -12,5 +12,8 @@ target_link_libraries(gz-sim-yarp-camera-system ${YARP_LIBRARIES} YARP::YARP_os YARP::YARP_init - Handler - HandlerCamera) \ No newline at end of file + gz-sim-yarp-handler + gz-sim-yarp-handler-camera) + +# Add install target +install(TARGETS gz-sim-yarp-camera-system) diff --git a/plugins/camera/singleton-camera/CMakeLists.txt b/plugins/camera/singleton-camera/CMakeLists.txt index aa3dfcb..2aa6651 100644 --- a/plugins/camera/singleton-camera/CMakeLists.txt +++ b/plugins/camera/singleton-camera/CMakeLists.txt @@ -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) \ No newline at end of file + YARP::YARP_init) + +# Add install target +install(TARGETS gz-sim-yarp-handler-camera) diff --git a/plugins/forcetorque/CMakeLists.txt b/plugins/forcetorque/CMakeLists.txt index 22163fc..10f6012 100644 --- a/plugins/forcetorque/CMakeLists.txt +++ b/plugins/forcetorque/CMakeLists.txt @@ -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) diff --git a/plugins/forcetorque/singleton-forcetorque/CMakeLists.txt b/plugins/forcetorque/singleton-forcetorque/CMakeLists.txt index 242bd7f..261400a 100644 --- a/plugins/forcetorque/singleton-forcetorque/CMakeLists.txt +++ b/plugins/forcetorque/singleton-forcetorque/CMakeLists.txt @@ -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) \ No newline at end of file + YARP::YARP_init) + +install(TARGETS gz-sim-yarp-handler-forcetorque) diff --git a/plugins/imu/CMakeLists.txt b/plugins/imu/CMakeLists.txt index 84739c4..ddcdc6c 100644 --- a/plugins/imu/CMakeLists.txt +++ b/plugins/imu/CMakeLists.txt @@ -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) diff --git a/plugins/imu/singleton-imu/CMakeLists.txt b/plugins/imu/singleton-imu/CMakeLists.txt index f7b2ded..5036cdf 100644 --- a/plugins/imu/singleton-imu/CMakeLists.txt +++ b/plugins/imu/singleton-imu/CMakeLists.txt @@ -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) \ No newline at end of file + YARP::YARP_init) + +# Add install target +install(TARGETS gz-sim-yarp-handler-imu) diff --git a/plugins/laser/CMakeLists.txt b/plugins/laser/CMakeLists.txt index d59391c..5897bd4 100644 --- a/plugins/laser/CMakeLists.txt +++ b/plugins/laser/CMakeLists.txt @@ -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) diff --git a/plugins/laser/singleton-laser/CMakeLists.txt b/plugins/laser/singleton-laser/CMakeLists.txt index 5d0a676..f89806f 100644 --- a/plugins/laser/singleton-laser/CMakeLists.txt +++ b/plugins/laser/singleton-laser/CMakeLists.txt @@ -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) diff --git a/plugins/robotinterface/CMakeLists.txt b/plugins/robotinterface/CMakeLists.txt index 9d7f5cd..0120c5a 100644 --- a/plugins/robotinterface/CMakeLists.txt +++ b/plugins/robotinterface/CMakeLists.txt @@ -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) + \ No newline at end of file diff --git a/tutorial/camera/model/README.md b/tutorial/camera/model/README.md index 01aa74c..2bc2de9 100644 --- a/tutorial/camera/model/README.md +++ b/tutorial/camera/model/README.md @@ -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: @@ -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 +~~~ diff --git a/tutorial/camera/model_horizontal_flip/README.md b/tutorial/camera/model_horizontal_flip/README.md index 7a8727c..487de61 100644 --- a/tutorial/camera/model_horizontal_flip/README.md +++ b/tutorial/camera/model_horizontal_flip/README.md @@ -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: @@ -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 +~~~ diff --git a/tutorial/camera/model_vertical_flip/README.md b/tutorial/camera/model_vertical_flip/README.md index 9620ce5..d066983 100644 --- a/tutorial/camera/model_vertical_flip/README.md +++ b/tutorial/camera/model_vertical_flip/README.md @@ -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: @@ -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") \ No newline at end of file + ![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 +~~~ \ No newline at end of file diff --git a/tutorial/forcetorque/model_one_sensor/README.md b/tutorial/forcetorque/model_one_sensor/README.md index 841be36..901964a 100644 --- a/tutorial/forcetorque/model_one_sensor/README.md +++ b/tutorial/forcetorque/model_one_sensor/README.md @@ -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: @@ -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: ``` diff --git a/tutorial/forcetorque/model_two_sensors/README.md b/tutorial/forcetorque/model_two_sensors/README.md index 72aca59..c9cc050 100644 --- a/tutorial/forcetorque/model_two_sensors/README.md +++ b/tutorial/forcetorque/model_two_sensors/README.md @@ -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: @@ -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 +~~~ diff --git a/tutorial/imu/README.md b/tutorial/imu/README.md index 06e8404..8d25f40 100644 --- a/tutorial/imu/README.md +++ b/tutorial/imu/README.md @@ -8,10 +8,7 @@ ~~~ - 2nd terminal: ~~~ - export LIBGL_ALWAYS_SOFTWARE=1 - cd build - export GZ_SIM_SYSTEM_PLUGIN_PATH=`pwd`:`pwd`/lib - cd ../tutorial/imu + cd tutorial/imu gz sim model.sdf ~~~ - 3rd terminal: @@ -30,6 +27,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: ``` diff --git a/tutorial/laser/README.md b/tutorial/laser/README.md index 3dae9fa..751fa15 100644 --- a/tutorial/laser/README.md +++ b/tutorial/laser/README.md @@ -8,10 +8,7 @@ ~~~ - 2nd terminal: ~~~ - export LIBGL_ALWAYS_SOFTWARE=1 - cd build - export GZ_SIM_SYSTEM_PLUGIN_PATH=`pwd`:`pwd`/lib - cd ../tutorial/laser + cd tutorial/laser gz sim model.sdf ~~~ - 3rd terminal: @@ -26,6 +23,15 @@ Finally start the simulation in Gazebo. If we put an obstacle (for example a cyl ... ~~~ +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: ```