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

HandMk5 refactor as device #178

Merged
merged 15 commits into from
Dec 21, 2023
Merged
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
- ergoCubV1: fixed the names r/l_upperarm with r/l_upper_arm(https://github.com/icub-tech-iit/ergocub-software/issues/197)
- Fixed HF when resetting the world when using DART as PE(https://github.com/icub-tech-iit/ergocub-software/issues/190)
- Added `couplingXCubHandMk5` device

## [0.6.0] - 2023-11-15

Expand Down
42 changes: 33 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,52 @@

cmake_minimum_required(VERSION 3.12)

project(ergocub-software
VERSION 0.6.0)
project(ergocub-software LANGUAGES C CXX
VERSION 0.6.0)

find_package(YARP 3.7.2 REQUIRED)
find_package(YARP 3.9.0 REQUIRED)

# Give error if add_dependencies is called on a non-existing target
if(POLICY CMP0046)
cmake_policy(SET CMP0046 NEW)
endif()

find_package(YCM 0.12 REQUIRED)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

include(AddUninstallTarget)

option(BUILD_TESTING "Run tests for the generated models" OFF)
option(COMPILE_ergoCubEmotions "Compile the module controlling the ergoCub emotions" OFF)

if(MSVC)
set(CMAKE_DEBUG_POSTFIX "d")
endif()

# To build shared libraries in Windows, we set CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS to TRUE.
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

option(BUILD_SHARED_LIBS "Build libraries as shared as opposed to static" ON)
# Build position independent code.
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

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

# Encourage user to specify a build type (e.g. Release, Debug, etc.), otherwise set it to Release.
if(NOT CMAKE_CONFIGURATION_TYPES)
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'Release' as none was specified.")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY VALUE "Release")
endif()
endif()

set(BUILD_PREFIX "ergoCub")
add_subdirectory(urdf)

Expand All @@ -43,9 +72,4 @@ if (BUILD_TESTING)
endif()

add_subdirectory(app)

if(COMPILE_ergoCubEmotions)
add_subdirectory(src)
endif()


add_subdirectory(src)
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Main collector of ergoCub specific SW

### Dependencies

Before installing `ergocub-software`, please be sure that you've installed [YARP](https://www.yarp.it/latest//) on your machine.
Before installing `ergocub-software`, please be sure that you've installed [YARP](https://www.yarp.it/latest//) 3.9.0 or higher on your machine.

### Compiling from source

Expand All @@ -17,7 +17,7 @@ cmake -DCMAKE_INSTALL_PREFIX=<install-prefix> ..
make
(make install)
```
`ergocub` for Gazebo Classic simulation model needs a gazebo-yarp-plugins >= 4.9.0 .
`ergocub` for Gazebo Classic simulation model needs a gazebo-yarp-plugins latest devel (FIXME put commit).

In order to use the model, the following env variables must be configured:
```sh
Expand All @@ -28,6 +28,10 @@ export GAZEBO_MODEL_PATH=${GAZEBO_MODEL_PATH}:<install-prefix>/share/ergoCub/rob
export GAZEBO_MODEL_PATH=${GAZEBO_MODEL_PATH}:<install-prefix>/share/
```

In order to make the device `couplingXCubHandMk5` detectable, add `<installation_path>/share/yarp` to the `YARP_DATA_DIRS` environment variable of the system.

Alternatively, if `YARP` has been installed using the [robotology-superbuild](https://github.com/robotology/robotology-superbuild), it is possible to use `<directory-where-you-downloaded-robotology-superbuild>/build/install` as the `<installation_path>`.

### Use conda binary packages

This repository is packaged as `ergocub-software` in the `robotology` conda channel, see https://anaconda.org/robotology/ergocub-software .
Expand Down
5 changes: 4 additions & 1 deletion src/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
# This software may be modified and distributed under the terms of the
# BSD-3-Clause license. See the accompanying LICENSE file for details.

add_subdirectory(ergoCubEmotions)
if(COMPILE_ergoCubEmotions)
add_subdirectory(ergoCubEmotions)
endif()
add_subdirectory(couplingXCubHandMk5)
41 changes: 41 additions & 0 deletions src/modules/couplingXCubHandMk5/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (C) 2006-2023 Istituto Italiano di Tecnologia (IIT)
# All rights reserved.
#
# This software may be modified and distributed under the terms of the
# BSD-3-Clause license. See the accompanying LICENSE file for details.

yarp_configure_plugins_installation(ergocub-software)

yarp_prepare_plugin(couplingXCubHandMk5
CATEGORY device
TYPE CouplingXCubHandMk5
INCLUDE CouplingXCubHandMk5.h
DEFAULT ON)

if(ENABLE_couplingXCubHandMk5)

yarp_add_plugin(yarp_couplingXCubHandMk5)

if(MSVC)
add_definitions(-D_USE_MATH_DEFINES)
endif()

target_sources(yarp_couplingXCubHandMk5 PRIVATE CouplingXCubHandMk5.cpp
CouplingXCubHandMk5.h)

target_link_libraries(yarp_couplingXCubHandMk5 PRIVATE YARP::YARP_os
YARP::YARP_dev)
list(APPEND YARP_${YARP_PLUGIN_MASTER}_PRIVATE_DEPS YARP_os
YARP_dev)

yarp_install(TARGETS yarp_couplingXCubHandMk5
EXPORT YARP_${YARP_PLUGIN_MASTER}
COMPONENT ${YARP_PLUGIN_MASTER}
LIBRARY DESTINATION ${YARP_DYNAMIC_PLUGINS_INSTALL_DIR}
ARCHIVE DESTINATION ${YARP_STATIC_PLUGINS_INSTALL_DIR}
YARP_INI DESTINATION ${YARP_PLUGIN_MANIFESTS_INSTALL_DIR})

set(YARP_${YARP_PLUGIN_MASTER}_PRIVATE_DEPS ${YARP_${YARP_PLUGIN_MASTER}_PRIVATE_DEPS} PARENT_SCOPE)

set_property(TARGET yarp_couplingXCubHandMk5 PROPERTY FOLDER "Plugins/Device")
endif()
Loading
Loading