3. Your swarm in the simulator

Check your install, then robots on your own laptop

your laptop console in the browser your Python script from step 4 http://localhost:8000 same API as the real controller: no broker, no gateway, no radio controller dotbot run simulator simulated robots
Figure 1: Everything on your laptop: your console, and later your script, talk to dotbot run simulator at http://localhost:8000. It is a controller with simulated robots inside it: the same API as the real one, with no real robots, no broker and no gateway.

The problem. You want to try swarm code without risking a real robot: the simulator gives you a swarm on your own laptop. First, make sure DotBot runs on it.

This step follows the PyDotBot docs, section Try the simulator. Read it there; the commands below are the same, with four robots instead of twenty. We do it together, right after the platform (step 2): if anything fails, raise your hand.

Check your install

Open a terminal, go to your workshop folder and activate its environment, as in Before the workshop:

macOS and Linux

cd ~/dotbot-academy
source .venv/bin/activate
dotbot --version

Windows (PowerShell)

cd ~\dotbot-academy
.\.venv\Scripts\Activate.ps1
dotbot --version

It prints a line such as dotbot 0.32.0; a message saying that no config file was found is normal. If the instructor announces a newer version, run pip install --upgrade pydotbot. No .venv folder yet? Follow Before the workshop now, or move to a lab Mac. Started it during the platform talk? Check that pip install pydotbot has finished.

Start the simulator

  1. Write the default site, once. It is a 2 x 2 m field, the same size as the real floor:

    dotbot config init
  2. Start a simulated swarm of four robots. Leave this terminal running:

    dotbot run simulator --robots 4

    Your browser opens the console at http://localhost:8000/console/: the setup of Figure 1.

  3. Open a second terminal (folder and environment again), and drive one robot in a circle:

    dotbot run demo circle

You should see

Four robots in the middle of the map. One of them drives a circle for about five seconds, then stops.

Core drive one from the console

In the console, select a robot on the map and drive it with the pad (“Drag pad to drive”). In step 5 you open the same console on the real robots.

If something fails

You are on Python 3.14 (or 3.10 or older). Install 3.13, delete the .venv folder and create it again, as in Before the workshop, steps 2 and 3.

The virtual environment is not active in this terminal. Run cd ~/dotbot-academy, then the activate command above.

Something else is using port 8000, most likely a simulator you did not stop. Stop it with Ctrl+C in its terminal, or start on another port with dotbot run simulator --robots 4 --controller-http-port 8001.

Open http://localhost:8000/console/ by hand while the simulator is running (use your port number if you changed it).