Running Everything in a Dev Container (Beta)#

This page describes how to run Duckietown code inside a Development (Dev) Container, providing a functional environment inside of Visual Studio Code.

Note

This is the only workflow for running Duckietown code on an Apple Silicon (M-series) Mac.

Installing Orbstack (macOS)#

Attention

If you have Docker Desktop installed, uninstall it and reboot.

To install Orbstack:

  1. Download the Orbstack .dmg file.

  2. Navigate to your Downloads folder.

  3. Double-click the .dmg file.

  4. Move the application to your Applications folder.

Tip

If your Mac refuses to open an application because it is not trusted, hold down the option key and secondary-click it, then select Open. Your Mac will inform you that the application is not trusted but will allow you to open it.

Installing Visual Studio Code#

To install Visual Studio Code:

  1. Download the appropriate VS Code .zip file.

  2. Navigate to your Downloads folder.

  3. Double-click the .zip file.

  4. Move the application to your Applications folder.

Cloning the dt-env-developer repository#

To clone the dt-env-developer repository, run:

git clone [email protected]:duckietown/dt-env-developer.git

Attention

Ignore the instructions in the README of this repository.

Running the Dev Container in VS Code#

To run the Dev Container in VS Code:

  1. Open VS Code and navigate to the dt-env-developer folder (File -> Open Folder... -> /path/to/dt-env-developer). You should see a popup appear in the bottom-right corner of your screen containing the message “Folder contains a Dev Container configuration file. Reopen folder to develop in a container (learn more).”.

  2. Click the Reopen in Container button.

  3. (Optional) Click the Reading Dev Container Configuration (show log) link.

Note

The first time you load the Dev Container may take some time.

Setting up the Duckietown Shell#

To set up the Duckietown Shell, follow these instructions.

Attention

If a popup asking you to input your credentials appears, you should do so and then click Always Allow.

Running the Duckiematrix#

The procedure for running the Duckiematrix will be slightly different in this workflow. In short, you will run the Engine and Renderer inside and outside the Dev Container, respectively.

To start the Engine, run the following command in the Dev Container:

dts matrix engine run --sandbox --verbose

To install the Renderer:

  1. Download the Renderer .zip file.

  2. Navigate to your Downloads folder.

  3. Double-click the .zip file.

  4. Move the application to your Applications folder.

To start the Renderer and connect it to the Engine running in the Dev Container, run the following commands, where TOKEN is your Duckietown Token (do not forget the double quotes):

cd /Applications
open duckiematrix.app --args -e localhost --token "TOKEN"

Caveats#

Accessing a Virtual Robot’s Dashboard and the Duckietown Viewer#

To access a Virtual Robot’s Dashboard, open the noVNC virtual desktop by navigating to localhost:6080.

Note

Duckietown Viewer applications (i.e., Image Viewer, Keyboard Controller, etc.) may not work as expected, due to limitations with GUI applications in Docker containers.

To open the Image Viewer in your browser, run the following command, where ROBOT_NAME is the name of your robot:

dts duckiebot image_viewer ROBOT_NAME --browser

To open the Image Viewer in the noVNC virtual desktop, run the following command after navigating to localhost:6080, where ROBOT_NAME is the name of your robot:

dts duckiebot image_viewer ROBOT_NAME

Attaching a Duckietown robot to the Duckiematrix#

To attach a Duckietown robot to the Duckiematrix, run the following command, where ROBOT_NAME is the name of your robot and ENGINE_LOCAL_NETWORK_ADDRESS is the LAN IP address of the Engine (not localhost):

dts matrix attach ROBOT_NAME -e ENGINE_LOCAL_NETWORK_ADDRESS

Running dts code run#

To be able to run dts code run:

  1. Run brew install mkcert or download the darwin binary for your system’s architecture.

  2. Run mkcert -install (to install the local CA in your system).

Learning Experiences in the Duckiematrix#

To run the Duckiematrix for LXs, run the following command to start the Engine and then attach the Renderer:

dts code start_matrix --no-renderer