You are on page 1of 13

Research Article

International Journal of Advanced


Robotic Systems
May-June 2017: 1–13
Establishing remote networks for ROS ª The Author(s) 2017
DOI: 10.1177/1729881417703355
applications via Port Forwarding: journals.sagepub.com/home/arx

A detailed tutorial

Sami Salama Hussen Hajjaj and Khairul Saleh Mohamed Sahari

Abstract
In a Robot Operating System (ROS) application, robot software is often distributed across multiple networked
components, forming the ROS network, where every component acts as server and/or a client, and publishing and/
or receiving robot data simultaneously. For indoor robots, a local ROS network, through a Wi-Fi hotspot, is
sufficient. But for outdoor robots, a remote ROS network is needed to connect the ROS application to the cloud.
Although a number of cloud-based solutions support this, implementing them is challenging, as they need to be
configured to facilitate ROS’s unique, multidirectional, and simultaneous flow of robot data. This article presents
Port Forwarding as an alternative approach, which offers a private, secured, and a direct ROS-to-ROS, eliminating
the need for a dedicated middleware and its configuration and setup complexities. But Port Forwarding has its own
challenges; chiefly, the beforehand knowledge of Internet addresses of all networked components and the need to
update port forwarding settings when these addresses change, which they often do. This article addresses this issue
(and others) and presents a detailed procedure for setting Port Forwarding for ROS applications, highlighting
configuration, and troubleshooting steps. Also, the article compares between Port Forwarding and cloud-based
solutions, in terms of setup, performance, and others. Results show that robot performance under Port Forwarding
is on par with cloud-based solutions, but it required a fraction of setup time. The authors developed a set of shell
scripts that monitor the Internet addresses of all networked components and auto-update Port Forwarding settings
when they change, solving this issue. With this, Port Forwarding could be considered a viable option for ROS
system networks, on par with cloud-based solutions.

Keywords
Robot operating system (ROS), robot software, cloud robotics, port forwarding, agriculture robots

Date received: 28 September 2016; accepted: 14 February 2017

Topic: Robotics Software Design and Engineering (ROSENG)


Topic Editor: Anis Koubaa

Introduction
The Robot Operting System (ROS) is one of the fastest
growing platforms for robot software development,1,2 and Centre for Advanced Mechatronics and Robotics, College of Engineering,
one of its many features is software distribution. As often Universiti Tenaga Nasional Malaysia (UNITEN), Kajang, Selangor, Malaysia
in a ROS application, robot software is distributed over mul-
tiple networked components, forming the ROS network Corresponding author:
Sami Salama Hussen Hajjaj, Centre for Advanced Mechatronics and
shown in Figure 1. In this network, robot data are shared Robotics, College of Engineering, Universiti Tenaga Nasional Malaysia,
among all connected components, with every component 43000 Kajang, Selangor, Malaysia.
publishing and/or subscribing to this robot data, and ROS’s Email: ssalama@uniten.edu.my

Creative Commons CC BY: This article is distributed under the terms of the Creative Commons Attribution 4.0 License
(http://www.creativecommons.org/licenses/by/4.0/) which permits any use, reproduction and distribution of the work without
further permission provided the original work is attributed as specified on the SAGE and Open Access pages (https://us.sagepub.com/en-us/nam/
open-access-at-sage).
2 International Journal of Advanced Robotic Systems

Figure 2. Rosbridge and RobotWebTools in action.4


Figure 1. The ROS network. ROS: robot operating system.
Literature review
architecture manages the flow of data, ensuring proper robot ROS provides the needed tools to link its applications to the
operations. cloud, such as the rosbridge package, which allows non-
For indoor robots, a local ROS network is sufficient, ROS clients, such as web applications, to publish and/or
where all components are networked via a local Wi-Fi subscribe any ROS topic, by transporting JSON formatted
router. For outdoor robots, however, the situation becomes messages over the Internet.4 Being language and platform
more challenging.3 This is where a remote ROS network is independent, any non-ROS client, from any platform that
needed, where components are networked remotely understands JSON, could interact with a ROS-based robot.
through the cloud. But due to standard Internet protocols This was demonstrated in the RobotWeb Hackathon in 2013,
(IPs), the remote ROS network, as shown in Figure 4 when researchers remotely teleoperated a ROS-enabled
below, would not work without further setup. One approach robot, despite being hundreds of miles away (Figure 2).4
is to create a bridge, or a middle point in the cloud, where But as the figure shows, rosbridge is just a small compo-
robot data are hosted and is accessible to all connected nent of the software developed to make this happen. After
components, allowing them to indirectly interact with each all, rosbridge only links ROS and non-ROS clients, but these
other. A number of cloud-based solutions facilitate this, non-ROS clients still need to be developed. They need to
such as webservers, android, and a number of cloud- perform ROS operations (e.g. robot operations, sensor man-
robotics platforms, such as RoboEarth.4–9 agement, visualization, etc.) in a non-ROS environment. In
However, utilizing these solutions for ROS applications the example above, the web application interacting with
is challenging; by default, webservers host data and publish ROS, which utilizes the ROS.js library, the implementation
it only when requested by clients, such as web applications of ROS in JavaScript, is still needed to be written by the
or android Apps. But in a ROS network, every component developers. Furthermore, the teleop example shown above is
acts as client and/or a server, publishing and/or receiving a very simple ROS application that requires very few mes-
robot data. Therefore, cloud-based webservers need to be sage types to be transmitted, such as Geometry_msgs/Twist,
configured to act as simultaneous clients and/or servers to which defines robot speed. Therefore, the ROS.js code
facilitate the multidirectional and simultaneous flow of needed to achieve this is relatively simple. But in a typical
robot data needed in a ROS network.10,11 Other factors ROS application, there are tens to hundreds of message types
need to be managed as well to ensure proper robot opera- being transmitted simultaneously in all directions, describing
tions, such as security, privacy, concurrency, and time various aspects of robot operations, such as robot speed,
delays. location, sensor data, odometry, and so on, and each of these
This article presents an alternative solution, portfor- message types must be transmitted individually or their
warding (PF), which offers a secure, private, and a direct meanings would be lost. In other words, each of these mes-
ROS-to-ROS remote connection, without the need for a sage types requires its own bridge to be remotely trans-
middle ware, eliminating the need to configure a third party mitted, see Figure 5, which only adds to the complexity.
technology for ROS. Furthermore, PF is also scalable, as it Another cloud-based solution is android, by linking
allows application updates without further setup, some- ROS-enabled robots to android and Google’s cloud ser-
thing cloud-based solutions cannot achieve, as will be vices. This is achieved using rosjava and android_core
shown below. However, PF has its own challenges and packages, which provide the implementation of ROS in
limitations. Java and android, respectively. Together, they allow devel-
This article begins by reviewing cloud-based solutions, opers create android Apps that can interact with ROS-
highlighting pros and cons. Then, the article presents a enabled robots.5,6,12,13 However, the challenges in using
detailed procedure for implementing PF for ROS, high- android are similar to those of rosbridge, rosjava, and
lighting configuration, and troubleshooting steps. Finally, android_core, which only provide the building blocks to
the article compares between the two solutions, in terms of develop ROS-android apps, but developers still need to
setup, performance, and challenges of each method. develop them. They need to write the rosjava code to
Hajjaj and Sahari 3

Figure 4. The remote ROS network. ROS: robot operating


Figure 3. Components of RoboEarth.7
system.
facilitate the multidirectional and simultaneous flow of
robot data of the ROS network for every ROS message in router acts as a gatekeeper that blocks any incoming remote
the robot application. This requires extensive knowledge of requests from accessing local components. This is a secu-
advanced concepts of android App development, such as rity protocol designed to protect the local components from
background process and concurrency. Furthermore, Cþþ remote attacks or unwanted intrusion. Because of this, the
(language of ROS) and Java are fundamentally different in robot and laptop in Figure 4 can only recognize the routers
software architecture, so developers need to manage these of each other but not each other. So, if the laptop attempts
differences when linking ROS to android. to contact the robot, it would not be able to do so, because
Researchers recognized these challenges and introduced the robot’s router blocks that connection and vice versa. In
a number of cloud-robotics platforms to streamline the cloud-based solutions, this problem was solved by creating
process of linking ROS applications to the cloud. These a middle point in the cloud, such as webserver, where the
include RoboEarth, RobotWebTools, and others.7–9 In fact, robot and computer would share and indirectly interact
Figure 2 shows the architecture of RobotWebTools, while with each other. But as discussed above, this extensive
Figure 3 shows the components of RoboEarth. websever setup is required to facilitate ROS’s multidirec-
However, these platforms have limits. The best way to tional and simultaneous flow of robot data.
describe these limits is by an analogy; consider rosbridge PF offers an alternative solution, by allowing incoming
and cloud-robotics platforms as manual and automatic remote requests to be forwarded from the routers to the
transmission in car; and the automatic transmission pro- local components, which allows remote access.14 So in the
vides a bit of convenience, but the driver still needs to drive above example, the robot and laptop would be able to
the car. The same thing applies in cloud-robotics platforms; recognize each other directly, without a middle point or
while they do provide the scaffolding that links between the a third party solution, establishing the remote ROS net-
various technologies discussed above, developers still need work.15 Today, PF is used for pin-point remote access of
to learn how to use these tools and then develop the neces- game servers, to bypass proxies, to create secure and pri-
sary applications that use these tools. For example, the vate networks, to remotely access Intranet and other pri-
RoboEarth platform is built of several components such vate networks remotely, and to remote access hardware
as Rapyuta, KnowRob, WIRE, and so on. So, when using devices such as home computers and surveillance
this platform, one must learn each of these individual com- cameras.
ponents as well as their base technologies, which happen to Another great advantage of PF over cloud-based solu-
be rosbridge, webservers, database design, web application, tions is shown in Figure 5. As discussed above, due to the
and so on. Also, these platforms can never fully predict the need of a middle point, or bridge, every message type in the
individual needs of every robot application (e.g. message ROS application requires its own bridge when transmitted
type to be transmitted, etc.), and so developers could end up through the cloud. In PF, this is not necessary.
coding and setting many of these components after all. PF does not require a bridge or a middle point, instead it
Finally, utilizing these open source platforms brings con- creates direct ROS-to-ROS channel as if the connection
cerns over data security and privacy, as robot data would be was local, alibi with time delay. This allows any and all
exposed to anyone with access, which could be undesirable message types of the ROS application to be transferred.
for proprietary and private applications. Also, future application updates or modifications would not
require any further setup.
For example, if a new sensor was added to the robot in
Port Forwarding for ROS applications Figure 4 was modified, then the cloud-based solution would
As discussed above, the remote ROS network would not need to be reconfigured to accommodate the new bridges
work without further setup. That is because each modem/ needed to transmit the new sensor’s message types. But in
4 International Journal of Advanced Robotic Systems

Finally, ROS tutorials focus on local ROS net-


works.10,11 Although they provide useful information, they
do not provide actual guides for PF setup. This is perhaps
because it involves issues that are outside the scope of
ROS, such as networking, modem setup, and so on. In more
than one ROS training material, PF is mentioned but then
left for the reader implement.17 However, these tutorials
provide great connectivity tests, which are a set of tests
developers can perform to test whether the ROS network
is configured properly, and these were incorporated into
this work.
Figure 5. Cloud solutions versus port forwarding.
Methodology
PF, once the initial setup is done, then any new updates or
modifications are supported without further configuration. A successful ROS network, local or remote, that consists of
a group of components (robots, computers, mobile devices,
and others), must fulfil the following10,11 requirements:
Challenges to implementing PF
On the other hand, implementing PF comes with its own 1. There must be a complete, bidirectional connectiv-
challenges. First of all, implementing PF is a multilayered ity between all components, on all available ports.
process that involves settings from the Internet service pro- 2. Each component must advertise itself by name that
vider (ISP), modem/router configuration, Linux OS, and all other components can resolve.
ROS, and in that order. This makes troubleshooting difficult. 3. One of these components is declared the ROSmas-
In this work, a detailed procedure for configuration and ter of the network (usually the main robot).
troubleshooting of each step is presented with examples. 4. All ROS packages, distributed over this network,
Secondly, PF requires the beforehand knowledge of the must be configured to use this ROSmaster.
IP addresses of all networked components, and these set-
All the settings and configurations discussed in the sec-
tings need to be updated if the IP addresses change. Unfor-
tions below are designed to fulfil these requirements. The
tunately, most ISPs provide dynamically changing IP
following sections are divided into three parts; the expected
addresses, which require PF settings to be updated regu-
outcome, the configuration steps, and the verification steps.
larly. Doing so manually is cumbersome and error prone, so
The meaning of these parts should be self-explanatory. Also,
for this work, the authors developed a set of shell scripts
because each component is linked to the Internet through a
that automate this step and solve this problem. These
separate modem in a remote ROS network, the following
scripts and their inner workings are outlined in the
settings must be implemented on each modem, and its con-
“Discussion” section.
nected component. For example, in Figure 4, the laptop is
Thirdly, implementing PF for corporate connection
connected to the internet through modem2, therefore, the
(company or university) would require permission, and it
following settings must be performed on modem2 and the
could be limited to a specific location on campus. This was
laptop. Similarly, the settings below must also be performed
indeed the case for this work, permission was granted but
on modem1, the robot (through its netbook), and so on.
only for the laboratory of the author. However, and as
discussed in the beginning, the whole point of remote ROS
networks is implementing them for outdoor robots, where Step 1: ISP Settings
the grounded connections are hardly, if ever, used. In this
As discussed above, there are generally three types of ISP
work, multiple mobile broadband modems were used, sim-
connections, corporate, home, and telecom connections, and
ilar to those shown in Figure 4, whose settings are managed
so the settings for each connection type are discussed below.
by the ISP and not by IT department, and so no permissions
were required. In fact, modem/router configuration were
supported and guided by the ISP’s technical support teams. Expected outcomes
Fourthly, due to the mobile nature of outdoor robots, 1. Obtain confirmation from ISP that PF is enabled to
conventional virtual private networks (VPNs) could not your connection, on All ports.
be implemented. Because the network tunnel needed for 2. Obtain a public IP address for your modem that will
conventional VPNs would always be disturbed, mobile be used by others in the remote ROS network.
devices would roam in and out of the wireless coverage
area. The alternative solution is mobile VPNs, or mVPNs, By default, the router/modem is usually provided by the
but unfortunately, these are not offered by most ISPs as of same ISP, and so this and the following steps, ISP and
yet, not in (country of author) atleast.16 router/modem settings, are usually performed concurrently.
Hajjaj and Sahari 5

Nevertheless, there are important factors that the user must


understand before selecting a suitable telecom ISP for PF,
which is discussed below.

Configuration steps
The configuration steps discussed below vary for each type
of connection, specifically:

Corporate connection. The user must contact the IT depart-


ment, specifically the network administrator to obtain per-
mission to use PF on all ports. Once that is accepted, the IT Figure 6. Router/modem settings: port forwarding.
department would usually help configure it and assign the
modem a fixed IP address. PF is usually meant for a spe- or grounded), which also supports PF on all ports, with a
cific port, hence the name port forwarding. But since ROS fixed or changing public IP address.
requires all available ports be used, the term used here is
DMZ, which is basically PF to any available port. Also, Verification steps
corporate connection usually uses a local area network
In reality, and as discussed above, the first two steps (ISP
(LAN)-cabled connection, and the user would need a router
and modem/router settings) are usually performed concur-
to establish a wireless network for ROS component. There-
rently. As such, there is no verification at this point and the
fore, configuration of the router with PF (to all ports) could
actual testing begins after the router/modem has been con-
also be handled by the IT department as well.
figured, which is the next step.
Home connection. By default, there is no need for a permis-
sion for this type of connection, but it does not hurt to
contact the ISP, and confirming the PF is indeed enabled.
Step 2: Router/modem settings
Also, the public IP address is usually the IP address of As discussed before, the purpose of PF is to configure the
home router/modem. modem/router to forward remote requests to members of
the local network.
Telecom connection. Unlike corporate and home connec-
tions, telecom connection is the only true mobile connec-
tion, which is ideal for outdoor mobile robots. Corporate
Expected outcome
and home connections are useful for experimenting There is only one expected outcome here: obtaining an
indoors. Telecom ISPs either provide portable wireless “Open” status when checking for PF through any available
modems/routers or the user’s mobile phone can be used, and open port. Once the router/modem is configured, the
through the tethering and portable hot spot features. Either connection and PF are tested using online PF testing tools.
approach provides a portable wireless connection. As such, These are used to check the success or failure of the con-
the user must contact the ISP to enable PF, however, when figuration. For a modem/router provided by a telecom ISP
contacting a telecom ISP, one must remember the follow- without a fixed public IP address, this has to be verified a
ing pitfalls: multiple times through multiple IP address, as discussed
below.
1. It is possible that the general tech support are not
well trained on PF, so request to speak to the more
technically trained networking department, or
Configuration steps
arrange an appointment. Corporate connection. Usually, the network admin would
2. Not all the telecom ISPs support PF and some sup- perform this step concurrently with the first step (ISP set-
port it partially through specific types of portable ting). That is, the IT department of the corporation or Uni
modems and specific types networks. would usually enable PF and configure the modem/router.
3. The ISP may or may not provide a fixed public IP
address, in the event the IP address is not fixed, the Home and telecom connections. Using a browser, log into the
user must put that in mind when performing later router/modem’s homepage, navigate to firewall settings,
configurations steps.Another issue to consider is the and enable PF, DMZ, and other filtering features shown
coverage area offered by the ISP, connection speed in Figure 6.
(3G or 4G), cost of subscription, and similar factors. In order to forward remote requests from modem1 to the
robot, as shown in Figure 4, the modem is configured to
Once all that is done, the provider would supply the user forward these remote requests to the local IP address of the
with a device that supports a wireless connection (portable robot, which is the IP address value shown in Figure 6.
6 International Journal of Advanced Robotic Systems

This is very important, if the local IP address of the robot Table 1. PortChecker test results and their meanings.
changed for some reason, then the user must come back
Result Netcat server Indication
here and reconfigure the router. Alternatively, the local IP
address (in this case 10.10.10.1) can be permanently Open Up Port forwarding setup successful
reserved for the robot and so no reconfiguration is required. Closed Down Port not being used
Since all available ports are required by ROS, the range was Closed Up Port forwarding setup failed
set as shown in Figure 6. As it can be seen in the figure, this
router also support DMZ, which could be easier to setup,
otherwise the selected port would not be used. However, if
but not all ISPs provide a separate page for DMZ, if not,
the netcat server was indeed up, and the result is still
then the settings shown in Figure 6 would suffice. In the
Closed, this means PF setup and configuration has not been
event that the router/modem is not provided by the ISP,
done correctly. This could be due to three possible reasons.
then the router’s manufacturer’s support resources would
be consulted, such as the online resources for D-Link, Net-  Port is being used by another service on the network,
gear, or others manufacturer’s websites. try another port numb (higher than 1024).
 There could be firewalls and/or network limitations
by the ISP or network admin, return to step 1.
Verification steps  Modem/router PF configuration was not properly
An important point to remember here, ports must be performed, return to step 2.
allowed open and available by the ISP or network admin
Once the result is Open to all components of the remote
before attempting to configure the modem/router. There-
ROS network, as shown in Figure 4, then this step is com-
fore, this must be verified by the ISP before testing these
plete and you can proceed to step 3.
steps. To verify that PF and/or DMZ settings have been
correctly configured, follow these steps:

1. First, ensure your connection is working, open a Step 3: Linux OS settings


browser, and browse the internet. If OK, then
From this point onwards, all configuration steps are within
proceed.
the computer level (PC, laptop, netbook, etc.), therefore,
2. Select a port number between 1024 and 65000, let
from now on, the term component refers to the computer of
us call this value: portNumb.
the item being networked in the ROS network. For exam-
3. Start a netcat chat session on the selected port.
ple, referring to Figure 1, this could be the Desktop of the
4. In Linux, run: nc -l portNumb.
observer, the laptop of the operator, the netbook onboard of
5. For example, if you chose portNumb ¼ 12345, the
robot1, and so on. Also, this article assumes that Linux is
command would be: nc -l 12345.
the operating system of all of these components. However,
6. This will start a netcat server at the portNumb you
the settings discussed below are generic and so they can be
selected (you can try netcat if nc does not work).
applied in any other ROS-supported operating systems.
7. Open a new browser window, search for any
PortChecker website, and then go to it.
8. In the website, you will see your modem’s public Expected outcome
IP address, and a space to enter the number of the At the end of this step, network components are expected
port you wish to check, enter the number, and hit to:
OK or Go.
9. If the status of the port is Open, then this step is 1. Ping each other, using network names.
successful, and you can proceed to step 3. 2. Secure SHell (SSH) to each other, using network
10. Repeat the test with different portNumbs to con- names.
firm that your PF works on any port. 3. Netcat chat with each other, using network names,
initiated from either side, and on any port.
This test puts the component being configured (robot,
computer, etc.) in a situation that mimics the remote ROS These three tests check for important features used by
network (Figure 4). The netcat command mimics the ROS- ROS. Recalling that in a ROS network, components must
master service, while the PortChecker website mimics the recognize each other and exchange data in order to facil-
signal received remotely from other components. The ideal itate the performance of the robot. These steps verify that.
result expected here is Open, which indicates that every- In the last test, it is important that the netcat chat session
thing is set properly. In the event, the result is Closed, and should be successful when initiated from either side. That is
there are two possibilities, as shown in Table 1. because in a ROS network, every component is expected to
As shown in the table, the user must ensure that the initiate an exchange of data and act like a publisher and/or
netcat server is up (command has been typed in a terminal), subscriber.
Hajjaj and Sahari 7

Figure 7. Local hosts configuration—in the laptop.

Figure 8. Local hosts configuration—in the robot.

Configuration steps
Figure 9. A complete hosts file configuration.
For each component of the remote ROS network (Figure 4),
do the following:
public IP addresses are being used, which is only true for a
1. Take note of the local and public IP address of the remote ROS network. If a user decides to switch to a local
component. network, where only local IP addresses are used, these
2. For example, the laptop in Figure 4 has a local IP definitions can no longer be used and other definitions need
add ¼ 10.10.10.1 and a public add IP ¼ to be defined.
113.32.43.6. Furthermore, the component (robot or laptop) could be
3. Access the file that defines local hosts in your OS. used in different networks in different times, changing from
4. In Linux, run: sudo gedit /etc/hosts. a corporate network to a remote network to a local-telecom
5. Edit that file as shown in Figure 7 below. network (robot and laptop using the same portable telecom
6. Ensure that you key-in the correct IP addresses. modem/router). In every one of these networks, the IP
7. Take note of the discussion below. addresses would change.
8. Save, close, and restart. Therefore, it would be useful to create a hosts definition
9. Repeat this step for each component. file that caters for all these changes, one example of such
file is shown in Figure 9.
The hosts file is a Linux environment file that registers As it can be seen in the figure, there are several sets of
names and IP addresses of each component. As shown in hosts configurations that can be applied, depending on the
Figure 7, the laptop is defined as sami and the robot is defined type of network currently used. There are two local net-
as turtlebot, where these names are completely arbitrary. works (office and portable) and a remote network. The
The hosts definitions must be created for each component local network use local IP address, while the remote net-
and from its point of view. Figure 7 shows the definitions work uses public IP addresses. Finally, this file is from the
from the laptop’s point of view, where it is defined by its local laptop’s point of view, and so a similar file should be cre-
IP address, and robot is defined by its public IP address. From ated for the robot’s point of view.
the robot’s point of view, as shown in Figure 8, the situation is
reversed. The robot is now defined by its local IP address Dynamically changing IP address. As discussed above, ISPs
and the laptop is now defined by its public IP address. may not allocate you a fixed public IP address. If so, you
Also, notice how the names sami and turtlebot are the will need to update the hosts file every time you restart the
same in both hosts definitions file. This is actually a con- portable modem, this could be cumbersome and error-
venience, and it is indeed recommended to be the same. prone. The solution is to automate this step using a combi-
Because technically these components could be assigned nation of shell scripts and a cloud storage facility, such as
different names in different hosts files, but that would make Dropbox. Through this setup, the robot’s netbook can
networking far more complicated. Apart from this, there enquire about its current public IP address, informs the
are several pitfalls and challenges that could arise here, laptop (through Dropbox), allowing the laptop to update
which are discussed below: its hosts file. The scripts used for this project, developed
by the author, can be found on this repository.18 In the
gedit might not work. The command sudo gedit/etc/hosts discussion section below, these scripts and their inner
may not work in some Linux distributions; due to some workings are further discussed.
Linux-related issues, you can either use others editor or
add more permissions.
Verification steps
Changing networks. Hosts definitions are valid for the net- There are three tests to be conducted here: the ping test,
work they are part of. As can be seen in Figures 7 and 8, the SSH test, and the netcat chat test. All the three are
8 International Journal of Advanced Robotic Systems

Figure 10. A successful ping test, through the remote network.

Figure 12. A successful netcat test, through remote network.

The netcat chat test

Figure 11. A successful SSH test, through the remote network. 1. In the laptop, open two terminal windows.
2. In one window, SSH to the robot Now you have two
terminal windows open, one for the robot and one
conducted through the remote network. Note that the for laptop, as shown in Figure 12.
names and IP addresses used in the test below are based 3. In the laptop’s window, run: nc -l portNumb.
on the settings saved in the hosts files in the laptop and 4. In the robot’s window, run: nc sami portNumb.
the robot of the author, use the your own names and IP 5. If OK, then you created a chat session, type a away
address in your tests. The ping test is as follows: in either window, you should see it on the other
side.
1. In the laptop’s terminal, run: ping turtlebot. 6. If successful, then repeat step 3 from the
2. If you used a different name for the robot, use it. robot’s window and step 4 from the laptop’s
3. If successful, run the same test from the other side. window.
4. If successful, then you can proceed to the SSH test. 7. If both sides are successful, then step 3 is complete,
and you can proceed to the final step (step 4).
Figure 10 shows an example of a successful outcome,
where the laptop was able to ping the robot through the Once again, portNumb is the port number you chose,
remote network using only the host name. As it can be seen which could be any available port above 1024. Figure 12
from the figure, the public IP addresses are in effect (par- shows an example of a successful outcome. In the figure,
tially hidden). we can see a chat session established in the robot’s side.
The chat session was successfully established from the lap-
The SSH test top’s side as well.
It is important to understand that step 6 of the test is
very important. One must ensure that the chat server
1. SSH from the laptop to the robot using a command
can be established on both sides, because that repre-
similar to the one shown in Figure 11.
sents the ability of each component to act as a server
2. If successful, run the same test from the other side.
and a client, which is a fundamental requirement for
3. If successful, then you can proceed to the netcat test.
ROS components.
It is possible that the SSH test could fail due to reasons
related to SSH itself and not anything discussed so far.
Issues are such as public key, username authentication,
Step 4: ROS settings
installation issues of SSH, SSH being down (switched off), This is the final step in the configuration and so the reader
and other related factors. Therefore, run the SSH test on a is advised to ensure all previous steps are completed suc-
local network first. This would require you to reconnect cessfully before attempting this step. The objective of this
robot and laptop through a single modem and update the final step is to register all components of the remote ROS
hosts definitions to reflect this change. Then attempt to SSH network with the ROSmaster and insure that all compo-
between robot and laptop, and then deal with SSH-related nents are able to publish and subscribe to each other. A
issues, and once resolved, then you can proceed to run this ROSmaster could be any component of the ROS network.
test on a remote network. Figure 11 shows an example of a For the network shown in Figure 4, the robot was selected
successful outcome, where the laptop was able to SSH the as the ROSmaster. Therefore, the expected outcomes
robot through the remote network using only the host name. would be as follows.
Hajjaj and Sahari 9

Expected outcomes network needs to be started and tested. There are three ROS
tests that can be used here:
1. The ROSmaster component is properly registered
for each member of the ROS network. 1. the minimal network test;
2. Every component is able to publish or subscribe to 2. the listener/talker test; and
other components in the remote ROS network. 3. the turtlebot interaction tests.
This can be achieved by appending the bash file, the shell These tests are designed to test specific ROS funtional-
environment file, and setting the value of ROS_Master_ ities, which are outlined and discussed below.
URI to equal the IP address of the ROSmaster, or
specifically:
The minimal network test
1. Switch on all the modems, and ensure connection is
Configuration steps ON.
1. In the ROSmaster component, add the following: 2. Update the hosts and the bash files to reflect the
export ROS_MASTER_URI¼Robot_loclIP: current public IP address of the robot.
11311 3. From the robot’s onboard computer, open a terminal
2. In other components, add the following: export window and run: roscore to start ROS.
ROS_MASTER_URI¼Robot_pubIP:11311 4. Alternatively, SSH into the robot’s onboard com-
3. Do not add definitions of ROS_IP or ROS_HOST- puter from another component, and start ROS.
NAME as described in ROS tutorials. 5. At this point, the remote ROS network is up.
6. From the laptop, run: rostopic list, you should see
Public versus local IP addresses. Once again, since the ROS- the list of ROS topics. The outcome of the com-
master (robot) refers to itself, we use the robot’s own local mand may take few seconds longer than usual.
IP address. If we attempt to use the public IP address here, 7. If you see a list of topics, then this test is successful,
roscore would throw an error and would not start. and you can proceed to the next test.
As for other components, such as the laptop, they will
refer to the robot using its public IP address. This is very The listener/talker test
similar to the hosts definitions created in step 3. 1. From the robot’s computer, start a talker, buy run-
ROS_IP and ROS_HOSTNAME. ROS networking tutor- ning this command: rosrun rospy_tutorials
ials10,11 recommend setting these values in order to solve talker.py.
networking issues. However, it was found by the author 2. From the laptop, start a listener, by running this
that doing so would cause ROS problems; some compo- command: rosrun rospy_tutorials listener.py.
nents would be able to publish only and not subscribe, or 3. If all is OK, the listener on the laptop should
vice versa; subscribe only and not publish. One must respond to the talker from the robot’s computer.
remember that these tutorials were written primarily for the 4. Again, this might longer than usual to happen.
local ROS network, where these settings would be fine. But 5. If successful, repeat this test from the other direc-
for the remote ROS network, these definitions would over- tion, a talker from the laptop and a listener from the
ride the hosts definitions created in step 3 (Linux settings) robot.
and so cause the ROS problems discussed above. 6. It does not matter who starts first, a talker or a
As such, for the remote ROS network, the authors rec- listener, and it should always work regardless.
ommend using the ROS_MASTER_URI only and set the 7. If successful, then this test is successful, and you
hosts as discussed in step 3. can proceed to the next step.

Changing IP address. If the robot’s public IP address is vari- The turtlebot interactions tests
able, then once again, the bash settings in each component If you have reached this point, then that remote ROS net-
must be updated every time the robot’s portable modem is work has been successfully configured. The final test is to
restarted. Once again, this step could be automated, as dis- implement it on an actual robot. The following test assumes
cussed in step 3, through the use of shell scripts and a cloud that the robot is a ROS-enabled robot, which means that it
storage facility such as Dropbox. In fact, the scripts developed has already been preinstalled with the required ROS
for this project,18 referenced above, automate this step as well. packages needed to interact with other ROS components.
For this article, Turtlebot2 is used. Also, the reader is
expected to be familiar with ROS, its concepts, and the
Verification steps terminologies used in this test. Before starting, ensure that
At this stage, all settings and configurations have been all the modems are switched on, that the network is up and
completed, and to verify the settings, the remote ROS running, and that you updated all hosts and bash files to
10 International Journal of Advanced Robotic Systems

reflect the current IP addresses of the robots. In case you


automated this step with dynamic direct domain system
(DNS), double check the values for good measure. Then,
if all is set, then you can begin the final test.

1. Using roslaunch files, bring up the robot


(minimum).
2. From the laptop, start a keyboard teleop session.
3. From the laptop, start an rviz visualization session.
4. In rviz, add a camera view to receive a live feed.
5. Change the image quality to be compressed, or
black and white, to reduce burden on the network.
6. When everything is open, proceed to teleoperate the
robot (publish) and receive live visual feed
(subscribe).
Figure 13. Setup of the ROS-android method.

If you are able to teleoperate the robot and receive live


images from it, then Congratulations! You have success-
fully configured your ROS remote network via PF.

Discussion
In this section, an outdoor ROS application is to be linked
to the cloud, using a number of cloud-based solutions and
PF, with the following settings:

 The robot is a mobile (wheeled) agriculture robot.


 It is set to operate in an open field, performing a set Figure 14. Man-hours needed to develop each method.
of pre-programmed autonomous agriculture tasks.

For an effective performance of this robot, a remote Table 2. Software needs for each method.
ROS network is developed, similar to the one shown in Method Software components
Figure 4, using the following technologies: rosbridge,
ROS-android, RoboEarth, and PF. rosbridge ROS, networking, JSON, ROS.js webservers,
web applications
ROS-android ROS, networking, Java, rosjava,android,
 Through this remote network, the robot sends real- android_core, Concurrency Android Studio,
time status and task updates to the operator. Google Cloud App development, Google
 Who would use this data to monitor, control, and Cloud
select the needed agriculture task for the robot to RoboEarth ROS, networking, rosbridge RoboEarth
perform. components: Rapyuta, KnowRob, WIRE,
C2TEAM, etc.
Data published by the robot are current robot speed, Port forwarding ROS, networking, shell-scripting
modem configuration, Dropbox
current location in the field (global positioning system
[GPS], fix), live feed (camera view of the robot), battery
and power status, task status, and task completion.
For example, Figure 13 shows the setup of the ROS- Setup complexity
android method, showing the rosjava publishers and sub- For this work, setup complexity is measured by the amount
scribers (developed by the authors) to publish robot data, of man-hours needed to learn, install, and develop the soft-
user commands, and establish connectivity, as required. ware needed for each method. This is shown in Figure 14
Other methods followed similar setup and patterns. and Table 2. The man-hours needed for ROS and network-
Then, these methods are compared in terms of setup com- ing were excluded because they are common to all.
plexity and effort required, robot performance (utilizing the As it can be seen, PF required the least amount of man-
remote network), and challenges facing implementation of hours to learn, install, and develop. This is understandable,
each method (and how to resolve it). The findings of this considering that it does not require any third party technol-
comparison are discussed below. ogy or platform. On the other hand, RoboEarth required the
Hajjaj and Sahari 11

Figure 15. Robot remote response time Figure 16. Agribot App and MapView.

most man-hours because developers need to learn all of its


components, as shown in Figure 3, which in turn require
learning all the basic concepts such as rosbridge, webs-
evers, web applications, database design, and so on.
Also, ROS-android also required extensive learning as it
involves learning of Java, and android app development,
along with its advanced concepts.

Robot performance
Effect of each method on robot performance can be mea-
sured in robot response time. If a method causes too much Figure 17. Auto-update PF settings.
delay, then it becomes impractical. Through ROS logging,
time of robot commands (when given by users) and time
of robot execution of these commands were recorded, and
by calculating the difference between them, robot
response time was found. Figure 15 shows robot response
times in each method, while performing a set of robot
operations.
As shown in the figure, robot performance is compara-
ble in all methods. So, regardless of the method used, the
robot performed autonomous tasks the fastest and sensor-
Figure 18. Auto-update PF settings, master-script.
related tasks, such as mapping and localization, the slowest,
since the robot needed to transmit sensor data to the home
computer, remotely, for processing.
Managing dynamically changing IP addresses
An unexpected challenge faced by the authors, when As discussed above, ISPs seldom provide users with fixed
developing cloud-based solutions, was the need to recreate IP addresses, instead they usually provide a range of IP
ROS’s visualization tools such as rviz but in non-ROS addresses, such as 173.17.XXX.XXX, where the XXX
environments. This meant more development effort was could range from 000 and 255. This is obviously a problem
needed to develop these visualization and monitoring tools for PF, as the settings outlined above would need to be
for android, RoboEarth, and web applications. updated every time the IP addresses change. The solution
In ROS-android, this was solved by utilizing android’s to this challenge is to auto-update PF settings through a
views such as ProgressBar, ImageView, MapView, and so combination of shell scripts, combined with a cloud-
on, as shown in Figure 16. These views allowed users to storage facility such as Google’s Dropbox. This is shown
view robot’s battery status, speed (currently not moving), in Figures 17 to 19.
GPS fix (shown in a google map), and current job status The process begins with the ROSmaster component of
(current task highlighted in blue). Also, control buttons the ROS network, which hosts the ROS session and man-
were added for users to interact with the robot. ages the flow of information across the ROS network,
For PF, there was no need for such extra work, as PF ensuring all components transfer their data to the right
allowed a direct ROS-to-ROS connection, so ROS’s visua- destinations. In this example, the ROSmaster happens to
lization tools were utilized as if the connection was local. be the agriculture robot, and there is only one other mem-
The only difference was the minor time delays. ber, the operator’s laptop.
12 International Journal of Advanced Robotic Systems

A detailed process for configuring PF was presented in


this article, highlighting all configuration steps, and in all
of its layers. This includes the ISP level, the modem/router
level, the Linux level, and finally ROS itself. Along the
way, troubleshooting protocols were introduced to help
developers test their steps and ensure proper configuration
and robot operations.
One of the biggest challenges facing PF is handling dyna-
mically changing IP addresses. Since most ISPs provide
ranges of IP address and seldom fixed ones, PF settings
Figure 19. Auto-update PF settings, member-script.
would need to be updated accordingly and doing so manu-
ally would be cumbersome and error prone. To solve this
The master-script is installed in the ROSmaster’s problem, the authors introduced a collection of shell scripts,
embedded computer and runs when the robot is started. It first combined with some cloud-storage facilities (ironically) to
checks for internet connection, then it checks the current auto-update PF settings of all networked components. This
public IP address. If there is any change, then it updates the is achieved by monitoring the connection, detecting changes
value stored in a file saved on Dropbox. Because all ROS in IP addresses, and then updating PF settings seamlessly.
members are linked to the same Dropbox file, they all get Performance-wise, robot systems utilizing PF per-
notified when the file is modified (when the IP address is formed on par with those utilizing cloud-based solutions,
updated). This in turn triggers the member-scripts (Figure 19). but with the fraction of the man-hours needed for learning
Similarly, the member-script checks for changes in the and setup. This was the case because PF provides a direct
IP address of the ROSmaster, which is indicated by changes ROS-to-ROS remote connection, without the need for a
in the Dropbox file. Once triggered, then the PF settings for third-party bridge, and its associated challenges such as
the member (laptop) are updated. This is done by updating data conversion, non-ROS development, and so on.
hosts and the ROS_master_URI, which are steps 3 and 4 of Therefore, with the work presented in this article, PF
the PF configuration process, as discussed above. But, Fig- could be considered as viable option for setting up of
ures 18 and 19 show simplified versions of these scripts, remote ROS networks and ROS-enabled outdoor robot
where all prompts, confirmations, and the complete two-way applications such as agriculture, military, search and res-
PF settings update are shown. The source code of the com- cue, and others.
plete scripts are available at the Github page of this project.18
Acknowledgement
To summarize the discussion section, PF-powered
robots performed on par with robots powered by cloud- The authors would like to thank the College of Engineering, the
Innovative and Research Management Centre (iRMC), UNITEN,
based solutions, while requiring the least amount of time
for their continued support of this work.
to learn, install, and develop. The shell scripts developed by
the authors were able to monitor the IP addresses of the Declaration of conflicting interests
networked components and auto-update PF settings accord-
The author(s) declared no potential conflicts of interest with
ingly, allowing PF to become a viable option for linking respect to the research, authorship, and/or publication of this
ROS applications to the cloud. article.

Conclusions Funding
The author(s) disclosed receipt of the following financial support
In conclusion, this work was able to meet its objectives. for the research, authorship, and/or publication of this article: This
Cloud-based solutions for linking ROS applications to the work was supported by the College of Engineering, the Innovative
cloud were reviewed, a detailed process for setting up PF and Research Management Centre (iRMC), UNITEN and the
for ROS was introduced, and a comparison between the two Ministry of Higher Education, Malaysia through research grant
methods was made. (20140127/FRGS/V3500).
Although cloud-based solutions do deliver on their
promise, they come with challenges. This is because link- References
ing cloud-based solutions with ROS requires building a 1. Boren J and Cousins S. New Exponential Growth of ROS
ROS<¼cloud-based solution¼>ROS bridge, which in turn [ROS Topics]. IEEE Robot Autom Magazine 2011; 18(1):
would requires an extensive amount of man-hours to learn, 19–20. DOI:10.1109/MRA.2010.940147.
install, and develop the underlying technologies of these 2. O’Kane JM. A Gentle Introduction to ROS. Independently
solutions. This is especially true for complex robot appli- published, 2013. ISBN 978-1492143239. https://cse.sc.edu/
cations that involve tens to hundreds of difference ROS ~jokane/agitr/
message types, each requiring its own bridge, and the pro- 3. Emmi L, de Soto MG, Pajares G, et al. New trends in robotics
cess could become really complex. for agriculture: integration and assessment of a real fleet of
Hajjaj and Sahari 13

robots. Sci World J 2014; 2014: 21. DOI: 10.1155/2014/ 11. The ROS Wiki. ROS network setup. http://wiki.ros.org/ROS/
404059. Article ID 404059. NetworkSetup,2016. (accessed 20 September 2016).
4. Crick C, Jay G, Osentoski S, et al. ROS and rosbridge: 12. Speers A, Forooshani PM, Dicke M, et al. Lightweight
Roboticists out of the loop. In: Holly Yanko and Aaron Stein- tablet devices for command and control of ROS-enabled
field (eds) Proceedings of the Seventh Annual ACM/IEEE robots. In: Fiorini Paolo (ed) Advanced Robotics (ICAR),
International Conference on Human-Robot Interaction. HRI 2013 16th International Conference on, Montevideo, Uru-
‘12, 5–8 March 2012, New York, NY, USA, New York: guay, 25–29 November 2013, pp. 1–6. IEEE. DOI: 10.
ACM. ISBN 978-1-4503-1063-5, pp. 493–494. DOI:10. 1109/ICAR.2013.6766481.
1145/2157689.2157846. 13. Do HM, Mouser CJ, Gu Y, et al. An open platform telepre-
5. Kohler D, et al. Google i/o 2011: Cloud robotics, introducing sence robot with natural human interface. In: Wen Jung Li
rosjava. https://www.youtube.com/watch?feature¼player_ (ed) Cyber Technology in Automation, Control and Intelli-
embedded&v¼FxXBUp-4800,2011. (accessed 26 June 2016). gent Systems (CYBER), 2013 IEEE 3 rd Annual International
6. de A Barbosa JP, Lima FD, Coutinho LD, et al. ROS, Android Conference on, Kowloon Tong, Hong Kong, 26–29 May 2013,
and cloud robotics: how to make a powerful low cost robot. pp. 81–86. IEEE. DOI:10.1109/ CYBER.2013.6705424.
In: Aydan M. Erkmen, Afşar Saranlı and Konukseven E. 14. Chinnadurai G and Ranganathan H. Two wheel self equili-
ilhan (eds) Advanced Robotics (ICAR), 2015 International brium swarm robot controlled by port forwarding methods
Conference, 27 July 2015, pp. 158–163. IEEE. DOI: 10. using IoT. Int J Inno Sci Res 2015; 24(1): 79–85. ISSN
1109/ICAR. 2015.7251449. 2351-8014.
7. G Mohanarajah DH, D’Andrea R and Waibel M. Rapyuta: a 15. Luo YB, Wang BS and Cai GL. Analysis of port hopping for
cloud robotics platform. IEEE Trans Autom Sci Eng 2015; proactive cyber defense. Int J Security Appl 2015; 9(2):
12(2): 481–493. DOI:10.1109/ TASE.2014.2329556. 123–134.
8. Toris R, Kammerl J, Lu DV, et al. Robot web tools: effi- 16. Shin DH. Overlay networks in the west and the east: a techno-
cient messaging for cloud robotics. In: Norman Hendrich economic analysis of mobile virtual network operators.
(ed) 2015IEEE/RSJ International Conference on Intelli- Telecommun Syst 2008; 37(4): 157–168. DOI:10. 1007/
gent Robots and Systems (IROS), Hamburg, Germany, 8 s11235-008-9105 -1.
September–2 October 2015. pp. 4530–4537. IEEE. DOI: 17. Goebel RP. ROS by example, for Indigo, Vol 1, Section: 4.12.
10.1109/IROS.2015.7354021. 7: Networking accress the Internet. Independently Published,
9. Koken B. Cloud robotics platforms. Interdisciplinary 2015. ISBN: 5-800085-311092, p. 18.
Description of Complex Systems 2015; 13(1): 26–33. 18. Hajjaj S. A collection of scripts developed to autoupdate the
10. The ROS Wiki. Running ROS accross multiple machines. linux and ros setting for a remote ROS network via port-
http://wiki.ros.org/ROS/Tutorials/MultipleMachines, 2016. forwarding. https://github.com/roboFriend1977/autoUpdate
(accessed 20 September 2016). PubIPforROS, 2016. (accessed 28 September 2016).

You might also like