Full text
January, 2015 IRI-TR-15-1 Multi-master ROS systems Sergi Hernandez Juan Fernando Herrero Cotarelo
Abstract This technical report introduces the concepts, problems and a possible solution for ROS multimaster systems, that is, systems build from two or more ROS networks, each with its own roscore node. In general this environment would correspond to multi-robot systems, either mobile platforms or manipulators. The ROS framework already provides a solution for such systems, multimaster_fkie, which is presented and briefly described in this technical report, together with the network setup necessary to make it work properly. Two different configurations are discussed in this technical report, simple ROS networks with a single computer each, and more complex ROS networks with two or more computers each. In both cases, real examples are provided using robots available at IRI. Institut de Robòtica i Informàtica Industrial (IRI) Consejo Superior de Investigaciones Científicas (CSIC) Universitat Politècnica de Catalunya (UPC) Llorens i Artigas 4-6, 08028, Barcelona, Spain Tel (fax): +34 93 401 5750 (5751) http://www.iri.upc.edu Corresponding author: Sergi Hernandez Juan tel: +34 93 401 0857 [email protected] http://www.iri.upc.edu/staff/shernand Copyright IRI, 2015
Section 1 introduction 1 1 introduction Within the ROS framework, in general each robot has its own ROS network (either wired, wireless or a combination of both), where a single roscore manages all the communications between all the ROS nodes, either in a single computer or multiple computers in the same network (depending on the complexity and computational needs of the system). Figure 1: Sketch of a possible hardware setup of a simple ROS system. See Fig. 1 for a generic hardware setup for such configuration and Fig. 2 for a possible simple node configuration in such architecture. For details on how to setup such system, refer to [1]. Figure 2: Possible interconnection of several ROS nodes around a single roscore node. In brackets, the computer where each node is executed In Fig. 1 the wireless connectivity is achieved by means of wireless router, but it could also be achieved by using a desktop computer with a wireless interface card.
2 Multi-master ROS systems When multiple robots need to exchange information, there exist mainly two possible solutions, create a single large ROS network managed by a single roscore node, or create a mechanism to allow information to be exchanged between ROS sub-systems. This technical report focuses on the later, because the former can be easily implemented using common ROS tools. Figure 3: Sketch of a possible hardware setup of multiple ROS sub-systems communicating to each other. See Fig. 3 and Fig. 4 for a possible hardware and software configurations respectively for this kind of system. Note that in Fig. 3 the common network could be either wireless (for mobile platforms), wired (for static manipulators) or a combination of both. In Fig. 4, the solid red lines indicate communications between nodes in different ROS subsystems. Theses communications could be either topics, services or actions. Solid black lines indicate local communications. The ROS framework already provides a solution for multi-master systems called multimaster_fkie, which is presented in section 2. 2 multimaster_fkie Here, a brief description of the multimaster_fkie is presented. For a more detailed description of the features and operation of this node, please check the following web page [2]. This standard ROS package can be easily installed as a debian package for your ROS version, in this case, Indigo.
Section 2 multimaster_fkie 3 Figure 4: Possible interconnection of several ROS nodes in a set up with multiple ROS sub-systems, each with its own roscore node. sudo apt-get install ros-indigo-multimaster-fkie The multimaster_fkie consists mainly of two nodes: the master_discovery and the master_sync nodes. The main features of the master_discovery node are summarized next: •Periodically sends mulicast messages to the common network to make the other possible ROS masters aware of its presence, and also detect any other ROS masters available. •Checks the local roscore for changes in the local network, and notify all other ROS masters in the common network of this changes. The main features of the master_sync node are summarized next: •Uses the information provided for other master_discovery nodes to register remote topics and services to the local roscore. •The information provided by the remote master_discovery nodes is also used to update the information on topics and services. •It can be configured to select which hosts, topics and services to synchronize or ignore. By default all topics and services of all hosts are synchronized, so in order to reduce
4 Multi-master ROS systems the required bandwidth, it is a good practice to synchronize only the absolute minimum number of topics and services. The master_sync node only synchronizes remote topics or services to the local roscore. In order to do the opposite, the remote roscore must have its own master_sync node. The multimaster_fkie solution only supports topics and services, however actions are implicitly supported because they are build on top of 5topics. The parameter server of each roscore can not be accessed remotely. Similarly to what happens in a standard ROS system, once the topics, services and/or actions are registered on the remote ROS sub-systems, a point to point socket is created to directly connect two or more nodes, and the multi-master mechanism is not used until there is a change in the configuration (a new publisher/subscriber appears or an existing one disappears, etc.). This multi-master solution is currently supported both in ROS Hydro and ROS Indigo, but only under the catkin framework. The network configuration for single computer ROS networks is simpler compared to that of multiple computers systems, therefore it is presented first in section 3. Next, the additional configuration steps necessary to properly setup multiple computer ROS networks is presented in section 4. 3 Single computer ROS networks In this section, first the basic requirements for the network setup will be introduced in section 3.1, and next, a step by step procedure will be presented in section 3.2. Finally, in section 3.3 some basic testing of the multimaster_fkie framework is presented. For the sake of clarity, the system configuration shown in Fig. 5 will be used through out this section to exemplify some of the configuration steps. Figure 5: Simple network setup for the single computer ROS network case used in section 3 to exemplify the network configuration 3.1 Network configuration Since the multimaster_fkie does not support to remotely launch a ROS node on a different ROS network, it is not necessary to exchange public keys between the computer on the different ROS networks to allow password-less access to the different computers.
Section 3 Single computer ROS networks 5 However, if no DNS server is available on the network to provide a binding between the host names and their IP addresses, this binding must be done manually modifying the /etc/hosts file. This is needed to allow proper operation of the ROS framework. Each master_discovery node sends and receives information to and from other master_discovery nodes in the same common network using the multicast feature. Today, almost all network adapters support these feature, however, in Ubuntu systems, it is disabled by default. The multicast feature is very important in multi-master ROS systems based on multimaster_fkie, because if not enabled, although the initial setup and operation appear to be correct, after 10 minutes or so, all the inter-network connections will be closed. Besides enabling the multicast feature, it is also necessary to choose a multicast address group for all computers which will be used for any master_discovery node to notify changes to the others. By default the 226.0.0.0 address is used, but it can be changed using a parameter of the node. Once the local ROS nodes have the information of the remote nodes provided by the master_discovery and master_sync nodes, the network traffic intended for remote networks must be properly routed in order to allow the communication between nodes on different ROS networks. This can be easily achieved by adding static routes to the router, access point or computer used to manage the common network. However, in order to properly route the traffic to the desired destination, each computer must have their own and unique IP address. In a simple single computer case, this may be a problem, because all the local ROS networks will be operating on the localhost (127.0.0.1) address by default. The simplest solution in this case is to use the IP address of the common network assigned to each computer as their ROS_MASTER_URI variable. By doing so, no static routes need to be added because all computers share the same network interface, although they are using separate roscore nodes. When the local networks have several computers each, this solution is no longer valid. An alternate solution is presented later in section 4. 3.2 Step by step procedure In this section, a step by step procedure is presented which implements the configuration explained in section 3.1. Host name and IP address binding For each computer, modify the /etc/hosts file using your favorite text editor. Fig. 6 shows the contents of this file for the kobuki1computer computer in the example presented in Fig. 5. Figure 6: Contents of the /etc/hosts file for the kobuki2computer computer for the example presented in Fig. 5
6 Multi-master ROS systems In order to check the proper configuration of the network, before launching any ROS nodes, try to ping all other computers from any computer, using both the host name and the IP address. If all the pings return a reply, the network has been properly configured. Change the ROS_MASTER_URI variable For each computer, to temporarily change the contents of this variable and only in the current console, execute the following command, where hostname or IP address must be the IP address or host name of each computer. export ROS_MASTER_URI=http://<hostname or IP address>:11311 In the example presented in Fig. 5, the ROS_MASTER_URI variable in the kobuki1 ROS network should be set to either kobuki1computer or 192.168.1.229. To make this change permanent, edit the ~/.bashrc file with your favorite text editor and add the previous command at the end. Then close the terminal and open a new one, or apply the changes by executing the following command: source ~/.bashrc Enable multicast For all computers, first check if the multicast feature is enabled using the following command. cat /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts If this command returns 0, the multicast feature is enabled and you can go ahead to the next section. To temporary enable the multicast feature, execute the following command, however, when the computer restarts, this configuration will be lost. sudo sh -c "echo 0 >/proc/sys/net/ipv4/icmp_echo_ignore_broadcasts" To permanently enable the multicast feature, edit the /etc/sysctl.conf file and add the following line, or uncomment it, if it already exists, and change its default value. net.ipv4.icmp_echo_ignore_broadcasts=0 In order for the changes to take effect, execute the following command: sudo service procps restart To check which multicast groups are already defined in a computer, execute the following command.
Section 3 Single computer ROS networks 7 netstat -g This command will report all the IP addresses enabled for multicast for each of the network interfaces available, both for IPv4 and IPv6. The standard IP address for multicast is 224.0.0.1, that should appear on the list provided by the last command, and it is the one we will use. At this point, to check whether the multicast feature is working or not, execute the following command, at any computer. ping 224.0.0.1 If everything is configured properly, you should get a reply from each computer in the common network at each iteration. 3.3 Testing Once the network has been configured, it is time to launch the multimaster_fkie nodes and take a first look at how it works. First of all, launch a local roscore at each computer. roscore Then, launch the master_discovery node at each computer, passing as an argument the mcast_group parameter to specify the multicast address to be used. rosrun master_discovery_fkie master_discovery _mcast_group:=224.0.0.1 This command will report some information on screen (see Fig. 7), but nothing else happens yet. It is important to note if the reported multicast address used is the one provided to ensure everything is set up properly. Figure 7: Information reported by the master_discovery node for the example system presented in Fig. 5, when it is launched Afterwards, launch the master_sync node at each computer. Without any additional parameter, all topics and services on all computers will be synchronized to all others.
14 REFERENCES Compared to previous versions of multi-master solutions in ROS, the one presented in this document presents several advantages: simplicity of use, since the user only have to select which information to share, and periodic updates, which keeps the local network synchronized with the global network information. References [1] IRI. Multiple machines. http://wiki.iri.upc.edu/index.php/Multiple_machines, july 2014. [2] Alexander Tiderko. multimaster_fkie. http://wiki.ros.org/multimaster_fkie, October 2014.
IRI reports This report is in the series of IRI technical reports. All IRI technical reports are available for download at the IRI website http://www.iri.upc.edu.