Virtual Duckiebots#

What you will need

What you will get

  • Knowledge on virtual Duckietown robots.

Introduction#

Virtual Duckietown robots allow for a Duckietown robot’s full software stack to be run on a local machine in its own Docker environment, allowing for the full simulation of any aspect of that Duckietown robot, enabling integration tests.

Once a virtual Duckietown robot is running, it will behave in accordance with its physical equivalent, including how it responds to dts commands.

The most common thing you will likely want to do is create a virtual robot and then start it. Once it’s up and running (you see it when you run the command dts fleet discover just like any other Duckiebot), you probably will want to attach it to an entity in the Duckiematrix. Once this attachment is complete, all the data that is collected by the entity in the Duckiematrix will be fed to the virtual robot and, conversely, any control actions that you take with your virtual Duckiebot will be executed on the entity in the Duckiematrix. See below for a detailed description of the supported drivers that you can use to send or receive data.

The Virtual Robot dts API#

Like most things in Duckietown, the primary way to perform operations on virtual robots is through the Duckietown Shell (`dts)

The following is a list of operations you can perform:

Create#

To create the virtual Duckietown robot ROBOT_NAME, run the following command, where TYPE and CONFIGURATION are its type and configuration, respectively:

dts duckiebot virtual create --type TYPE --configuration CONFIGURATION ROBOT_NAME

Start#

To start the virtual Duckietown robot ROBOT_NAME, run:

dts duckiebot virtual start ROBOT_NAME

Connect#

To connect to the virtual Duckietown robot ROBOT_NAME, run:

dts duckiebot virtual connect ROBOT_NAME

List#

To list the existing virtual Duckietown robots and their statuses, run:

dts duckiebot virtual list

Restart#

To restart the virtual Duckietown robot ROBOT_NAME, run:

dts duckiebot virtual restart ROBOT_NAME

Stop#

To stop the virtual Duckietown robot ROBOT_NAME, run:

dts duckiebot virtual stop ROBOT_NAME

Destroy#

To destroy the virtual Duckietown robot ROBOT_NAME and remove all of its Docker images, run:

dts duckiebot virtual destroy ROBOT_NAME

Attaching Virtual Robots#

For a Duckietown robot to act and sense inside the Duckiematrix, it needs a proxy inside the Duckiematrix (a Duckiematrix entity) to attach to. A Duckietown robot outside the Duckiematrix is said to be attached to a Duckiematrix entity when all of its sensors and actuators are linked to their virtual counterparts inside the Duckiematrix.

To attach the Duckietown robot ROBOT_NAME to the Duckiematrix entity ENTITY_NAME (e.g., map_0/vehicle_0), run the following command, where ENGINE_HOSTNAME is the optional hostname (or IP address) of the Engine:

dts matrix attach [--engine ENGINE_HOSTNAME] ROBOT_NAME ENTITY_NAME

Note

This applies for both physical and virtual Duckietown robots.

Tip

Use the --dreamwalk option to enable dreamwalking for physical Duckiebots (i.e., commands will be sent to their physical actuators as well as their Duckiematrix counterparts).

Attention

Make sure that your computer’s firewall is set to inactive or that an allow rule has been added for ENGINE_HOSTNAME.

To show the status of your computer’s firewall, run:

sudo ufw status

To add an allow rule for ENGINE_HOSTNAME to your computer’s firewall, run:

sudo ufw allow ENGINE_HOSTNAME

Supported Drivers#

Virtual Duckietown robot drivers allow for the communication between a Duckietown robot’s ROS stack and an entity inside the Duckiematrix.

Data types exchanged with the Duckiematrix by the virtual Duckietown robot drivers.

Fig. 3 Data types exchanged with the Duckiematrix by the virtual Duckietown robot drivers.#

Implementation status#

Driver

Implemented

Camera

Yes

Time-of-Flight

Yes

IMU

Yes

LED

Yes

Encoder

Yes

Wheel

Yes