ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
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

Comments

Can you please specify what exactly you did to solve it? I have the same issue.

FelixBaum310 gravatar image FelixBaum310  ( 2022-11-06 08:50:49 -0500 )edit

I don't remember exactly what I have done, but after some manipulations Windows Defender Firewall started to ask what to do with a program wanting to create new network connection. I suppose you can open firewall & network protection settings -> advanced -> and remove all rules related to ROS2 programs.

wl gravatar image wl  ( 2022-11-07 09:10:47 -0500 )edit

Question Tools

3 followers

Stats

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

Seen: 1,867 times

Last updated: Sep 02 '21