Ask Your Question

Problems with communication between multiple machines

asked 2017-03-03 05:25:44 -0600

wicked88 gravatar image

updated 2017-03-12 06:23:02 -0600

gvdhoorn gravatar image

So, i have this setup in my ros network:

My PC ( as a publisher of the topic /controlInfo
Robot's PC ( aka as the ROS Master
Raspberry Pi hardware module ( as subscriber of the topic /controlInfo

Pi is connected to Robot's PC through ethernet on the 172.17.x.x network. In both Pi and Robot's PC i can list all the nodes, see that /controlInfo is subscribed by and published by, and whenever i publish data, i can echo-it in Robot's PC (so, the data reaches the master), but i can't echo-it in Pi.

What's the problem here ? Since i can successfuly communicate between the Robot's PC and the Pi, i can list and everything seems to be correctly setup, why u no work ???

--- EDIT

I made a new test on the machines, as my PC is providing the WLAN for the robot's PC. So, my pc has now ip, Robot's PC and Raspberry remains the same. My PC communicates with Robot's PC through WLAN and the raspberry is connected to Robot's PC by ethernet. I made a call to rosnode info (node in raspberry) from the Robot's PC and everything is ok. I made the same command from my PC and, although i can get a lot of info (which stuff it subscribes/publishes) it gives me an error : (pi_hw node is inside raspberry pi, and Robot's PC is the ROS_MASTER, all ROS_IP's are correctly set).

Node [/pihw_node] 
* /rosout [rosgraph_msgs/Log]
* /hardwareInfo [minho_team_ros/hardwareInfo]

* /teleop [unknown type] 
* /controlInfo [unknown type]

* /requestIMULinTable 
* /requestOmniProps 
* /pihw_node/get_loggers
* /requestKick 
* /pihw_node/set_logger_level 
* /requestResetIMU

contacting node ... 
ERROR: Communication with node[] failed!

It seems i can fetch information about the node (because it may be stored somewhere in Robot's PC) but i cant communicate with Raspberry because my PC can't reach her. I can successfully communicate from my PC to Robot's PC and from Robot's PC to Raspberry.

--- EDIT

Network scheme. It seems My PC and Raspberry need to communicate directly in order for this to work, so i will probably need ip routing.

image description

WLAN : Robot's PC Ethernet :

PC          IP           ROS_MASTER_URI  ROS_IP       ROS_HOSTNAME
My PC  pedro K52Jc
Robot's PC  robot1
Rasp  rasphw1

I truly believe that the only problem here is that Rasp cannot reach directly My PC, so they dont communicate, and it is a normal thing (that they cant reach each other) but i thought ... (more)

edit retag flag offensive close merge delete


Please add the values of ROS_IP, ROS_HOSTNAME and ROS_MASTER_URI for all involved computers to your question description (edit it). Also please tell us whether you have a dedicated DNS server, a (consumer) rounter or are relying on something like Bonjour or a similar service.

gvdhoorn gravatar imagegvdhoorn ( 2017-03-03 05:42:17 -0600 )edit

Hi. The master in all of them is (Robot's PC). Im using a consumer router and im not using ROS_HOSTNAME. The weird thing is that the pi node subscribes the node in Robot's pc but doesnt receive the data. For this to happen usually the ROS_IP and master uri have to be set correctly

wicked88 gravatar imagewicked88 ( 2017-03-03 07:13:37 -0600 )edit

You haven't told us what the values are of ROS_IP on each of the hosts involved.

In most of these cases the involved hosts don't agree on the names that they have and / or report (ie: machine1 broadcasts machine1, but machine2 knows it under machine1.some.domain). Using ROS_IP avoids this.

gvdhoorn gravatar imagegvdhoorn ( 2017-03-03 07:40:48 -0600 )edit

Hi, in my pc ROS_IP is set to, in Pis is set to and in Robot's PC to (ethernet ip is Will check on that data on monday and get back gere

wicked88 gravatar imagewicked88 ( 2017-03-04 03:46:54 -0600 )edit

Pis is set to

Is that a typo? Should it read .10?

gvdhoorn gravatar imagegvdhoorn ( 2017-03-04 04:13:50 -0600 )edit

Yep, it is .10 sorry

wicked88 gravatar imagewicked88 ( 2017-03-04 10:44:24 -0600 )edit

@wicked88: the postimg link doesn't work. Could I also ask you to attach images to your question directly? I've given you enough karma to do so.

gvdhoorn gravatar imagegvdhoorn ( 2017-03-12 04:18:41 -0600 )edit

all ROS_IP's are correctly set

I appreciate your confidence (and I haven't seen your network diagram yet), but isn't this what we're trying to ascertain? :) "Assumptions are .." etc. Could you add a table with ROS_IP, ROS_HOSTNAME, ROS_MASTER_URI and IP and hostname of all involved hosts?

gvdhoorn gravatar imagegvdhoorn ( 2017-03-12 04:20:49 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2017-03-12 06:25:45 -0600

gvdhoorn gravatar image

updated 2017-03-12 06:33:08 -0600

I truly believe that the only problem here is that Rasp cannot reach directly My PC, so they dont communicate, and it is a normal thing (that they cant reach each other) [..]

Now that we can see your network diagram: yes, this is a routing problem. Your RPi and your PC are not on the same network, and without "robot's PC" routing between the two networks, they won't be able to communicate.

This is indeed "a normal thing".

but i thought the master acted as a "router"

No, it doesn't. The master is only really involved in discovery and setup of connections between nodes. Dataflows between nodes are direct, the master is not involved.

Edit: you could try adding static routes on both My PC and RPi telling them how to get to the and networks. Robot's PC would then function as the router.

edit flag offensive delete link more


See #q256435 for a similar question (almost a duplicate really).

gvdhoorn gravatar imagegvdhoorn ( 2017-03-12 06:27:04 -0600 )edit

@gvdhoorn i've read that before ! I will try some options to setup the routing process and hope for the best ! Do you have any experience in doing that ?

wicked88 gravatar imagewicked88 ( 2017-03-12 06:59:52 -0600 )edit

@gvdhoorn i managed to set up ip forwarding rules for my Robot's PC and i can successfully receive data from My PC in Raspberry ! link text. Although, i still can't receive data from the PI, (Pc dont ping Pi, but Pi pings PC).

wicked88 gravatar imagewicked88 ( 2017-03-12 07:38:45 -0600 )edit

Masquerading (NAT) is exactly what you don't want in this case. You need plain IP forwarding. See whether

sudo route add -net netmask gw

on RPi and

sudo route add -net netmask gw

on My PC works.

gvdhoorn gravatar imagegvdhoorn ( 2017-03-12 08:18:27 -0600 )edit

Make sure to undo what you did with iptables.

gvdhoorn gravatar imagegvdhoorn ( 2017-03-12 08:19:49 -0600 )edit

@gvdhoorn it can be somehow useful to have the NAT on the Robot's PC because it will allow me to SSH into the Raspberry to, perhaps, update its software with the online connection provided by the masquerade !

wicked88 gravatar imagewicked88 ( 2017-03-12 08:35:27 -0600 )edit

answered 2017-03-12 08:31:11 -0600

wicked88 gravatar image

@gvdhoorn i managed to do it. I kept those Ip tables commands i did and i just added to My PC :

sudo route add -net netmask gw

I'm grateful for your help, this case is closed !

[Summing up for future visitors of this question]

On ROS_MASTER PC, set IP forwarding between eth0 and wlan0, being wlan0 the output interface (like if we wanted to share internet over ethernet connected devices). This step is enough for Raspberry to reach any IP in the WLAN. On host PC (My PC in this case) just add a route to the Raspberry, having the Robot's PC as the gateway.

edit flag offensive delete link more


Clients (svc, subs) will most likely not be able to reach servers (svc, pubs) if they are on the 'wrong' side of the NAT with your setup (unless you have a bi-directional NAT, which is unusual).

gvdhoorn gravatar imagegvdhoorn ( 2017-03-12 08:48:49 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-03-03 05:25:44 -0600

Seen: 2,796 times

Last updated: Mar 12 '17