ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Setting ROS_MASTER_URI for three connected computers

asked 2020-04-14 12:21:02 -0500

extantsquash gravatar image

updated 2020-04-17 17:50:23 -0500

I am trying to connect three computers together, all three running ROS.

The main computer is connected to two Raspberry Pi's via ethernet. One is connected via the ethernet port on the master and the other is connected via an Ethernet to USB adapter. All three are assigned Static IPs. If I manually set the IPs for both Ethernet connections to 192.168.100.1, I am unable to ping both Raspberry PIs at the same time (research says that you cannot have two network interfaces on the same subnet as Ubuntu does not know which interface to use to contact a specific IP). The two Raspberry Pis have different IPs.

I have set the IPs as follows:

Master PCIe ethernet interface to 192.168.200.1

Master USB ethernet interface to 192.168.100.1

Master computer ROS_MASTER_URI=http://192.168.100.1:11311

Raspberry PI (lowerpi) to 192.168.200.2

lowerpi ROS_MASTER_URI=http://192.168.200.1:11311

Raspberry Pi (upperpi) to 192.168.100.2

upperpi ROS_MASTER_URI=http://192.168.100.1:11311

With this configuration, I am able to run nodes on the three machines and they can talk to each other. However, attempting to use roslaunch from the master fails. It successfully launches the nodes on the "upperpi" which has the same ROS_MASTER_URI as the master. The upperpi, while its ip points to the master pc, does not have the same exact ip set (100.1:11311 vs 200.1:11311).

... logging to /home/mcgreen/.ros/log/3e68f4a0-7db9-11ea-94db-1c697a0a83aa/roslaunch-mcgreen-NUC8i7BEH-14413.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://192.168.100.1:46639/
remote[upper_pi-0] starting roslaunch
remote[upper_pi-0]: creating ssh connection to upper_pi:22, user[upperpi]
launching remote roslaunch child with command: [env ROS_MASTER_URI=http://localhost:11311 ~/upper_ws/devel/remote_env_loader.sh roslaunch -c upper_pi-0 -u http://192.168.100.1:46639/ --run_id 3e68f4a0-7db9-11ea-94db-1c697a0a83aa]
remote[upper_pi-0]: ssh connection created
remote[lower_pi-1] starting roslaunch
remote[lower_pi-1]: creating ssh connection to lower_pi:22, user[lowerpi]
launching remote roslaunch child with command: [env ROS_MASTER_URI=http://localhost:11311 ~/lower_ws/devel/remote_env_loader.sh roslaunch -c lower_pi-1 -u http://192.168.100.1:46639/ --run_id 3e68f4a0-7db9-11ea-94db-1c697a0a83aa]
remote[lower_pi-1]: ssh connection created
remote[lower_pi-1]: Exception while registering with roslaunch parent [http://192.168.100.1:46639/]: Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/server.py", line 506, in _register_with_server
    code, msg, _ = server.register(name, self.uri)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1243, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.7/xmlrpclib.py", line 1283, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1311, in single_request
    self.send_content(h, request_body)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1459, in send_content
    connection ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2020-04-14 14:29:48 -0500

Procópio gravatar image

updated 2020-04-15 03:38:39 -0500

I am a bit confused here. Are you trying to run 3 separate roscores?

Although that is possible, I've always used a single roscore and the ROS_MASTER_URI should always point to the same IP address, which is the computer running the roscore.

EDIT:

  1. Ok, I think I understand now the that you are pointing the same roscore, through different interfaces, is this correct?

  2. I don't think it is possible to launch a node from a secondary device from your main computer. When you execute a roslaunch it will use the local nodes, it is just the communication that is done through the network.

  3. If you want to centralize the launch of nodes in other devices, all I can think about is creating a script that will SSH in the secondary devices and then execute the roslaunch from there.

edit flag offensive delete link more

Comments

I am trying to use roslaunch from the main computer to launch nodes on the other two that communicate with the master on the main computer

The issue I am having is with roslaunch specifically. The main computer is connected to one Raspberry PI via ethernet and the other via an ethernet to USB adapter. This means that the two PIs are connected to two different interfaces. On the main computer I have to assign it two static IPs, one for each interface (192.168.100.1 and 192.168.200.1). Thus, the master computer has two IPs but I can only set one ROS_MASTER_URI.

Pi with ip 192.168.100.2 has ROS_MASTER_URI=http://192.168.100.1:11311

Pi with ip 192.168.200.2 has ROS_MASTER_URI=http://1291.68.200.1:11311

Both URIs are pointing to the same computer, and this setup works when I ...(more)

extantsquash gravatar image extantsquash  ( 2020-04-14 15:02:06 -0500 )edit

In response to your edit:

  1. Yes that is correct

  2. It is possible to launch remote nodes via roslaunch using the "machine" tag. See here for details. I have made it work with one master and one remote successfully.

SOLUTION:

The solution I needed was not related to ROS, it was through Ubuntu. I created a bridge between the two interfaces (PCIe and USB Ethernet) which allows me to assign the same static IP to both interfaces and thus remotely launch successfully.

extantsquash gravatar image extantsquash  ( 2020-04-17 17:49:57 -0500 )edit

cool. maybe create a new answer to your own question, this could help others in the future. cheers

Procópio gravatar image Procópio  ( 2020-04-22 03:49:02 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2020-04-14 12:21:02 -0500

Seen: 264 times

Last updated: Apr 17 '20