How to configure CycloneDDS to use multiple network interfaces?

조회 수: 39 (최근 30일)
Abhishek
Abhishek 2025년 10월 30일 5:57
편집: Abhishek 2025년 10월 30일 6:02
When you use CycloneDDS as the ROS 2 middleware (RMW), communication may fail across one or multiple network interfaces such as, Ethernet, WSL virtual adapter, or WiFi. Even though the host is able to connect to multiple networks, MATLAB may not be able to discover nodes across all the network interfaces. How to enable discovery of nodes on all desired interfaces?

채택된 답변

Abhishek
Abhishek 2025년 10월 30일 5:59
편집: Abhishek 2025년 10월 30일 6:02
By default, CycloneDDS may not be able to evaluate if communication is possible across multiple network interfaces, unless you explicitly configure them. To configure desired network interfaces, follow the steps below:
  1. Open a MATLAB® session.
  2. Create a file named “cyclonedds.xml”.
  3. Copy and paste the following XML content into the file.
<CycloneDDS xmlns="https://cdds.io/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://cdds.io/config https://raw.githubusercontent.com/eclipse-cyclonedds/cyclonedds/master/etc/cyclonedds.xsd">
<Domain>
<General>
<Interfaces>
<NetworkInterface name="vEthernet (WSL (Hyper-V firewall))"/>
</Interfaces>
<DontRoute>true</DontRoute>
</General>
</Domain>
</CycloneDDS>
  • Set the value of <NetworkInterface name=""/> in the code to define each network interface.For example, if your interface is vEthernet (WSL (Hyper-V firewall)), add <NetworkInterface name="vEthernet (WSL (Hyper-V firewall))"/>.
  • Set the General/DontRoute tag to prevent automatic routing that can interrupt communication when multiple interfaces are configured.
4. In MATLAB command window, run the following command to set the 'CYCLONEDDS_URI’ environment variable to point to the “cyclonedds.xml“ file.
setenv("CYCLONEDDS_URI", "<path/to/cyclonedds.xml>")
5. After you set the environment variable, run the following command in the MATLAB command window to clear existing resources and then list the nodes available in network:
clear all;
ros2 node list

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 ROS 2 Network Access in Simulink에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by