Main Content

Switching Between ROS Middleware Implementations

ROS 2 is based on the Data Distribution Service (DDS™) standard, an end-to-end middleware protocol that provides features such as discovery, serialization, and transportation. ROS 2 supports multiple ROS middleware (RMW) implementations so that you can choose one that best suits your requirements. Use these factors to inform your choice of middleware implementation: platform availability, performance characteristics, computation footprint, dependencies, and license.

You can switch between RMW implementations for using DDS while working with ROS 2 in MATLAB® and Simulink®, from ROS Toolbox Preferences. ROS Toolbox contains these RMW implementations.

  • rmw_fastrtps_cpp — eProsima Fast DDS (Version 2.6.4). This is the default RMW implementation.

  • rmw_fastrtps_dynamic_cpp — eProsima Fast DDS.

  • rmw_cyclonedds_cpp — Eclipse Cyclone DDS (Version 0.9.1).

You can also configure and switch to these custom RMW implementations.

  • rmw_connextdds — RTI Connext DDS (version 6.0.1 or later). This implementation is supported on Windows®, Linux®, and macOS operating systems.

  • rmw_iceoryx_cpp — Eclipse Iceoryx Middleware (version 2.0.3). This implementation is supported on Linux and macOS operating systems.

Additionally, you can switch to other custom RMW implementations based on dynamic or static introspection type support in ROS 2 such as

  • rmw_ecal_dynamic_cpp — eCAL Middleware. This is based on dynamic introspection type support in ROS 2 and implements generic functions to pass a message to be published.

  • rmw_ecal_proto_cpp — eCAL Middleware. This is based on static type support in ROS 2 and requires a static ROS IDL (Interface Definition Language) type support package for building. This implements middleware specific functions for each message type to be published to a topic.

Note: When generating code in macOS operating system, using fastrtps as the RMW implementation is recommended for enhanced stability.

Video Walkthrough

For a walkthrough of the example, play the video.

Configure RMW Implementations Shipped with ROS Toolbox

1. In the Environment section of the Home tab in the MATLAB toolstrip, click Preferences and select ROS Toolbox.

ROS Toolbox Preferences

2. Click Open ROS Toolbox Preferences, specify the path to the Python executable, and click Recreate Python Environment. If you have configured Python already, proceed with the next step.

3. Open the dropdown list under ROS Middleware (RMW) Implementation to switch between RMW implementations. Select an implementation from the list and click OK. This enables you to create a ROS 2 node with the selected implementation.

create Python environment

Configure Custom RMW Implementations

1. Open the ROS Toolbox Preferences window using the above steps and create the Python environment.

2. Select Configure and Switch to Custom RMW Implementation in the dropdown list under ROS Middleware (RMW) Implementation to launch the ROS Middleware Configuration dialog box.

Choose custom RMW

3. This enables you to switch to a custom implementation like rmw_connextdds or rmw_iceoryx_cpp from the RMW Implementation dropdown menu.

connext_dds

4. To set up rmw_connextdds, verify the underlying DDS installation (RTI Connext DDS). For more information, see the links in the validation window.

validate connext dds

5. Click Browse and navigate to the parent directory of the DDS package. Build the RMW implementation package and then click Next if the build is successful.

build connextdds

6. Click Test RMW to validate if ROS 2 node creation is successful with the custom RMW implementation set to rmw_connextdds.

test connextdds

7. The selected ROS Middleware (RMW) Implementation is now registered as default in the dropdown menu. Click OK to set this RMW implementation.

connext dds select

Configure Other RMW Implementations Based on Dynamic or Static Introspection Type Support

1. Open the ROS Toolbox Preferences window using the above steps and create the Python environment.

2. Select Configure and Switch to Custom RMW Implementation to launch the ROS Middleware Configuration dialog box. Select other in the dropdown to provide the folderpath containing one or multiple RMW implementations, based on dynamic or static introspection type support. Click Next and proceed to validate their existence in the location.

configure other RMW

3. Providing the folderpath to a particular RMW implementation enables you to proceed with its configuration.

eCal_proto_validate.png

4. If the folder contains multiple RMW implementations, you can choose one or all from the dropdown in the subsequent interface. Click Next upon making the selection.

eCal_one_or_multiple.png

Note: Building RMW implementation based on static type support requires static ROS IDL type support package. For example, rmw_ecal_proto_cpp requires rosidl_typesupport_protobuf, which uses Protobuf for serialization and deserialization of ROS 2 messages.

eCal_proto_ros_idl.png

5. Provide the parent path to middleware installation and set the environment variables required to build the RMW implementation package or packages.

eCal_middleware_installation.png

6. Follow subsequent steps as earlier to build the RMW implementation package.

7. Additionally, build the ROS 2 message packages and custom messages to create ROS 2 node and work with ROS 2 APIs or Simulink Blocks on the selected RMW implementation.

eCal_ros2_messages_build.png

8. Test it to validate the ROS 2 node creation with the RMW implementation set to rmw_ecal_proto_cpp.

9. The selected ROS Middleware (RMW) Implementation is now registered as default in the dropdown menu. Click OK to set this RMW implementation.

ecal select

Use these steps to configure RMW implementations based on other middleware as well, such as openDDS, GurumDDS and further ones that are supported in ROS 2.