WSL ROS master cannot subscribe client topics

asked 2019-03-14 12:11:07 -0500

tburger gravatar image

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

  • Name:DESKTOP
  • Ubuntu 18.04.1
  • ROS melodic 1.14.3
  • Wifi0 IP 10.0.0.2

Raspberry Pi 3b+

  • Name: piRobot
  • Raspbian Stretch
  • ROS kinetic
  • Wlan0 10.0.0.1

Config WSL in bashrc: "export ROS_MASTER_URI=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 ROS_MASTER_URI=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!

edit retag flag offensive close merge delete

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.

starnovice gravatar image starnovice  ( 2019-08-06 10:48:00 -0500 )edit

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!

tburger gravatar image tburger  ( 2019-08-07 05:22:45 -0500 )edit

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.

starnovice gravatar image starnovice  ( 2019-08-07 15:54:28 -0500 )edit

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.

Morris gravatar image Morris  ( 2020-12-15 22:51:42 -0500 )edit

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

OzzieTheHead gravatar image OzzieTheHead  ( 2021-04-30 10:58:18 -0500 )edit

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.

zuo_from_china gravatar image zuo_from_china  ( 2021-05-07 04:43:43 -0500 )edit

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.

OzzieTheHead gravatar image OzzieTheHead  ( 2021-08-06 10:48:11 -0500 )edit