ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

connection between ros2_foxy node on Ubuntu (wsl) and python script on Win10

asked 2021-02-18 09:48:44 -0600

twomag gravatar image

updated 2021-02-19 06:27:03 -0600

I have the ros2_foxy set-up on Ubuntu 20.04 LTS via wsl. I created talker and listener as per tutorial: https://index.ros.org/doc/ros2/Tutori... and they work perfectly. I can easily see sent and received messages.

Now, I need my already created (as per tutorial above) talker to send messages through some port that I could listen to, with the subscriber written in python, on Windows, without using ros. In other words, let say, my ros node on Ubuntu sends message "hello" and my running script on Windows receives it.

I would also like to do talker on Windows and listener on Ubuntu. The next step would be communicating between different machines through network, but I'd settle on one machine for now.

I've checked the ports on Ubuntu and these are additional ones that open after running talker and listener (I used sudo lsof -i -P -n):

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME

talker 882 root 8u IPv4 360947 0t0 UDP *:7400

talker 882 root 9u IPv4 360950 0t0 UDP *:7412

talker 882 root 11u IPv4 360956 0t0 UDP *:7413

talker 882 root 13u IPv4 360964 0t0 UDP *:42399

talker 882 root 14u IPv4 360965 0t0 UDP 127.0.0.1:44588

listener 893 root 8u IPv4 350949 0t0 UDP *:7400

listener 893 root 9u IPv4 350953 0t0 UDP *:7414

listener 893 root 11u IPv4 350962 0t0 UDP *:7415

listener 893 root 13u IPv4 350972 0t0 UDP *:36302

listener 893 root 14u IPv4 350973 0t0 UDP 1xx.0.0.1:3xxxx

I've check the open ports in command prompt on windows and none of above match any of the ports on windows. I used netstat -a -b command.

Is there any way to create maybe a socket on both systems that could communicate? Which port should I use and how to establish that on both ends? Would that be in the code or maybe some env var? Please bare in mind, I'm not not well acquainted with neither ros nor linux, so any more elaborate explanation of the problem would be much appreciated.

If anyone has done something similar in C++ that would be a big help, too. Thanks!

update: I found out some of the ports change randomly and these would be last 2 of each, listener and talker. Maybe there's a way to define, in ros, the port they would be using?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-02-22 12:27:38 -0600

scott.nortman@gmail.com gravatar image
edit flag offensive delete link more

Comments

Could I ask you to please not post link-only answers?

gvdhoorn gravatar image gvdhoorn  ( 2021-02-23 03:15:12 -0600 )edit

Thank you, that helped me to communicate between wsl and windows, so that's one down. I still need to know how to find a proper socket, port or whatever to communicate between my let's say server and a ros2 node.

twomag gravatar image twomag  ( 2021-02-23 05:34:12 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2021-02-18 09:48:44 -0600

Seen: 1,366 times

Last updated: Feb 22 '21