Add option to select networkinterface for libwmros2server

5 views (last 30 days)
Andrei Alexeev
Andrei Alexeev on 27 Jul 2021
Commented: Andrei Alexeev on 27 Jul 2021
Hello everyone,
I recently encountered a problem where my Matlab ROS2 would not connect to my ROS2 node on another machine. I had found out that the ROS2Server "libwmros2server" had selected a wrong network interface and therefore the DDS did not work.
My research on the internet and browsing the Matlab settings showed that it was not possible to select a network interface. Would it be possible to add an option to achieve this?
At this point, my solution is to turn off network adapters using powershell. (see Disable-NetAdapter)
With kind regards

Answers (1)

Cam Salzberger
Cam Salzberger on 27 Jul 2021
Hello Andrei,
ROS 2 itself doesn't currently provide an easy way to select a particular network interface to use (like an environment variable). However, you can pass settings to the underlying Fast-RTPS DDS implementation in the DEFAULT_FASTRTPS_PROFILES.xml file. There are some useful links in this answer here on how to whitelist network interfaces, and here for an example XML file in its more common use to extend the network outside the subnet. Have that file in the current directory when starting your ROS 2 nodes to have it affect the underlying implementation.




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by