The Code Structure#

In this section, we give a brief overview of how the code is structured at a high level, and where you can find various things.

We make extensive use of Docker in our infrastructure. This enables us to keep things compartmentalized. It means that we can take the same “agent”, e.g., one that is built as part of a learning experience), and run it many different ways: as locally but in simulation, on an actual Duckiebot, or on a cloud server for evaluation.

Duckietown power user managing Duckiebots with Ubuntu

See also

For more details, you may want to refer to code hierarchy page the Developer manual.

dt-core#

The dt-core repository contains the code that runs the core autonomy stack for the Duckiebot. This includes all the needed components for the lane-following demo as well as some of their core components for more complicated robot behaviors.

Some of the learning-experiences leverage code from this repository, though it is somewhat “hidden” from the student doing the learning experience because it is part of the base docker image on which they are working.

dt-ros-commons#

The dt-ros-commons repository is upstream of dt-core, in the sense that the Dockerfile that builds the dt-core image builds from the image that is created by [dt-ros-commons][dt-ros-commmons].

This repository contains ROS-related configurations and details.

For example, we created a parent class for all ROS nodes called dtros, and you will also find all of the message definitions for topics that ROS nodes use to communicate in this repository.

It is relatively unlikely that you should need to look into or understand in detail the code in this repository.

dt-commons#

The dt-commons repository sits upstream of dt-ros-commons and contains Duckietown-specific configurations and libraries.

It is very unlikely that you will need to look at the code in this repository.

dt-machine-learning-base-environment#

The dt-machine-learning-base-environment is downstream of dt-ros-commons but includes extra libraries and utilities for using the GPU and machine learning on the Jetson nano. For example, this is used in the object detection learning experience.

duckietown-shell#

We have created the duckietown-shell to abstract away a lot of the details, particularly with respect to the way that Docker images are created and configured.

This is the code that runs the dts that is used extensively to do exercises, build code and documentation, run code and many other things.

It is very unlikely that you would need to understand the code in this repository. If you are interested to understand better what happens for a specific command that you run with dts, it is probably better to start with the implementation of that command in the duckietown-shell-commands repository.

duckietown-shell-commands#

The duckietown-shell-commands repository contains the implementations of the commands that are run by the Duckietown shell (with dts in the command line).

For the specific implementations of how these commands are executed, you can refer to the subfolders in the repository. You also probably should not need to understand the details of how these commands work, but if you get an error you don’t understand, it might be a good place to start debugging (in addition to also reporting the bug).

gym-duckietown#

The gym-duckietown repository contains the code that implements the gym-duckietown simulator.

This simulator is written in OpenGL and Python to be as slim as possible, with a view of being useful for machine learning, as it adheres to the OpenAI Gym API.

It is also used to evaluate exercise submissions.

duckietown-lx#

The duckietown-lx repository contains the starter code and notebooks for the learning experiences.

This is a repository that students will typically fork and use for doing the learning experiences.

duckietown-lx-recipes#

The duckietown-lx-recipes repository contains the configurations for the exercises in the duckietown-lx repository. Unless you are interested in building your own learning experiences, you probably do not need to understand in detail the code in this repository.

duckietown-lx-solutions#

The duckietown-lx-solutions repository contains solutions for the exercises in the duckietown-lx repository. This repository is private, if you would like to gain access, please contact us.