Robotics StackExchange | Archived questions

WSL ROS master cannot subscribe client topics

Hello everybody,

Problem: My WSL ROS master cannot subscribe client topics. Every topic is listed in "rostopic list" and "rostopic info" shows the right subcribers and publisher. On WSL i can echo my client topics but the Callback function from my WSL node gets never triggered.

Setup: I want to use a WSL machine as a ROS master and a Raspberry Pi as a ROS client. The Pi creates a WLAN connection and the WSL connects to it through a WLAN-stick. My WSL can create a ssh access to my Pi.

Windows 10 - WSL

Raspberry Pi 3b+

Config WSL in bashrc: "export ROSMASTERURI=http://10.0.0.2:11311" and "export ROS_IP=10.0.0.2" Config WSL in/etc/hosts: "10.0.0.1 piRobot" and "10.0.0.2 DESKTOP"

Config Pi in bashrc: "export ROSMASTERURI=http://10.0.0.2:11311" and "export ROS_IP=10.0.0.1" Config Pi in/etc/hosts: "10.0.0.1 piRobot" and "10.0.0.2 DESKTOP"

Pi uses the roscore from WSL: WORKS

Pi subscribes Pi topics: WORKS

Pi subscribes WSL topics: WORKS

WSL subscribes WSL topics: WORKS

WSL subscribes Pi topics: FAIL

WSL echo Pi topics: WORKS

I used the tutorial listener and talker nodes.

Thanks for the help!

Asked by tburger on 2019-03-14 12:09:01 UTC

Comments

I exactly the same problem. I used the tutorial that you did and I copied the same code to 2 other machines where it works as expected. I have gone through all of the network testing that ROS suggests ROS Networking Setup and they all pass. The subscriber works with a publisher on wsl but not with the publisher on another system. Subscribers on other systems do get the wsl publisher messages.

So if you have found a solution, I would really appreciate hearing it.

Asked by starnovice on 2019-08-06 10:48:00 UTC

Hello,

I could not fixed this problem. I have not tried it with the Windows Update 1903. With every Windows update they are improving the WSL, maybe try it with 1903 or the new coming update 1908.

Have a nice day!

Asked by tburger on 2019-08-07 05:22:45 UTC

Tried with 1903 and did an apt-get update, still no joy. I just wish I could find out where the messages are going. They are being sent and recieved by other machines. I just don't know if the network stack is throwing them away or if the callback is not getting invoked. Thanks for your feedback.

Asked by starnovice on 2019-08-07 15:54:28 UTC

I have almost the same problem. I'm running roscore on the Raspberry Pi:

  • On WSL I can subscribe to topics that are published on the Pi
  • On the Pi I cannot subscribe to topics that are published on WSL.
  • On WSL I cannot subscribe to topics published on WSL

Basically, things published on WSL do not go anywhere.

ROS_MASTER_URI set to Pi ROS_IP set to WSL IP address on WSL, and set to Pi IP address on Pi

I suppose it has something to do with WSL IP addressing.

Asked by Morris on 2020-12-15 23:51:42 UTC

Could you please do a roswtf form on both ends? I solved this before but can't remember how. I was about to say it looks like WSL can't ping Pi, but you are able to echo. One thing is, I would unset ROS_HOSTNAME if you are using ROS_IP. You can also just use IP addresses for ROS_HOSTNAME

Asked by OzzieTheHead on 2021-04-30 10:58:18 UTC

I came through this problem too. I now use another Pi as ros master for the other Pi,and it works,I saw in somewhere that it may because the WSL have another ip different from the ip of windows.

Asked by zuo_from_china on 2021-05-07 04:43:43 UTC

WSL should have another IP. The problem is that your packets can find their way to the remote machine but WSL2 is not forwarding the ports (by default, at least), which means if you are trying to communicate with windows-ip:11311, that won't go to WSL. And, if you set ROS_MASTER_URI as WSL-IP:11311 then the remote pc is not aware of a route between itself and WSL, so it can't talk to the WSL.

Asked by OzzieTheHead on 2021-08-06 10:48:11 UTC

Answers