Duckiedrone Containers
Contents
Duckiedrone Containers#
The Duckiedrone software is not one single, monolithic, program. It is a set of smaller programs, each doing one job and handing its result to the next.
Each of those programs is delivered as a Docker image, and a running copy of an image is called a container, so the software on a Duckiedrone is a set of containers rather than an installed application. This modular software architecture design and reliance on containerization technology improves reproducibility of outcomes.
Containers are grouped into Docker Compose files called stacks. Three stacks start automatically at boot up and include everything required for the Duckiedrone to fly. The rest hold optional sensors and tools, and start only when asked.
To see what is running, log into the drone and list the containers:
ssh duckie@ROBOT_NAME.local
docker ps
Every container from the three automatic stacks should appear in that list.
Stacks#
Stack |
Contents |
Starts |
|---|---|---|
|
Container management and the key-value store |
Automatically |
|
Message backbone, sensor drivers, flight control, device services |
Automatically |
|
ROS 2 transport and the ROS 2 bridges |
Automatically |
|
The front, left, right and top ToF sensors |
On request only |
|
Tools for inspecting the drone |
On request only |
The containers each stack starts, grouped by stack:
robot/basics
portainer
kvstore
duckietown/duckiedrone
dtps
driver-camera
driver-tof-bottom
dt-px4
mavlink-proxy
dashboard
files-api
code-api
device-proxy
device-health
device-online
wifi-access-point
ros2/duckiedrone
zenoh-router
ros2-camera
ros2-tof-bottom
ros2-mavros
ros2-px4-calibration
ros2-rosbridge-websocket
duckiedrone/extra_sensors (on request only)
driver-tof-front
driver-tof-left
driver-tof-right
driver-tof-top
ros2-tof-front
ros2-tof-left
ros2-tof-right
ros2-tof-top
duckiedrone/extra_tools (on request only)
ros2-foxglove-bridge
Stacks are started and stopped from the computer running the Duckietown Shell, not from the drone itself. To bring one up:
dts stack up -H ROBOT_NAME -d duckiedrone/extra_sensors
To take the same stack down again:
dts stack down -H ROBOT_NAME duckiedrone/extra_sensors
The -H flag names the drone and -d detaches, so the command returns instead of streaming the logs of every container.
Message backbone#
Two containers carry data between all the others, and everything else depends on them.
Container |
Role |
|---|---|
|
The switchboard. Drivers publish their readings into it and everything else reads them out |
|
Connects the ROS 2 containers so they can find and talk to each other. Every ROS 2 container is set to the same |
Sensor drivers#
Driver containers read the drone’s sensors. Each one reads a device and publishes what it read into the switchboard.
Container |
Role |
|---|---|
|
Captures raw frames from the camera, does some basic processing on them, and publishes them for the rest of the system to use |
|
Reads the downward-facing ToF sensor, which measures height above the ground. The altitude controller needs this reading to work, so it is the one sensor required for flight |
ROS 2 bridges#
The switchboard is not ROS 2. These containers translate: each one reads from the switchboard and republishes the same data as ROS 2 topics, so that ROS 2 code can use it.
Container |
Role |
|---|---|
|
Republishes the camera feed as a ROS 2 topic |
|
Republishes the downward ToF sensor reading as a ROS 2 topic |
|
Talks to the flight controller and exposes it to ROS 2. Used to read the drone’s state, send it commands, and arm it |
|
Runs the calibration steps triggered from the Dashboard, such as calibrating the gyroscope or leveling the horizon |
|
Lets the Dashboard, running in a browser, talk to ROS 2 |
Simulation#
Two containers exist for virtual Duckiedrones only. A physical drone has a real flight controller board, so on real hardware both containers just sit idle.
Container |
Role |
|---|---|
|
The flight controller software, PX4, running on a computer instead of a physical board. It is the virtual drone’s flight controller and connects to the simulator for its physics |
|
Carries flight-controller traffic between the simulated flight controller and the rest of the software |
Device services#
These containers provide the drone’s web interfaces and back-end services.
Container |
Role |
|---|---|
|
Runs the on-board Dashboard, the web interface used to fly and monitor the drone |
|
Gives other tools access to the device’s |
|
Handles over-the-air software updates for the device |
|
Makes the device’s other APIs and services reachable from one place |
|
Reports on the health of the device |
|
Connects the device to the Duckietown cloud |
|
Runs the drone’s own WiFi network |
|
Stores small pieces of data that other containers need to remember |
|
A web interface for managing the containers on the device |
Optional sensors#
A Duckiedrone flies on the downward-facing sensor alone, so driver-tof-bottom and ros2-tof-bottom are the only ToF containers that start on their own. The front, left, right and top sensors are not needed to fly, so they stay off by default and only start when asked for.
Container |
Role |
|---|---|
|
Reads the front-facing ToF sensor and publishes it to the switchboard |
|
Reads the left-facing ToF sensor and publishes it to the switchboard |
|
Reads the right-facing ToF sensor and publishes it to the switchboard |
|
Reads the top-facing ToF sensor and publishes it to the switchboard |
|
Republishes the front ToF sensor reading as a ROS 2 topic |
|
Republishes the left ToF sensor reading as a ROS 2 topic |
|
Republishes the right ToF sensor reading as a ROS 2 topic |
|
Republishes the top ToF sensor reading as a ROS 2 topic |
To start them:
dts stack up -H ROBOT_NAME -d duckiedrone/extra_sensors
Once started, they keep running and come back automatically after a reboot, until stopped.
To stop them:
dts stack down -H ROBOT_NAME duckiedrone/extra_sensors
Optional tools#
Some containers are useful while developing or debugging, but neither flying the drone nor serving the Dashboard needs them. They stay off by default and only start when asked for.
Container |
Role |
|---|---|
|
Exposes the ROS 2 topics to Foxglove, used to visualize and record flights |
To start them:
dts stack up -H ROBOT_NAME -d duckiedrone/extra_tools
To stop them:
dts stack down -H ROBOT_NAME duckiedrone/extra_tools