Add compatibility to an unsupported protocol

Another typical scenario encountered when communicating different systems is that they use different protocols, for example, DDS and ROS1.

_images/DDS_NO_ROS1.png

In such a case, in the absence of the eProsima Integration-Service tool the user would need to create a custom DDS to ROS1 bridge that won’t be reusable to communicate either of the two with other protocols.

By using eProsima Integration-Service instead, this communication can be achieved with minimum user’s effort. In this specific case, a ROS1 System-Handle already exists, so the communication with DDS is essentially direct. However, the communication is straightforward enough even if a dedicated System-Handle doesn’t exist yet, as the user can create his own System-Handle, thus becoming able to communicate with DDS and any other protocol already supported by eProsima Integration-Service. For more information regarding how to generate a System-Handle from scratch, please consult the System-Handle Creation section of the SOSS documentation.

_images/DDS_IS_ROS1.png

In the example below we show how eProsima Integration-Service bridges a DDS application with a ROS1 application, by communicating a HelloWorld DDS application with a talker-listener example.

Example: ROS1 communication

Requirements

To prepare the deployment and setup the environment, you need to have eProsima Integration-Service correctly installed in your system. To do so, please follow the steps delined in Getting Started and read carefully the Important remarks section.

To get this example working, the following requirements must be met:

  • Having ROS1 Melodic installed, with the pub-echo example working.

  • Having the HelloWorldExample compiled. To do so, go to the ~/is-workspace/src/soss-dds/examples/common/HelloWorldExample folder and type:

    mkdir build
    cd build
    cmake ..
    make
    
  • Having the ros1_std_msgs compiled. To do so, go to the ~/is-workspace/src/soss-dds/examples/common/ros1_std_msgs folder and type:

    mkdir build
    cd build
    cmake ..
    make
    
  • Having the SOSS-ROS1 System-Handle installed, that you can download from the dedicated SOSS-ROS1 repository. Clone it into the workspace where you have eProsima Integration-Service installed:

    cd ~/is-workspace
    git clone ssh://git@github.com/eProsima/soss-ros1 src/soss-ros1 -b feature/xtypes-support
    

    And then build the packages by running:

    colcon build
    

ROS1 pub to DDS subscriber

Open three terminals:

  • In the first terminal, launch the ROS1 pub application with the commands:

    source /opt/ros/melodic/setup.bash
    rostopic pub -1 /chatter std_msgs/String -- "message"
    

    where “message” is some custom message chosen by the user.

  • In the second terminal, execute the HelloWorld example as a subscriber:

    cd ~/is-workspace
    source install/setup.bash
    ./src/soss-dds/examples/common/HelloWorldExample/build/HelloWorldExample subscriber
    
  • In the third terminal, go to the is-workspace folder where you have eProsima Integration-Service and the SOSS-ROS1 System-Handle installed, and execute the former using the soss command followed by the ros1_dds.yaml configuration file located in the src/soss-dds/examples/ros1 folder:

    cd ~/is-workspace
    source /opt/ros/melodic/setup.bash
    source install/setup.bash
    soss src/soss-dds/examples/ros1/ros1_dds.yaml
    

Once eProsima Integration-Service is launched, you should see that the ROS1 pub and the HelloWorld subscriber will start communicating.

DDS publisher to ROS1 echo

If you want to test it the other way around, launch the ROS1 echo with the command:

source /opt/ros/melodic/setup.bash
rostopic echo /chatter

Then launch the HelloWorld as a publisher, and eProsima Integration-Service using the soss command followed by the dds_ros1.yaml configuration file located in the src/soss-dds/examples/ros1 folder instead:

cd ~/is-workspace
source /opt/ros/melodic/setup.bash
source install/setup.bash
soss src/soss-dds/examples/ros1/dds_ros1.yaml