Connect two networks with one roscore
I have two computers on the robot which are directly connected via ethernet. Let's call them "R1" and "R2". The roscore is running on R1, some of the nodes are on R1, some are on R2. Connection between the two is fine (ROS_MASTER_URI on R2 is set to http://192.168.1.9:11311 ).
R1 is also connected to a wireless network. On this wireless network there is a third computer "PC".
Now I want to run rviz on PC to monitor what is going on on the robot. For this I set ROS_MASTER_URI=http://172.168.1.100:11311
on PC. After this I can see all topics via rostopic list
but when I call rostopic echo /topic
, I only get messages on topics that are published from R1, not from those published on R2. Accordingly rviz only shows data from R1.
I assume that the problem is, that the connections PC <-> R1 and R1 <-> R2 are in different networks and that I would have to somehow forward messages between the networks. What is the best/easiest way to achieve this?