ROS2 talker listener using difffernt DDS

Hi all,

I am currently trying to use an alternative DDS rather than fastrtps. However I have noticed that the talker and listener demo which used to just run “talker” after sourcing the setup file is now changed to “ros2 run demo_nodes_cpp talker”. The old “talker__rmw_connext_cpp” that ued to let you use an alternative DDS is no longer working. My question is what is the new command for using an alternative DDS?

Thankyou

You can use the RMW_IMPLEMENTATION environment variable: see https://github.com/ros2/ros2/wiki/Working-with-multiple-RMW-implementations

Note, however, that this will only take effect if you have built the node in a workspace that supports multiple RMW implementations. The pre-built binaries only provide support for the default, rmw_fastrtps_cpp.

Hi dhood,
I have ran the RMW_IMPLEMENTATION as you mentioned earlier. However, I just wanted to know if there is a way that I could know if I am using my targeted dds or if it is just going back to the default fastrtps.

You can set the RCL_ASSERT_RMW_ID_MATCHES environment variable to be sure. If it doesn’t match you’ll get an error like:

$ RCL_ASSERT_RMW_ID_MATCHES=rmw_connext_cpp RMW_IMPLEMENTATION=rmw_fastrtps_cpp ros2 run demo_nodes_cpp talker
Expected RMW implementation identifier of 'rmw_connext_cpp' but instead found 'rmw_fastrtps_cpp', exiting with 102.

We have ideas for how to make this introspection easier for users in the future, but for the meantime I’ve added this info to the wiki page.