Ask Your Question
1

ROS2 node communication across WSL2 border

asked 2021-09-01 11:18:59 -0500

wl gravatar image

updated 2021-09-02 03:31:46 -0500

Setup.

Windows 10 with all recent updates.

Ubuntu 20.04 inside WSL2 on that Windows. Also, all recent updates.

ROS2 rolling release, installed in Windows 10. The release uses CycloneDDS. For some reason I cannot run neither Foxy, nor Galactic installation. Here is the description of the bug: https://github.com/ros2/ros2/issues/1164

ROS2 Galactic, installed on Ubuntu inside WSL2 from Debian packages, recently updated.

Problem

Limited communication between ROS2 nodes, running on Windows and on Ubuntu/WSL2.

Default interface

ROS2 node on windows always tries to use Ethernet instead of WSL2 virtual network. This was solved by setting following CycloneDDS config:

<?xml version="1.0" encoding="UTF-8" ?>
<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 id="any">
    <General>
        <NetworkInterfaceAddress>172.30.224.1</NetworkInterfaceAddress>
        <AllowMulticast>true</AllowMulticast>
        <MaxMessageSize>65500B</MaxMessageSize>
        <FragmentSize>4000B</FragmentSize>
        <Transport>udp</Transport>
    </General>
<!--        <Discovery>-->
        <!--<Peers>-->
            <!--<Peer address="172.30.227.89"/>-->
            <!--<Peer address="172.30.224.1"/>-->
        <!--</Peers>-->
        <!--<ParticipantIndex>auto</ParticipantIndex>-->
    <!--</Discovery>-->
    <Tracing>
        <Verbosity>fine</Verbosity>
        <OutputFile>c:/work/cyclonedds/cdds-win.${CYCLONEDDS_PID}.log</OutputFile>
    </Tracing>
</Domain>
</CycloneDDS>


set CYCLONEDDS_URI=c:/work/cyclonedds/cdds_wsl2_win.xml

Similar config has been set for ros2 on Ubuntu/WSL

I've tried commenting and uncommenting "Discovery" tag, the situation doesn't change.

Multicast

Commands

ros2 multicast send
ros2 multicast receive

don't show any output, if one of them is run on Windows and another - on Ubuntu/WSL, no matter, what OS runs receive.

Talker/listener from demo nodes

I've got the following table, showing when the listener listens "Hellos" from the talker. Only two combinations out of 8. Any version of talker on Linux (Python or C++) and C++ listener on Windows.

Windows        Linux     
cpp talker     cpp listener  -> no connection
cpp listener   cpp talker    -> connected!
py talker      py listener    -> no connection
py listener    py talker        -> no connection
py talker      cpp listener    -> no connection
cpp talker     py listener     -> no connection
py listener    cpp talker     -> no connection
cpp listener   py talker      -> connected!

Question

How can I debug and resolve it?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-09-02 09:32:09 -0500

wl gravatar image

The issue was in the windows firewall settings.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

3 followers

Stats

Asked: 2021-09-01 11:18:59 -0500

Seen: 190 times

Last updated: Sep 02 '21