Skip to content

Multi Master Communication

jmessias edited this page Jun 29, 2015 · 1 revision

Multiple instances of SA Managers and associated Repositories, running on different ROS Masters as in the conditions of Figure 1, can automatically discover each other in a local network, and synchronize the shared contents of each Repository, as well as the existing Readers and Writers to the various Shared Slots. This is only possible if the following conditions are met:

  • There must be multicast routing in the local network. Communication will be attempted over the ‘226.0.0.0’ multicast group;
  • The third-party ‘multimaster_fkie’ package must be installed and present in the ROS_PACKAGE_PATH;
  • sam_node must be run in multi-master mode;
  • (optional) a list of hostnames that are allowed to synchronize can be provided. Instructions for each of these steps follow.

Checking multicast connectivity

One option (among many) to check your multicast connectivity is to use the iperf tool: Install the tool by running:

sudo apt-get install iperf

On one computer (a server) run:

iperf -s -u -B 226.0.0.0 -i 1

On another computer (a client) run:

iperf -c 226.0.0.0 -u -T 32 -t 3 -i 1

If there is basic multicast routing between both machines, you should see a set of packets flowing through on either side.

Installing multimaster_fkie

SAM is not affiliated with multimaster_fkie nor does it conceptually depend on one particular multimaster communication handler. However, the multimaster_fkie package is compatible with SAM out-of-the-box as it provides all functionality required by SAM. This package is hosted in the ROS Wiki at: http://wiki.ros.org/multimaster_fkie

Please check the instructions therein to install the package.

Running the sam_node in multimaster mode

There are two ROS launch options to run sam_node in multimaster mode:

roslaunch monarch_situational_awareness sam.launch multimaster:=1

roslaunch monarch_situational_awareness sam_multimaster.launch

(Optional) Specifying the hostnames of the ROS Masters to synchronize

In multimaster mode, by default, all SA instances that are running in the same multicast group will synchronize with each other. Optionally, it is also possible to run SAM with a static list of hosts that are allowed to sychronize. This is useful mainly for testing purposes when independent “cliques” of network nodes wish to run independent groups of instances of SAM.

Open the file monarch_situational_awareness/config/agent_names.yaml. The file should look like the following:

agent_names: ["mpc01","mbot01l","mbot02l","mbot03l","mbot04l"]

Each of the elements in this list is one of the hostnames that will be searched for in the network. Edit the list to contain the hostnames of the machines running the SA instances that you wish to synchronize with (evidently, this should be done in each machine, and the same file should be provided to all of them). Then, you should add the ‘static_hosts:=1’ argument when launching sam_multimaster, i.e. roslaunch monarch_situational_awareness sam_multimaster.launch static_hosts:=1

Make sure that the hostname of each machine running each SA instance is included in the ‘agent_names’ list. This means that, for testing purposes or while not working with the actual robots, you may want to include the hostname of your personal machines. Also, be careful not to include the hostnames of the machines that you don’t want to synchronize with. Not only can that cause unexpected confusion (to the user) by unknowingly synchronizing different Masters, but it will also increase the network load even if the other Masters are not active (since there will be an active search for those machines).