LXC Hosted on AWS - Cannot connect to ROS Master

asked 2015-01-06 11:57:21 -0500

aak2166 gravatar image

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.

edit retag flag offensive close merge delete

Comments

1

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.

William gravatar imageWilliam ( 2015-01-07 16:16:23 -0500 )edit

Thanks William.

I think the issue was the way I was trying to use netcat on the AWS instance. Running it as:

while true; do cat back | nc -l 25002 | nc 10.0.3.20 25002 > back; done;

Seems to persist the connection. I am only seeing hello world echo on the talker node, not the listener now.

aak2166 gravatar imageaak2166 ( 2015-01-07 16:54:04 -0500 )edit

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%20O...

William gravatar imageWilliam ( 2015-01-07 17:22:16 -0500 )edit