Duck Cards
The card format
What a Duck Card means, how a row is read, and what a reader should send. Short enough to read in one sitting, and exact enough to build on.
Status
This is duck-cards/0. Its words come from Studio's plan vocabulary, r001, and a row becomes a duck-intent-plan/0 plan.
Nothing reads cards yet. Not Microduck Studio, and nothing else this project knows of. The format is written down first, so that every deck printed before a reader exists agrees with that reader when it comes.
The deck file, duck-cards.json, holds the same information as data. Every card on this site is drawn from it.
A card
Trick
Kick, right
kick_right
- Studio
- Pad: RB
- Band
- The category. The colour is for sorting at a glance; the word is there for black and white printers.
- Picture
- What the duck does, for readers and for children who cannot read yet.
- Name
- The card in Studio's own words, wherever Studio has a word for it.
- Code word
- The label a reader sends, spelled the way Studio's plan spells it.
- Where it runs
- Studio, when the duck in Studio's Play screen can do it. Pad and a button, when the gamepad can.
- Code and number
- An AprilTag and its number. The number is the card.
Reading a row
A row is one line of cards, read left to right like a sentence.
- Start and End mark the row. Both are optional. When they are on the table, nothing before Start or after End is read.
- An action card is a step. Walk, Trick and Sound cards each make one step, in the order they lie.
- Under changes the card above. A Speed or Look card placed directly below a card adds to that card's step. Under a card that cannot take it, a reader ignores it and says so.
- Repeat makes a bracket. Repeat opens one and End repeat closes the nearest one still open. The count is written on the Repeat card, and a reader that cannot read handwriting asks for it. Brackets can sit inside brackets.
- When it falls starts a second row. If the duck falls, the first row stops. Once the duck is back on its feet, the second row runs from its first card, and then the program ends.
- Your cards mean what the deck file says. A reader that has no meaning for one stops at it and says which card it was.
Into a Studio plan
A row becomes the steps of a duck-intent-plan/0 plan, the format Studio's plan editor reads from a router. Each action card is one step, and the card's name is the step's clause. A card under it adds a label to that step. Control cards shape the steps and never become one. A plan has no events, so a When it falls row stays with the reader.
The row on the Duck Cards page becomes this:
{
"format": "duck-intent-plan/0",
"request": "Start. Say hello. Walk forward, slowly. Turn left. Kick with the right foot. End.",
"model": "duck-cards/0",
"steps": [
{
"clause": "Hello",
"labels": {
"action": "make_sound",
"sound": "greet"
}
},
{
"clause": "Walk forward",
"labels": {
"action": "walk_forward",
"speed": "slow"
}
},
{
"clause": "Turn left",
"labels": {
"action": "turn_left"
}
},
{
"clause": "Kick, right",
"labels": {
"action": "kick_right"
}
}
]
}
Studio's bench runs a plan with one trick at most, and only as its last step: on the bench a trick is a network that takes over when the walking ends, and it does not hand the duck back. A row with a trick anywhere else still becomes a plan, and Studio says why it will not run it. Sound and Look steps stay in the plan, but the bench plays no sound and sends no head pose.
On a robot
A reader that drives a real Microduck sends robotd's own calls, the way Microduck Studio's source does when it runs a plan on a duck: robot.move for each walking step, robot.do with the skill's name for a trick, and robot.sound with its tag for a sound. On a robot a trick can sit anywhere in a row, and a row can hold more than one, because the robot takes the duck back to walking when a trick ends. A Look card needs a head pose, robot.head, and Studio's source does not send one to a robot yet. Every card names its call.
Wait for each trick to finish before sending the next step: a trick runs to its end once it starts, and stopping the duck does not cancel it. Send intents only, never motor positions. The robot's own software decides what is safe to carry out.
Nobody has run a card on a real Microduck yet, because nobody has a Microduck yet.
The code
Every card carries an AprilTag from the tag36h11 family. The tag's id is the card's number.
- Size. On a full size card the tag's black square is a little over a centimetre across, with a white margin one cell wide around it. Keep that margin on a card of your own.
- Numbers by category. Each category has its own range, so a new card can join it without renumbering anything: Walk 0 to 19, Speed 20 to 39, Look 40 to 59, Trick 60 to 79, Sound 80 to 99, Control 100 to 119, When 120 to 139, and Your card 200 to 299.
- Checked before publishing. The codes are drawn from the family's own table, and this site's checks read every printed code back against that table before a page goes live.
NFC
Optional. Any NFC Forum Type 2 sticker with room for two records will do, and an NTAG213 has room for every card in the deck. Write the records in this order:
Record 1, URI:
https://microduckstudio.com/cards/spec/#card-61
Record 2, MIME type application/vnd.duckcards+json:
{"format":"duck-cards/0","tag":61,"code":"kick_right"}
A phone that taps the card opens its row in the table below. Lock the sticker after writing it, if your app offers to, so a curious tap cannot change a card.
The deck file
duck-cards.json is plain JSON, and a deck of your own starts as a copy of it.
formatduck-cards/0. A reader refuses a format it does not know.vocabularyandplan_format- The Studio vocabulary the cards' labels come from, and the plan a row becomes.
categories- Each has an
id, aname, a lineaboutit, andcodes, its range of numbers. cards- Each card has a
tagnumber, acodeword, aname, acategory, akind(action, modifier, control, event or yours), theplanlabels it adds to a step, and whether it isprintedin the starter deck. A card of your own can add adoessentence that says what it means. example- The row shown on the Duck Cards page, and how it reads aloud.
license- CC BY 4.0, for the cards, their pictures and the lessons.
Every card
Studio's words and the gamepad's buttons in this table are read out of Microduck Studio's source before every publish, and the site will not publish while a card disagrees with them.
| Code | Card | Studio plan step | Under it | Runs in Studio | Pad | On a robot |
|---|---|---|---|---|---|---|
| 0 | Walk forward | action walk_forward | Speed, Look | Yes | L stick | robot.move |
| 1 | Walk back | action walk_backward | Speed, Look | Yes | L stick | robot.move |
| 2 | Turn left | action turn_left | Speed, Look | Yes | R stick | robot.move |
| 3 | Turn right | action turn_right | Speed, Look | Yes | R stick | robot.move |
| 4 | Stop | action stop | Look | Yes | None | robot.move at zero |
| 20 | Slow | speed slow | Goes under Walk forward, Walk back, Turn left or Turn right | Yes | None | scales robot.move |
| 21 | Fast | speed fast | Goes under Walk forward, Walk back, Turn left or Turn right | Yes | None | scales robot.move |
| 22 | Normal | speed normal | Goes under Walk forward, Walk back, Turn left or Turn right | Yes | None | scales robot.move |
| 40 | Look left | head look_left | Goes under Walk forward, Walk back, Turn left, Turn right or Stop | No | Y | robot.head |
| 41 | Look right | head look_right | Goes under Walk forward, Walk back, Turn left, Turn right or Stop | No | Y | robot.head |
| 42 | Look up | head look_up | Goes under Walk forward, Walk back, Turn left, Turn right or Stop | No | Y | robot.head |
| 43 | Look down | head look_down | Goes under Walk forward, Walk back, Turn left, Turn right or Stop | No | Y | robot.head |
| 44 | Straight ahead | head straight | Goes under Walk forward, Walk back, Turn left, Turn right or Stop | No | Y | robot.head |
| 60 | Kick, left | action kick_left | Nothing | Yes | LB | robot.do kick_left |
| 61 | Kick, right | action kick_right | Nothing | Yes | RB | robot.do kick_right |
| 62 | Sit or stand | action sit_or_stand | Nothing | Yes | ▼ | robot.do sit_toggle |
| 63 | Roll | action roll | Nothing | Yes | X | robot.do roulade |
| 64 | Peck the ground | action peck_ground | Nothing | Yes | A | robot.do ground_pick |
| 80 | Hello | action make_sound, sound greet | Nothing | No | None | robot.sound greet |
| 81 | Chirp | action make_sound, sound chirp | Nothing | No | None | robot.sound chirp |
| 82 | Coo | action make_sound, sound coo | Nothing | No | None | robot.sound coo |
| 83 | Alarm | action make_sound, sound alarm | Nothing | No | None | robot.sound alarm |
| 84 | Wheee | action make_sound, sound wheee | Nothing | No | LT | robot.sound wheee |
| 85 | Inquire | action make_sound, sound inquire | Nothing | No | None | robot.sound inquire |
| 86 | Peck | action make_sound, sound peck | Nothing | No | None | robot.sound peck |
| 100 | Start | Not in Studio's plan | Marks where the row begins. | No | None | None |
| 101 | End | Not in Studio's plan | Marks where the row ends. | No | None | None |
| 102 | Repeat | Not in Studio's plan | Opens a bracket. The count is written on the card. | No | None | None |
| 103 | End repeat | Not in Studio's plan | Closes the nearest open Repeat. | No | None | None |
| 120 | When it falls | Not in Studio's plan | Starts a second row that runs after a fall. | No | None | None |
| 200 | Your card | Not in Studio's plan | Yours to decide, and to write down in the deck file. | No | None | None |
| 201 | Your card | Not in Studio's plan | Yours to decide, and to write down in the deck file. | No | None | None |
| 202 | Your card | Not in Studio's plan | Yours to decide, and to write down in the deck file. | No | None | None |
| 203 | Your card | Not in Studio's plan | Yours to decide, and to write down in the deck file. | No | None | None |
| 204 | Your card | Not in Studio's plan | Yours to decide, and to write down in the deck file. | No | None | None |
| 205 | Your card | Not in Studio's plan | Yours to decide, and to write down in the deck file. | No | None | None |
| 206 | Your card | Not in Studio's plan | Yours to decide, and to write down in the deck file. | No | None | None |
| 207 | Your card | Not in Studio's plan | Yours to decide, and to write down in the deck file. | No | None | None |
| 208 | Your card | Not in Studio's plan | Yours to decide, and to write down in the deck file. | No | None | None |
Changing the format
- A number never changes meaning. A new card takes a new number from its category's range.
- Studio's words win. When Studio renames a label, the card is renamed with it.
- The version changes when a reader written for the old format would misread the new one.
- Propose a card by opening an issue on this site's repository.