2.1.3. ROS 1 System Handle

The main purpose of the ROS 1 System Handle is that of establishing a connection between a ROS 1 application and an application running over a different middleware implementation. This is the classic use-case for Integration Service.

2.1.3.1. Dependencies

The only dependency of this System Handle is to have a ROS 1 installation (Melodic or Noetic) in your system.

2.1.3.2. Configuration

Regarding the ROS 1 System Handle, there are several specific parameters which can be configured for the ROS 1 middleware. All of these parameters are optional, and are suboptions of the main five sections:

  • systems: The system type must be ros1. In addition to the type and types-from fields, the ROS 1 System Handle accepts the following specific configuration fields:

    systems:
      ros1:
        type: ros1
        node_name: "my_ros1_node"
    
    • node_name: The ROS 1 System Handle node name.

  • topics: The topic route must contain ros1 within its from or to fields. Additionally, the ROS 1 System Handle accepts the following topic specific configuration parameters, within the ros1 specific middleware configuration tag:

    routes:
      ros2_to_ros1: { from: ros2, to: ros1 }
      ros1_to_dds: { from: ros1, to: dds }
    
    topics:
      hello_ros1:
        type: std_msgs/String
        route: ros2_to_ros1
        ros1: { queue_size: 10, latch: false }
      hello_dds:
        type: std_msgs/String
        route: ros1_to_dds
        ros1: { queue_size: 5 }
    
    • queue_size: The maximum message queue size for the ROS 1 publisher or subscription.

    • latch: Enable or disable latching. When a connection is latched, the last message published is saved and sent to any future subscribers that connect. This configuration parameter only makes sense for ROS 1 publishers, so it is only useful for routes where the ROS 1 System Handle acts as a publisher, that is, for routes where ros1 is included in the to list.

2.1.3.3. Examples

There are several examples that you can find in this documentation in which the ROS 1 System Handle is employed in the communication process. Some of them are presented here:

2.1.3.4. Compilation flags

Besides the Global compilation flags available for the whole Integration Service product suite, there are some specific flags which apply only to the ROS 1 System Handle; they are listed below:

  • BUILD_ROS1_TESTS: Allows to specifically compile the ROS 1 System Handle unitary and integration tests. It is useful to avoid compiling each System Handle’section test suite present in the colcon workspace, which is what would happen if using the BUILD_TESTS flag, with the objective of minimizing building time. To use it, after making sure that the ROS 1 System Handle is present in your colcon workspace, execute the following command:

    ~/is_ws$ colcon build --cmake-args -DBUILD_ROS1_TESTS=ON
    
  • MIX_ROS_PACKAGES: It accepts as an argument a list of ROS packages, such as std_msgs, geometry_msgs, sensor_msgs, nav_msgs… for which the required transformation library to convert the specific ROS 1 type definitions into xTypes, and the other way around, will be built. This list is shared with the ROS 2 System Handle, meaning that the ROS packages specified in the MIX_ROS_PACKAGES variable will also be built for ROS 2 if the corresponding System Handle is present within the Integration Service workspace. To avoid possible errors, if a certain package is only present in ROS 1, the MIX_ROS1_PACKAGES flag must be used instead.

    These transformation libraries are also known within the Integration Service context as Middleware Interface Extension or mix libraries.

    By default, only the std_msgs_mix library is compiled, unless the BUILD_TESTS or BUILD_ROS1_TESTS is used, case in which some additional ROS 1 packages mix files required for testing will be built.

    If the user wants to compile some additional packages to use them with Integration Service, the following command must be launched to compile it, adding as much packages to the list as desired:

    ~/is_ws$ colcon build --cmake-args -DMIX_ROS_PACKAGES="std_msgs geometry_msgs sensor_msgs nav_msgs"
    
  • MIX_ROS1_PACKAGES: It is used just as the MIX_ROS_PACKAGES flag, but will only affect ROS 1; this means that the mix generation engine will not search within the ROS 2 packages, allowing to compile specific ROS 1 packages independently.

    For example, if a user wants to compile a certain package dummy_msgs independently from ROS 1, but compiling std_msgs and geometry_msgs for both the ROS 1 and ROS 2 System Handles, the following command should be executed:

    ~/is_ws$ colcon build --cmake-args -DMIX_ROS_PACKAGES="std_msgs geometry_msgs" -DMIX_ROS2_PACKAGES="dummy_msgs"
    

2.1.3.5. API Reference

The Integration Service API Reference constitutes an independent section within this documentation. To access the ROS 1 System Handle subsection, use this link.