Extra: Flash it
For advanced groups or when time allows · Three programs over the air, then drive it yourself
This module is not one of the eight steps. Do it once your duo has finished step 8, or when the instructor says there is time. It reflashes your two robots, so it ends by putting remote-control back on them: the scripts of steps 4 to 8 need it.
The problem. A robot runs whatever program was flashed into it last; you replace that program over the radio, from your laptop, without touching the robot.
This module follows the PyDotBot docs, section Deploy and control, then The web UI of the controller guide. Read the workshop differences below first: the docs are written for someone who owns the whole swarm, and today you share a room of 20 robots.
The workshop differences
- Skip the docs’ Setup, except
dotbot fw fetch. The instructor already flashed the gateway and the sandbox firmware into every robot, and runs the gateway: do not rundotbot device flash,dotbot config init --conn ...ordotbot run gateway. - Always add
-c duo.tomlright afterdotbot swarm. The docs’dotbot swarm flash spin -ysreaches every robot in the room. Yourduo.tomllists your two robots, so a command with it reaches only them. - Always
stopbeforeflash. A robot still running a program is left out of the flash, and the flash saysNo ready device found. - Only
remote-controlanswers. The console pad and your scripts only drive a robot that runsremote-control;lightsandspinignore them. That is why this module ends onremote-control. - Do not start a controller. Use the instructor’s: its console is at
http://<instructor-ip>:8000/console/, with the address written on the board.
Your duo.toml
The instructor gives each duo a file named duo.toml. Save it in your dotbot-academy folder and run every command of this module from there. It looks like this:
duo.toml
# One duo's settings for `dotbot swarm -c duo.toml ...` in the extra module, Flash it.
# make_duo_tomls.py writes one per duo; this is what a finished one looks like.
# The instructor's broker, as the duos' laptops reach it on the room's Wi-Fi.
conn = "mqtt://192.168.1.10:1883"
# The swarm id the gateway was flashed with, in hex.
swarm_id = "1234"
# This duo's two robots: FULL 16-hex addresses, comma-separated in one string
# (not a TOML list). Without this line a flash goes to the whole fleet.
# Duo 3, labels A1B2C3 and D4E5F6:
devices = "BC3D3C8A2AA1B2C3,8E1F07C4D9D4E5F6"devices holds the full 16-character addresses of your two robots, in one string separated by a comma. The last six characters of each are the labels on your robots.
What to do
In a terminal, in your dotbot-academy folder with the environment active:
Download the programs (the docs’ Setup, first line only):
dotbot fw fetchCheck that you see your two robots, and only them:
dotbot swarm -c duo.toml statusTwo rows, with addresses ending in your labels. Anything else: call the instructor before flashing.
Lights. Stop, then flash and start
lights. In-ys,yanswers yes to the confirmation andsstarts the program once flashed:dotbot swarm -c duo.toml stop dotbot swarm -c duo.toml flash lights -ysYour two robots’ LEDs cycle through six colors.
Spin. Same two commands, with
spin:dotbot swarm -c duo.toml stop dotbot swarm -c duo.toml flash spin -ysEach robot blinks, spins one way, then back, blinks again and stops. To see it again, start it again:
dotbot swarm -c duo.toml startRemote control. Same again, with
remote-control:dotbot swarm -c duo.toml stop dotbot swarm -c duo.toml flash remote-control -ysDrive it. Open the instructor’s console,
http://<instructor-ip>:8000/console/. Select your robot on the map (the List view shows the addresses), then drag the pad.
You should see
Three programs, one after the other, on your two robots only: colors, a spin, then a robot you drive across the floor from the console’s pad.
Core three flashes and the pad
Do steps 1 to 6 above, in order. If a flash prints No ready device found, run the stop line again, then the flash line.