Skip to content

Commit

Permalink
Merge pull request #432 from robotology/devel
Browse files Browse the repository at this point in the history
Merge devel in master and release v3.2.0
  • Loading branch information
traversaro authored Jul 1, 2019
2 parents 06853b2 + 147419e commit 06255f1
Show file tree
Hide file tree
Showing 85 changed files with 6,604 additions and 3,922 deletions.
3 changes: 2 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ Mirko Ferrati <[email protected]>
Nicola Piga <[email protected]>
Prashanth Ramadoss <[email protected]>
Silvio Traversaro <[email protected]>
Yeshasvi Tirupachuri<[email protected]>
Yeshasvi Tirupachuri <[email protected]>
Lorenzo Rapetti <[email protected]>
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog
All notable changes to this project will be documented in this file.

The format of this document is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [3.2.0] - 2019-07-01
### Added
- Add `resetSimulation` method to reset simulation state and time time, in the `gazebo_yarp_clock` RPC interface (https://github.com/robotology/gazebo-yarp-plugins/pull/345).
- Add `resetSimulationState` method to reset simulation state, but not the time, in the `gazebo_yarp_clock` RPC interface (https://github.com/robotology/gazebo-yarp-plugins/pull/424).
- Add `gazebo_yarp_doublelaser` plugin to simulate a double laser device (https://github.com/robotology/gazebo-yarp-plugins/pull/419).
- Add `gazebo_yarp_configurationoverride` plugin that can be attached to a model in order to override the [`sdf`](http://sdformat.org/spec) configuration of any other plugin that is attached to the same model (https://github.com/robotology/gazebo-yarp-plugins/pull/401). This plugin is particularly useful to set the initial configuration of a given model, and is documented in https://github.com/robotology/gazebo-yarp-plugins/blob/v3.2.0/plugins/configurationoverride/README.md .
- Add features in `gazebo_yarp_externalwrench` to apply multiple external wrenchs at the same time (https://github.com/robotology/gazebo-yarp-plugins/pull/418) .
- Add the `yarpConfigurationString` to configure the YARP plugins with a single `yarpConfigurationString` embedded in the SDF code of the plugin (https://github.com/robotology/gazebo-yarp-plugins/pull/396).
- Add a ChangeLog document based on the format defined in [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Fixed
- Fix invalid camera parameters in `gazebo_depthCamera` plugin (https://github.com/robotology/gazebo-yarp-plugins/pull/408).
9 changes: 3 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ PROJECT(GazeboYARPPlugins)

# Project version
set(${PROJECT_NAME}_MAJOR_VERSION 3)
set(${PROJECT_NAME}_MINOR_VERSION 1)
set(${PROJECT_NAME}_PATCH_VERSION 2)
set(${PROJECT_NAME}_MINOR_VERSION 2)
set(${PROJECT_NAME}_PATCH_VERSION 0)

set(${PROJECT_NAME}_VERSION
${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}.${${PROJECT_NAME}_PATCH_VERSION})

Expand Down Expand Up @@ -45,10 +46,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)

#used for dir suffixes
include(GNUInstallDirs)
if (CMAKE_VERSION LESS 3.0)
# hack: by default this would be 'lib/x86_64-linux-gnu' on linux
set(CMAKE_INSTALL_LIBDIR lib)
endif()

OPTION(GAZEBO_YARP_PLUGINS_ENABLE_RPATH "Enable installation with RPATH" TRUE)
include(AddInstallRPATHSupport)
Expand Down
25 changes: 15 additions & 10 deletions doc/embed_plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,18 @@ but are nevertheless useful for simulating complex scenarios.
| Contact Load Cell Array| `gazebo_contactloadcellarray` | Model | gazebo::GazeboYarpContactLoadCellArray | yarp::dev::GazeboYarpContactLoadCellArrayDriver |

## Plugins exposing simulation-specific functionalities
| Functionality | Plugin Name | Plugin Type | Gazebo Plugin class |
| :----------------: |:-------------:| :-----:|:---------------------------------:|
| Clock synchronization | `gazebo_yarp_clock` | System | gazebo::GazeboYarpClock |
| Apply external force/torque via YARP facilities | `gazebo_yarp_externalwrench` | Model | gazebo::ApplyExternalWrench |
| Display the Center of Mass of a model | `gazebo_yarp_showmodelcom` | Model | gazebo::ShowModelCoM |
| Project an image stream on a simulated surface | `gazebo_yarp_videotexture` | Visual | gazebo::VideoTexture |
| Expose a YARP RPC interface to create/manipulate objects programatically. | `gazebo_yarp_worldinterface` | Model | gazebo::WorldInterface |
| Publish the absolute pose of the root link of a model. | `gazebo_yarp_modelposepublisher` | Model | gazebo::GazeboYarpModelPosePublisher |
| Expose a YARP RPC interface to attach/detach links of the models spawned to the links of the robot using a fixed joint. | `gazebo_yarp_rpc_linkattacher` | Model | gazebo::GazeboYarpLinkAttacher |
| Functionality | Plugin Name | Plugin Type | Gazebo Plugin class | YARP Device class (if any) |
| :----------------: |:-------------:| :-----:|:---------------------------------:|:-------------------:|
| Clock synchronization | `gazebo_yarp_clock` | System | gazebo::GazeboYarpClock | |
| Apply external force/torque via YARP facilities | `gazebo_yarp_externalwrench` | Model | gazebo::ApplyExternalWrench | |
| Display the Center of Mass of a model | `gazebo_yarp_showmodelcom` | Model | gazebo::ShowModelCoM | |
| Project an image stream on a simulated surface | `gazebo_yarp_videotexture` | Visual | gazebo::VideoTexture | |
| Expose a YARP RPC interface to create/manipulate objects programatically. | `gazebo_yarp_worldinterface` | Model | gazebo::WorldInterface | |
| Publish the absolute pose of the root link of a model. | `gazebo_yarp_modelposepublisher` | Model | gazebo::GazeboYarpModelPosePublisher | |
| Expose a YARP RPC interface to attach/detach links of the models spawned to the links of the robot using a fixed joint. | `gazebo_yarp_rpc_linkattacher` | Model | gazebo::GazeboYarpLinkAttacher | |
| Exposes the absolute pose, velocity and acceleration of a desired link through YARP analog server device| `gazebo_basestate` | Model | gazebo::GazeboYarpBaseState | yarp::dev::GazeboYarpBaseStateDriver |
| Changes the value of the property of a specific plugin attached to the model (if not present, the configuration is created) | `gazebo_yarp_configurationoverride` | Model | gazebo::GazeboYarpConfigurationOverride | |


## Using the plugins in Gazebo Models
In Gazebo, the simulated models are described using the [SDF (simulation description format)]((http://gazebosim.org/sdf.html), an XML-based file format.
Expand All @@ -55,7 +57,10 @@ For model plugins such as the `gazebo_yarp_controlboard`, a plugin can be loaded
</plugin>
~~~
Most Model and Sensor plugins present in `gazebo-yarp-plugins` read their configuration from the file referenced in the `yarpConfigurationFile` tag.
The location of the file is defined by using a [Gazebo URI](https://bitbucket.org/osrf/gazebo/wiki/uri), while the file is a [.ini YARP configuration file](http://www.yarp.it/yarp_config_files.html).
The location of the file is defined by using a [Gazebo URI](https://bitbucket.org/osrf/gazebo/wiki/uri), while the file is a [.ini YARP configuration file](http://www.yarp.it/yarp_config_files.html). Alternatively, parameters can be passed directly in the `sdf` with the [`Bottle`](http://www.yarp.it/classyarp_1_1os_1_1Bottle.html) format using the `yarpConfigurationString` tag (e.g. `<yarpConfigurationString>(name /iCub/linkattacher/rpc:i)</yarpConfigurationString>`). When using `yarpConfigurationString`, it is important to remember that:
- only **one** `yarpConfigurationString` can be defined for each plugin.
- the tags `<yarpConfigurationFile>` and `<yarpConfigurationString>` can coexist, but if a parameter is defined in both the value in `<yarpConfigurationString>` will **always** be used.

For specific information consumed by each plugin, please refer to the doxygen documentation of the specific plugin class.

System plugins instead need to be loaded at the beginning of the simulation, and hence they are passed as command line arguments when launching `gazebo` (or `gzserver`).
Expand Down
7 changes: 2 additions & 5 deletions libraries/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
# Authors: Enrico Mingo, Alessio Rocchi, Mirko Ferrati, Silvio Traversaro, Alessandro Settimi and Francesco Romano
# CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT

cmake_minimum_required(VERSION 2.8.11)


PROJECT(Library_Common)

if(CMAKE_VERSION VERSION_LESS 3.0.0)
set_property(GLOBAL APPEND PROPERTY GAZEBO_YARP_COMMON_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include")
else()

add_library(gazebo_yarp_lib_common INTERFACE)
target_include_directories(gazebo_yarp_lib_common INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
Expand All @@ -18,4 +16,3 @@ else()
install(TARGETS gazebo_yarp_lib_common EXPORT GazeboYARPPlugins)
install(FILES include/GazeboYarpPlugins/common.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/GazeboYarpPlugins)
endif()
2 changes: 1 addition & 1 deletion libraries/singleton/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Authors: Enrico Mingo, Alessio Rocchi, Mirko Ferrati, Silvio Traversaro, Alessandro Settimi and Francesco Romano
# CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT

cmake_minimum_required(VERSION 2.8.11)


PROJECT(Library_Singleton)

Expand Down
8 changes: 6 additions & 2 deletions libraries/singleton/include/GazeboYarpPlugins/ConfHelpers.hh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ std::vector<std::string> splitString(const std::string &s, const std::string &de
* Load the configuration for a given model plugin,
* and save the configuration in the plugin_parameters output object.
* This involves calling addGazeboEnviromentalVariablesModel and then loading
* the yarp configuration file specified in the sdf with the yarpConfigurationFile tag.
* the yarp configuration file specified in the sdf with the yarpConfigurationFile and
* yarpConfigurationString tags. In case a parameter is defined in both, the yarpConfigurationString
* has the priority.
*/
bool loadConfigModelPlugin(gazebo::physics::ModelPtr _parent,
sdf::ElementPtr _sdf,
Expand Down Expand Up @@ -74,7 +76,9 @@ bool addGazeboEnviromentalVariablesModel(gazebo::physics::ModelPtr _parent,
* Load the configuration for a given sensor plugin,
* and save the configuration in the plugin_parameters output object.
* This involves calling addGazeboEnviromentalVariablesSensor and then loading
* the yarp configuration file specified in the sdf with the yarpConfigurationFile tag.
* the yarp configuration file specified in the sdf with the yarpConfigurationFile and
* yarpConfigurationString tags. In case a parameter is defined in both, the yarpConfigurationString
* has the priority.
*/
bool loadConfigSensorPlugin(gazebo::sensors::SensorPtr _sensor,
sdf::ElementPtr _sdf,
Expand Down
58 changes: 39 additions & 19 deletions libraries/singleton/src/ConfHelpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,33 @@ bool loadConfigModelPlugin(physics::ModelPtr _model,
sdf::ElementPtr _sdf,
yarp::os::Property& plugin_parameters)
{
if (_sdf->HasElement("yarpConfigurationFile")) {
GazeboYarpPlugins::addGazeboEnviromentalVariablesModel(_model,_sdf,plugin_parameters);
bool wipe = false;
bool loaded_configuration = true;

if (_sdf->HasElement("yarpConfigurationFile"))
{
std::string ini_file_name = _sdf->Get<std::string>("yarpConfigurationFile");
std::string ini_file_path = gazebo::common::SystemPaths::Instance()->FindFileURI(ini_file_name);

GazeboYarpPlugins::addGazeboEnviromentalVariablesModel(_model,_sdf,plugin_parameters);

bool wipe = false;
if (ini_file_path != "" && plugin_parameters.fromConfigFile(ini_file_path.c_str(),wipe)) {
return true;
loaded_configuration = true;
} else {
yError() << "GazeboYarpPlugins error: failure in loading configuration for model" << _model->GetName() << "\n"
<< "GazeboYarpPlugins error: yarpConfigurationFile : " << ini_file_name << "\n"
<< "GazeboYarpPlugins error: yarpConfigurationFile absolute path : " << ini_file_path;
return false;
loaded_configuration = false;
}
}
return true;

if (_sdf->HasElement("yarpConfigurationString"))
{
std::string configuration_string = _sdf->Get<std::string>("yarpConfigurationString");
plugin_parameters.fromString(configuration_string, wipe);
yInfo() << "GazeboYarpPlugins: configuration of model " << _model->GetName() << " loaded from yarpConfigurationString : " << configuration_string << "\n";
}

return loaded_configuration;
}

bool addGazeboEnviromentalVariablesSensor(gazebo::sensors::SensorPtr _sensor,
Expand Down Expand Up @@ -122,31 +132,41 @@ bool loadConfigSensorPlugin(sensors::SensorPtr _sensor,
sdf::ElementPtr _sdf,
yarp::os::Property& plugin_parameters)
{
GazeboYarpPlugins::addGazeboEnviromentalVariablesSensor(_sensor,_sdf,plugin_parameters);
bool wipe = false;
bool loaded_configuration = true;

#if GAZEBO_MAJOR_VERSION >= 7
std::string sensorName = _sensor->Name();
#else
std::string sensorName = _sensor->GetName();
#endif

if (_sdf->HasElement("yarpConfigurationFile")) {
std::string ini_file_name = _sdf->Get<std::string>("yarpConfigurationFile");
std::string ini_file_path = gazebo::common::SystemPaths::Instance()->FindFileURI(ini_file_name);

GazeboYarpPlugins::addGazeboEnviromentalVariablesSensor(_sensor,_sdf,plugin_parameters);

bool wipe = false;

if (ini_file_path != "" && plugin_parameters.fromConfigFile(ini_file_path.c_str(),wipe))
{
return true;
loaded_configuration = true;
}
else
{
#if GAZEBO_MAJOR_VERSION >= 7
std::string sensorName = _sensor->Name();
#else
std::string sensorName = _sensor->GetName();
#endif
yError() << "GazeboYarpPlugins error: failure in loading configuration for sensor " << sensorName << "\n"
<< "GazeboYarpPlugins error: yarpConfigurationFile : " << ini_file_name << "\n"
<< "GazeboYarpPlugins error: yarpConfigurationFile absolute path : " << ini_file_path ;
return false;
loaded_configuration = false;
}
}
return true;

if (_sdf->HasElement("yarpConfigurationString"))
{
std::string configuration_string = _sdf->Get<std::string>("yarpConfigurationString");
plugin_parameters.fromString(configuration_string, wipe);
yInfo() << "GazeboYarpPlugins: configuration of sensor " << sensorName << " loaded from yarpConfigurationString : " << configuration_string << "\n";
}

return loaded_configuration;
}


Expand Down
2 changes: 2 additions & 0 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ endif()
add_subdirectory(worldinterface)
add_subdirectory(linkattacher)
add_subdirectory(lasersensor)
add_subdirectory(doublelaser)
add_subdirectory(depthCamera)


add_subdirectory(contactloadcellarray)
add_subdirectory(modelposepublisher)
add_subdirectory(basestate)
add_subdirectory(configurationoverride)
8 changes: 1 addition & 7 deletions plugins/basestate/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,18 @@
# Authors: see AUTHORS file.
# CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT

cmake_minimum_required(VERSION 2.8.7)

include(AddGazeboYarpPluginTarget)

set(LIB_COMMON_NAME gazebo_yarp_lib_common)

if(CMAKE_VERSION VERSION_LESS 3.0.0)
get_property(GAZEBO_YARP_COMMON_HEADERS GLOBAL PROPERTY GAZEBO_YARP_COMMON_HEADERS)
unset(LIB_COMMON_NAME)
endif()


add_gazebo_yarp_plugin_target(LIBRARY_NAME basestate
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}
INCLUDE_DIRS include/gazebo
include/yarp/dev
SYSTEM_INCLUDE_DIRS ${GAZEBO_YARP_COMMON_HEADERS} ${Boost_INCLUDE_DIRS} ${GAZEBO_INCLUDE_DIRS} ${SDFORMAT_INCLUDE_DIRS} ${PROTOBUF_INCLUDE_DIRS}
LINKED_LIBRARIES ${LIB_COMMON_NAME} gazebo_yarp_singleton ${YARP_LIBRARIES} ${GAZEBO_LIBRARIES} ${Boost_LIBRARIES} ${SDFORMAT_LIBRARIES}
LINKED_LIBRARIES gazebo_yarp_lib_common gazebo_yarp_singleton ${YARP_LIBRARIES} ${GAZEBO_LIBRARIES} ${Boost_LIBRARIES} ${SDFORMAT_LIBRARIES}
HEADERS include/gazebo/BaseState.hh
include/yarp/dev/BaseStateDriver.h
SOURCES src/BaseState.cc
Expand Down
48 changes: 21 additions & 27 deletions plugins/basestate/src/BaseState.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,33 +65,27 @@ namespace gazebo
::yarp::dev::Drivers::factory().add(new ::yarp::dev::DriverCreatorOf< ::yarp::dev::GazeboYarpBaseStateDriver>
("gazebo_basestate", "analogServer", "GazeboYarpBaseState"));

yarp::os::Bottle networkDeviceProp;
yarp::os::Bottle deviceDriverProp;

if (_sdf->HasElement("yarpConfigurationFile"))
{
std::string ini_file_name = _sdf->Get<std::string>("yarpConfigurationFile");
std::string ini_file_path = gazebo::common::SystemPaths::Instance()->FindFileURI(ini_file_name);

GazeboYarpPlugins::addGazeboEnviromentalVariablesModel(_parent, _sdf, m_config);

bool wipe = false;
if (ini_file_path != "" && m_config.fromConfigFile(ini_file_path.c_str(), wipe))
{
networkDeviceProp = m_config.findGroup("WRAPPER");
if (networkDeviceProp.isNull())
{
yError() << "GazeboYarpBaseState plugin failed: [WRAPPER] group not found in config file";
return;
}

deviceDriverProp = m_config.findGroup("DRIVER");
if (deviceDriverProp.isNull())
{
yError() << "GazeboYarpBaseState plugin failed: [DRIVER] group not found in config file";
return;
}
}
// Getting .ini configuration file parameters from sdf
bool configuration_loaded = GazeboYarpPlugins::loadConfigModelPlugin(_parent, _sdf, m_config);

if (!configuration_loaded)
{
yError() << "GazeboYarpBaseState : File .ini not found, load failed." ;
return;
}

yarp::os::Bottle networkDeviceProp = m_config.findGroup("WRAPPER");
if (networkDeviceProp.isNull())
{
yError() << "GazeboYarpBaseState plugin failed: [WRAPPER] group not found in config file";
return;
}

yarp::os::Bottle deviceDriverProp = m_config.findGroup("DRIVER");
if (deviceDriverProp.isNull())
{
yError() << "GazeboYarpBaseState plugin failed: [DRIVER] group not found in config file";
return;
}

if (networkDeviceProp.find("device").isNull())
Expand Down
11 changes: 4 additions & 7 deletions plugins/camera/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,19 @@
# Authors: Enrico Mingo, Alessio Rocchi, Mirko Ferrati, Silvio Traversaro, Alessandro Settimi and Francesco Romano
# CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT

cmake_minimum_required(VERSION 2.8.7)


PROJECT(Plugin_Camera)

include(AddGazeboYarpPluginTarget)

set(LIB_COMMON_NAME gazebo_yarp_lib_common)
if(CMAKE_VERSION VERSION_LESS 3.0.0)
get_property(GAZEBO_YARP_COMMON_HEADERS GLOBAL PROPERTY GAZEBO_YARP_COMMON_HEADERS)
unset(LIB_COMMON_NAME)
endif()



add_gazebo_yarp_plugin_target(LIBRARY_NAME camera
INCLUDE_DIRS include/gazebo include/yarp/dev
SYSTEM_INCLUDE_DIRS ${GAZEBO_YARP_COMMON_HEADERS} ${Boost_INCLUDE_DIRS} ${GAZEBO_INCLUDE_DIRS} ${SDFORMAT_INCLUDE_DIRS} ${PROTOBUF_INCLUDE_DIRS} ${OGRE_INCLUDE_DIRS}
LINKED_LIBRARIES ${LIB_COMMON_NAME} gazebo_yarp_singleton ${YARP_LIBRARIES} ${GAZEBO_LIBRARIES} ${Boost_LIBRARIES} CameraPlugin
LINKED_LIBRARIES gazebo_yarp_lib_common gazebo_yarp_singleton ${YARP_LIBRARIES} ${GAZEBO_LIBRARIES} ${Boost_LIBRARIES} CameraPlugin
HEADERS include/gazebo/Camera.hh
include/yarp/dev/CameraDriver.h
SOURCES src/Camera.cc
Expand Down
Loading

0 comments on commit 06255f1

Please sign in to comment.