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/Tutorials/Writing-A-Simple-Py-Publisher-And-Subscriber/#pypubsub
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?
↧
Trending Articles
More Pages to Explore .....