Duckietown package for the \compose\ platform implementing Duckieboard, a Remote Dashboard for the Duckietown project.
Duckieboard provides high level fleet management and monitoring capabilities for Duckietown.
Duckietown <-> World
The easiest way to monitor and control a Duckiebot remotely using Duckieboard, thus via the web browser, is to setup a network bridge between the outside world and Duckietown.
Bridging each Duckiebot to the outside world has the main advantage of allowing data to flow directly from the on-board Raspberry Pi to the user's browser. The Duckiebots are bridged using IP Forwarding via a dedicated machine (i.e., network bridge) connected to both Duckietown and internet. Deploying the network bridge on the machine hosting the Duckieboard would allow the use of Duckieboard to easily configure the routing table (iptables) of the network bridge. For the remainder of this document we will refer to the bridge machine as Bridge.
The applications bridged are:
- SSH [RPi port: TCP(
22), Bridge port: TCP(
- ROS Bridge [RPi port: TCP(
9090), Bridge port: TCP(
XXX above is a unique ID associated to each Duckiebot.
These instructions are based on tests run on Duckiebots and Bridge both running Ubuntu 16.04.
Enabling IP Forwarding (duckieboard)
IP Forwarding is a kernel function that can be enabled on the Bridge server by running
for a temporary effect or uncomment the line
net.ipv4.ip_forward = 1
/etc/sysctl.conf for a permanent effect.
Enable IP Masquerade
IP Masquerade allows machines within a private local network (i.e.,
seamlessly communicate with the outside world via a mid-point machine (i.e., our Bridge
IP Masquerade can be enabled by running the following command on the Bridge machine
iptables -t nat -A POSTROUTING -j MASQUERADE
Bridging an Application
AAAA on the Bridge (IP:
CCC.CCC.CCC.CCC) can be forwarded (bridged) to
the the port
BBBB on the Raspberry Pi (IP:
DDD.DDD.DDD.DDD) by running the following
command on the Bridge.
iptables -t nat -A PREROUTING -p tcp -d CCC.CCC.CCC.CCC --dport AAAA -j DNAT --to-destination DDD.DDD.DDD.DDD:BBBB
Monitoring bridged Applications
The list of all bridged applications can be obtained by running the command
sudo iptables -t nat -L PREROUTING --line-numbers
An example of output is the following
Chain PREROUTING (policy ACCEPT) num target prot opt source destination 1 DNAT tcp -- anywhere 220.127.116.11 tcp dpt:40003 to:192.168.2.53:22
The output of this command will assign to each rule a unique ID (column
we can use to delete rules. A rule with ID
<N> can be removed by running the command
sudo iptables -t nat -D PREROUTING <N>
Process Manager on Duckieboard
supervisor introduces the possibility to use
Duckieboard as a process monitor and manager for Duckiebots. supervisor provides
an XMLRPC interface. This opens two possibilities, (i) bridging the XMLRPC server
to the outside world, (ii) implementing a ROS interface for supervisor that maps
XMLRPC resources to ROS Services. In the first case, the Duckieboard will communicate
with the supervisor back-end directly via XMLRPC. In the second case, the ROS interface
to supervisor will be accessible via ROS Bridge.
I believe that the best option is the latter, that is implementing a ROS interface
for supervisor that maps XMLRPC resources to ROS Services (UPDATE: Implemented and
available at https://github.com/afdaniele/supervisor_ros
). This option also gives us the
possibility to correct some issues with supervisor monitoring the
process. In fact,
roslaunch employs its own process manager to monitor all the nodes
it runs. This process manager would normally mask the presence of running nodes to the
overhead supervisor process manager.
SSH Console via Duckieboard
The library GateOne (not tested yet) provides an open-source web-based Terminal Emulator and SSH client. It constitutes a good candidate for implementing an SSH terminal on Duckieboard.
(Secure) ROS Bridge