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:
- Open a MATLAB® session.
- Create a file named “cyclonedds.xml”.
- 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