How do subscriber - publisher communicate each other?
Hello folks,
I'm trying to connect a publisher node which is on Windows and a subscriber node on Ubuntu where a master node is on Raspbian; Windows PC(publisher) - Raspbian RaspberryPi(master) - Ubuntu PC(subscriber). (I just ported ros_comm and several core libraries to Visual Studio environment.)
The problem is, when I run a subscriber node on Windows PC and publisher node on Ubuntu PC, it worked. However, when the publisher-subscriber order is reversed (Windows PC has a publisher.. vice versa) it doesn't seem to work. The nodes are listed correctly through rostopic list command.
My question is, how the subscriber node and publisher node are connected in socket level? Does subscriber connect to publisher which is running as server? or both connect to each others?
Thanks a lot in advance. I've been helped so much from this gorgeous forum.
Antonio
----------------------Resolved---------------------------------------------------------------------------------------------------------------- For people who would encounter problems like this I leave this message.
I found that I set the ROS_HOSTNAME in Windows which was ip-formatted string(ex. 1.1.20.20). It was even wrong ip.
In ROS, host ip address is resolved in this order: ROS_HOSTNAME -> ROS_IP -> gethostname ...
So be aware using env variables. If you use multiple machines connected via ROS, you must set above variables correctly .
In addition to that, you should off the firewall! :)
Useful reference for understanding how connections are established: source code - ros_comm/ publication.cpp, subscription.cpp and related codes.
Below is technical overview doc in ROS wiki. This illustrates well how connections are made. http://wiki.ros.org/ROS/Technical%20O...