gazebo-yarp-plugins icon indicating copy to clipboard operation
gazebo-yarp-plugins copied to clipboard

Ensure that enable_tags and disable_tags options can be passed in a world SDF file to the gazebo_yarp_robotinterface of an included model

Open traversaro opened this issue 5 months ago • 2 comments

In ergocub, there is sometimes the need to include some devices in the gazebo_yarp_robotinterface that can be enabled or disabled by the specific user. The main use cases is to be able to add some devices that are not enabled by default due to their specific run dependencies, but in some cases users want to run.

Specific instances of this need are:

  • @GiulioRomualdi wants to run ergoCubSN001 simulation with the the wholebodynamics device (installed by https://github.com/robotology/whole-body-estimators) to estimate external force/torques and internal joint torques inside gazebo, do avoid the overhead of running it outside (see https://github.com/icub-tech-iit/ergocub-software/issues/203)
  • @SimoneMic wants to run ergoCubSN0001 simulation exposing the robot functionality using ROS2 nws devices provided by https://github.com/robotology/yarp-devices-ros2 (https://github.com/icub-tech-iit/ergocub-software/issues/193)

In both cases (especially in the ROS2 case) we would strictly like to avoid adding a ROS2 runtime dependency on Gazebo Classic simulations of ergocub-software.

To achieve this, a possible idea is to use enable_tags and disable_tags options of yarprobotinterface (see https://www.yarp.it/latest/group__yarprobotinterface.html and https://github.com/robotology/robots-configuration/blob/08f2a6ecc3c9d4cc2dad6b4524775b9f8f97e9a2/R1SN001/CER.xml#L10) to mark the wbd and ROS2 devices in the gazebo_yarp_robotinterface configuration. For example, could be marked with enabled_by="enable_wholebodydynamics" and enabled_by="enable_ros2". In this way, this devices would be disabled by default, and to enable this the devices the users would need to pass enable_tags (enable_wholebodydynamics enable_ros2) to the gazebo_yarp_robotinterface configuration file. However, we do not want users to modify the configuration specified in the files shipped with ergocub-software, as this is not reproducible.

Instead, users should specify this information in the world file of their experiment and use gazebo_yarp_configurationoverride, for example:

<!-- SPDX-FileCopyrightText: Fondazione Istituto Italiano di Tecnologia (IIT) -->
<!-- SPDX-License-Identifier: BSD-3-Clause -->

<?xml version="1.0"?>
<sdf version="1.7">
  <world name="default">

    <!-- Light -->
    <include>
      <uri>model://sun</uri>
    </include>

    <!-- Ground Plane -->
    <include>
      <uri>model://ground_plane</uri>
    </include>

    <!-- ergoCub -->
    <model name="ergoCubGazeboV1_1_with_ros2_and_wbd">
      <plugin name='configuration_override' filename='libgazebo_yarp_configurationoverride.so'>
        <yarpPluginConfigurationOverride plugin_name='robotinterface'>
           <yarpRobotInterfaceConfigurationParameters>(enable_tags (enable_wholebodydynamics enable_ros2))</yarpRobotInterfaceConfigurationFile>
       </yarpPluginConfigurationOverride>
      </plugin>
      <include>
        <uri>model://ergoCub/robots/ergoCubGazeboV1_1</uri>
      </include>
    </model>
  </world>
</sdf>

The main problem is that at the moment the gazebo_yarp_robotinterface does not support any yarpRobotInterfaceConfigurationParameters tag, but just a yarpRobotInterfaceConfigurationFile tag to specify the .xml file to load. So, to solve this release we should:

  • [ ] Add a yarpRobotInterfaceConfigurationParameters argument to specify enable_tags and disable_tags parameters for gazebo_yarp_robotinterface
  • [ ] Test if the aforementioned example works fine, and if it works document it in gazebo_yarp_robotinterface docs

traversaro avatar Jan 10 '24 10:01 traversaro