YouDuck.ai

robotctl chorale

Last updated

robotctl chorale
robotctl chorale --off
robotctl chorale --piece 2

Two ducks in a room sing a four-part piece together; more join what they find going. Runs until Ctrl-C.

Off by default, and invisibly so

[chorale] accept in robotd.toml, and it has to be set on every duck that should take part.

Off also means invisible: a duck that has not opted in puts nothing on the air, rather than politely declining. The reasoning is practical — a chorale moves the mouth and head, so a duck that started animating because another walked in would be doing motion nobody asked for.

How they coordinate

Four decisions, in the order the questions come up:

Nobody is in charge. Both ducks see the same beacons and the lower id conducts, so there is no election to lose and no message that has to arrive.

There is no shared clock. The boards have no NTP and no RTC agreement, so the conductor’s beat counter is the timebase: it bumps a byte in a BLE advertisement once per beat, and the arrival of a new value is the downbeat. Followers average the phase over about 25 beats, bringing the radio’s jitter inside the ±20 ms an ensemble needs.

Parts are worked out, not assigned. The lowest duck sings bass. The conductor broadcasts the roster and everyone replays the same seating over it — which is what stops two ducks singing the same line when each can see a different subset of the room.

Joining changes nobody’s part. An arriving duck takes what is free; a departing one keeps its seat and its line simply goes unsung, exactly as in a choir somebody walked out of.

Pieces

--piece pins what this robot picks if it conducts — a follower sings what the beacon names, so set it on every duck to guarantee the song. Ids: 1 wistful, 2 duck-strut, 3 outer-wilds (a test asset).