LXC Hosted on AWS - Cannot connect to ROS Master
Hi All,
New to ROS, and trying to get the ROS talker.py node on my laptop to speak to an LXC living on an AWS ec2 instance. I set up iptable rules on the ec2 instance to forward anything coming in on port 25002 to the same port on the lxc. However, I cannot get the talker node connected to the listener (which is run on the LXC).
As an experiment I set up a pipe, called back on the ec2 instance, and am having it pipe everything coming through on por 25002 to the same port on the lxc:
cat back | nc -l 25002 | nc 10.0.3.20 25003 > back
where 10.0.3.20 is the local IP of the lxc, and on that instance I run:
nc -l 25003
Netcat then echoes back to the terminal:
POST /RPC2 HTTP/1.1
Host: xx.xxx.xx.xxx:25002
Accept-Encoding: gzip
User-Agent: xmlrpclib.py/1.0.1 (by www.pythonware.com)
Content-Type: text/xml
Content-Length: 389
<?xml version='1.0'?>
<methodCall>
<methodName>registerPublisher</methodName>
<params>
<param>
<value><string>/talker_30504_1420566191918</string></value>
</param>
<param>
<value><string>/chatter</string></value>
</param>
<param>
<value><string>std_msgs/String</string></value>
</param>
<param>
<value><string>http://xxx-MacBookPro:41567/</string></value>
</param>
</params>
</methodCall>
However, if I try to run the launchfile with listener.py on port 52002 and switch up the above command to:
cat back | nc -l 25002 | nc 10.0.3.20 25002 > back
Then when I try to run talker I get
[ERROR] [WallTime: 1420565703.326813] Unable to immediately register with master node [http://xx.xxx.xx.xxx:25002]: master may not be running yet. Will keep trying.
While running roswtf on the listener side yields:
ERROR Could not contact the following nodes:
* /talker_30365_1420565451591
* /talker_30378_1420565461600
* /talker_30390_1420565508134
* /talker_30435_1420565680145
* /talker_30530_1420566770564
* /talker_30313_1420564757936
ERROR The following nodes should be connected but aren't:
* /talker_30365_1420565451591->/rosout (/rosout)
* /talker_30378_1420565461600->/rosout (/rosout)
I thought the talker should open a port back on the local machine on the same port? How can I go about allowing my local machine to accept connections back from the master? Thanks.
Asked by aak2166 on 2015-01-06 12:57:21 UTC
Comments
I'm not sure why you are not getting a connection back from the master, that should work AFAIK, but you'll need more than port 25002 (I'm assuming you set the ROS_MASTER_URL to use 25002) to get the talker and listener to communicate since they connect directly to each other over a different port.
Asked by William on 2015-01-07 17:16:23 UTC
Thanks William.
I think the issue was the way I was trying to use netcat on the AWS instance. Running it as:
Seems to persist the connection. I am only seeing hello world echo on the talker node, not the listener now.
Asked by aak2166 on 2015-01-07 17:54:04 UTC
That doesn't surprise me, the topics are directional, so if the listener (subscriber) cannot contact the talker (publisher) because it is behind a NAT or something, then no connection will be established. See: http://wiki.ros.org/ROS/Technical%20Overview#Establishing_a_topic_connection
Asked by William on 2015-01-07 18:22:16 UTC