A very typical scenario within the ROS 2 ecosystem is that of two applications running under different ROS 2 domain IDs, so that they are isolated from each other; however, it might be required to bridge some of the published topics by the first application, so that a subscriber on the second application, running on a different domain ID can consume this information. This is where the Integration Service plays a fundamental role, by allowing to bridge two ROS 2 dataspaces easily.
The steps described below allow a ROS 2 publisher application, running under a certain domain ID, to communicate with a ROS 2 subscriber (echo) application, which is running under a different domain ID.
To prepare the deployment and setup the environment, you need to have Integration Service correctly installed in your system. To do so, please follow the steps delineated in the :ref:`installation` section.
Also, to get this example working, the following requirements must be met:
Having ROS 2 (Foxy or superior) installed, with the
talker-listenerexample working.Having the Static ROS 2 System Handle installed. You can download it from the dedicated repository into the
is-workspacewhere you have Integration Service installed:cd ~/is-workspace git clone https://github.com/eProsima/ROS2-SH.git src/ROS2-SH
After you have everything correctly installed in your is-workspace, build the packages by running:
colcon buildBelow we explain how to deploy an example of this use case. To do so, open three terminals:
In the first terminal, source the ROS 2 installation and launch the ROS 2
pubapplication, under domain ID 5:ROS_DOMAIN_ID=5 ros2 topic pub -r 1 /string_topic std_msgs/String "{data: \"Hello, ROS 2 domain 10\"}"In the second terminal, source the ROS 2 installation and launch the ROS 2
echoapplication, under domain ID 10:ROS_DOMAIN_ID=10 ros2 topic echo /string_topic std_msgs/msg/String
Up to this point, no communication should be seen between the publisher and the subscriber, due to the domain ID change. This is where Integration Service comes into play to make the communication possible.
In the third terminal, go to the
is-workspacefolder, source the local installations, and execute Integration Service with theintegration-servicecommand followed by the ros2__domain_id_change.yaml configuration file located in thesrc/Integration-Service/basicfolder:cd ~/is-workspace source install/setup.bash integration-service src/Integration-Service/examples/basic/ros2__domain_id_change.yaml
Once the last command is executed, the two applications will start communicating.
