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

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 #672

Open
2 tasks
traversaro opened this issue Jan 10, 2024 · 2 comments

Comments

@traversaro
Copy link
Member

traversaro commented Jan 10, 2024

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:

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
Copy link
Member Author

Implemeting the yarpRobotInterfaceConfigurationParameters tag would permit also to use the extern-name parameter, see https://github.com/robotology/yarp/blob/6e5676bf19b89cb0a75c9a83d593b484db93a5b7/src/libYARP_robotinterface/src/yarp/robotinterface/impl/XMLReaderFileV3.cpp#L576 .

@traversaro
Copy link
Member Author

In

m_xmlRobotInterfaceResult = m_xmlRobotInterfaceReader.getRobotFromFile(robotinterface_file_path);
we need to switch from getRobotFromFile overload with just one argument to the one that takes in input a Serchable, and that Searchable could be a Bottle or Property generated by the string passed in yarpRobotInterfaceConfigurationParameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant