0
$\begingroup$

Rosanswers logo

So, i have this setup in my ros network:

My PC (172.16.49.9) as a publisher of the topic /controlInfo
Robot's PC (172.16.49.1 aka 172.17.1.1) as the ROS Master
Raspberry Pi hardware module (172.17.1.10) 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 172.17.1.10 and published by 172.16.49.9, 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 172.16.49.254, 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] 
Publications:
* /rosout [rosgraph_msgs/Log]
* /hardwareInfo [minho_team_ros/hardwareInfo]
   
Subscriptions: 
* /teleop [unknown type] 
* /controlInfo [unknown type]
    
Services: 
* /requestIMULinTable 
* /requestOmniProps 
* /pihw_node/get_loggers
* /requestKick 
* /pihw_node/set_logger_level 
* /requestResetIMU

contacting node http://172.17.1.10:33608/ ... 
ERROR: Communication with node[http://172.17.1.10:33608/] 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 : 172.16.49.0/24 Robot's PC Ethernet : 172.17.0.0/16

PC          IP           ROS_MASTER_URI  ROS_IP       ROS_HOSTNAME
My PC       172.16.49.9  172.16.49.1     172.16.49.9  pedro K52Jc
Robot's PC  172.16.49.1  172.16.49.1     172.16.49.1  robot1
Rasp        172.17.1.10  172.16.49.1     172.17.1.10  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 the master acted as a "router".


Originally posted by wicked88 on ROS Answers with karma: 83 on 2017-03-03

Post score: 3


Original comments

Comment by gvdhoorn on 2017-03-03:
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.

Comment by wicked88 on 2017-03-03:
Hi. The master in all of them is http://172.16.49.1 (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

Comment by gvdhoorn on 2017-03-03:
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.

Comment by wicked88 on 2017-03-04:
Hi, in my pc ROS_IP is set to 172.16.49.9, in Pis is set to 172.17.1.0 and in Robot's PC to 172.16.49.1 (ethernet ip is 172.17.1.1). Will check on that data on monday and get back gere

Comment by gvdhoorn on 2017-03-04:\

Pis is set to 172.17.1.0

Is that a typo? Should it read .10?

Comment by wicked88 on 2017-03-04:
Yep, it is .10 sorry

Comment by gvdhoorn on 2017-03-12:
@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.

Comment by gvdhoorn on 2017-03-12:\

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?

Comment by gvdhoorn on 2017-03-12:
Also: @bidaian is correct: bi-directional network comms must work properly or otherwise you'll run into this kind of problems. If you have NAT somewhere, things get complicated (node can reach master, but nodes on both sides of NAT won't be able to communicate properly.

Comment by wicked88 on 2017-03-12:
@gvdhoorn finally got enough Karma to post the damn picture. @bidaian yep, i can't, but i thought the ros master would handle the package routing for me. How can i do this in linux ? i know that ip routing will do the trick, but i'm a first timer in ip routing tables :D

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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 172.16.49.0 and 172.17.1.0 networks. Robot's PC would then function as the router.


Originally posted by gvdhoorn with karma: 86574 on 2017-03-12

This answer was ACCEPTED on the original site

Post score: 4


Original comments

Comment by gvdhoorn on 2017-03-12:
See #q256435 for a similar question (almost a duplicate really).

Comment by wicked88 on 2017-03-12:
@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 ?

Comment by wicked88 on 2017-03-12:
@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).

Comment by gvdhoorn on 2017-03-12:
Masquerading (NAT) is exactly what you don't want in this case. You need plain IP forwarding. See whether

sudo route add -net 172.16.49.0 netmask 255.255.255.0 gw 172.17.1.1

on RPi and

sudo route add -net 172.17.1.0 netmask 255.255.0.0 gw 172.16.49.1

on My PC works.

Comment by gvdhoorn on 2017-03-12:
Make sure to undo what you did with iptables.

Comment by wicked88 on 2017-03-12:
@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 !

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.