After a fall robotd hands the robot to the standing policy to get up.
autod now watches that like robotctl stress (getup.rs, ported): still
down 5 s after the policy took over, the policy is cut for 2 s so the
robot settles into its init pose, then given back for a second try.
Down after that: torque off and the questioning quack.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The stand-up marker was the boot alone, so a duck updated without a reboot
stayed limp: the update restarted robotd (limp) and autod (marker matched).
It now names the robotd it stood up with as well (boot_id and robotd's
start, from robot.state's t_ns - t). A new robotd came up limp by itself
and is stood up; only autod restarting with the same robotd still leaves
the robot as somebody left it. An old marker matches nothing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Laser tracking stays on through a nap, and a followed dot stands the duck
up at once and sends it after the dot. The nap after a chase is the
exception: laser_tired keeps the laser off, so a tired duck rests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The map is an offset: map.stream's pose paired with the odometry of the
same t_ns. The novelty grid, blocked spots and goals live in the map's
frame from the first fix (carried over from odometry's), and goals are
converted back every tick, so a correction moves the goal.
- A wander bout that reaches its goal ends in a 4-6 s survey, the head
sweeping +-0.9 rad: the stops the map grows from.
- Lost, the duck stops walking and alternates surveys and short turns in
place, for up to 90 s, then lives normally again.
- Every 20 s the grid is fetched: paths within 15 cm of a known wall are
shut, and goals with unseen floor around them score better.
- The novelty grid is saved to /var/lib/autod/visits.json every minute
and restored at the first fix, faded by the time since.
Without mapd, or with one not mapping, nothing changes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The brain gains two states, both driven by robotd and wanted by the brain:
- Laser: tracking is on whenever the duck could chase (not tired, not
napping, petted or playing ball). A followed dot interrupts any
standing or walking state; the chase ends 2 s after the dot goes, and
costs twice a walk's energy. Below 0.2 the laser goes off and the duck
naps; it comes back above 0.45.
- BallPlay: picked from the standing pool when rested and off cooldown,
less often the more bored of the ball. No ball in 20 s backs off 3 min,
doubling per miss up to 30. A game ends on 3-8 kicks, 1-3 min shrunk by
boredom, the ball lost for 15 s, or tiredness; then 4-8 min of rest.
While robotd drives either, autod sends a zero twist and a centred head,
which robotd reads as nobody asking. A game somebody else started is
stood aside for, and the brain's own is switched off when the pad takes
over.
The on/off switch moves into robotd (robot.autonomous, read back in
robot.mode and robot.state; part of v59), so the NFC autonomous_mode tag
can switch it — nfcd cannot write robotd.toml. [autonomous] enabled is
now only where each boot starts; robotctl autonomous on|off switches it
now. autod stands the robot up on the switch's rising edge, and once per
boot for the switch at boot. padd learns it from robot.mode. mapd starts
mapping the first time it sees the duck switched on.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The October brain, brought up to main. Beyond the conflicts:
- The pad's handoff (silent until touched, lets go after pad_idle_s) is
now pad_map::engage, since main moved padd's mapping into pad-map. A pad
nobody was touching going away no longer sits the robot down: the brain
was driving, not the pad.
- autod walks at the pad's [pad_drive] full stick rather than the removed
robotd_params::drive constants.
- [map]'s template values are commented out like [laser] and [soccer]:
they never shipped live, so they do not belong in EVER_SHIPPED.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the robot every autonomous kick started (`skill started
skill=kick_right`, five times) and none kicked: the head snapped to its
neutral pose and the legs barely moved — while LB/RB kicked fine.
The difference is where the kick starts from. By hand it starts from a
robot standing still and looking ahead, which is what the kick network
was trained from. Soccer started it the tick it lined up: mid-step from
the last correction, with the head pitched right down at the ball under
the beak — a state the network has not seen.
Now, lined up, the robot stands still with its head neutral for
`[soccer] ready_ms` (600 ms, `getting ready` in the readout), then
kicks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the robot it walked to the ball and never kicked, while LB/RB did —
so the kick was never asked: the ball never sat in the kick spot
(±4 × ±2.5 cm) for settle_ms in one go.
Two ways that happens, both handled. The gait sways the trunk a
centimetre or two a step even standing, and every sway out of the spot
restarted the settle: now the spot is left only past twice the
tolerances. And the last centimetres ask for less speed than the gait
walks, so the robot stops just short: within twice the tolerances for
`[soccer] stall_ms` (1.5 s) it now kicks from there.
`robot.state`'s soccer block gains `spot_m`, the ball's offset from the
kick spot, shown by `robotctl soccer` — what to read when it stands at
the ball and does not kick.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main's v54 (ssh on wifi) and soccer mode both claimed API_VERSION 54;
soccer mode moves to v55.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the robot the approach curved — walking and turning at once — and
near the ball it stopped and looked back up without kicking.
Turn, then walk: the legs only walk once the ball is within
`[soccer] align_rad` of straight ahead (near the ball, the kicking
foot's line to it), and stop to turn again past twice that.
The kick: autonomous soccer used to forget the ball and look away the
moment it *asked* for a kick, whether or not the loop started one — and
a refused skill is logged at debug, so nothing said why. The loop now
reports each soccer kick's outcome back in the same tick: started, the
ball is forgotten for the cooldown with the head left on where it was;
refused, the ball stays tracked, the reason is logged at warn, and the
kick is asked again after another settle.
And within approach_m, where the ball is under the beak and out of the
picture, it is remembered for `close_memory_ms` (10 s) rather than
memory_ms, so lining up by odometry alone does not run out of time.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reverts the BLE trigger from #572 (fe4c5ccf, 4fb1faa9) and duckctl
ssh-wifi, and keeps the rest of #572: gateway logging, the console
bridge, stale-bond handling.
ssh on wifi is a security boundary (microduck_yocto#110): once opened,
the login is the shared operator password, so anyone on the network
could log in until reboot. Opening it from a phone in Bluetooth range,
even behind the setup code, moved that decision out of the robot. It
stays where #110 put it: over the head's USB-C link (sudo touch
/run/microduck-ssh-wifi), or the dev image.
duckctl ssh's refusal message now says exactly that. API_VERSION 55, not
53: 54 shipped in 0.20.0 meaning "has openWifiSsh". A v54 client asking
a v55 configd is refused by name.
Assisted-by: Claude:claude-opus-5-5
nfc.write's default wait is 20 s rather than 30. When a write starts
waiting, the robot plays the sound it makes when it loses its pad — the
questioning quack — so whoever ran robotctl or duckctl nfc-flash hears it is
waiting for a tag. It plays before the write is handed to the poll loop, so a
tag already on the reader is asked for before its quack says it took.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`nfc.write { text, timeout_s }` (API v55) has nfcd write the text onto the
next NTAG touched to the head, or one already on the reader, as one NDEF
text record, then read it back. The robot quacks when it took. While a
write waits, a touched tag is written rather than acted on, and the tag
just written is not then read as a touch, so writing a pairing tag does
not pair.
nfcd serves it on its own socket, /run/nfcd/nfc.sock (group robot, 0660),
from threads that hand each write to the poll loop, which owns the reader.
`robotctl nfc-flash <text>` asks it there; btd now holds a fourth socket
and permits nfc.write over BLE, so `duckctl nfc-flash <text>` does the same
from a laptop. mediad refuses it: someone has to be at the robot to touch
a tag.
Only Type 2 is written. The capability container decides: a MIFARE Classic
or an e-ink refuses its READ, an unformatted or read-only tag says so, a
text longer than the tag is refused, all before any page is written. Pages
0-3 and the configuration pages are never written, so a write cannot lock
a tag. The WRITE's four-bit ACK is taken loosely — a reader may not frame
it — and the read-back is what says the tag holds the text.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Checked against microduck-image-dev.bb: it installs microduck-ssh-access
and adds a permanent any-interface drop-in on top. So the call answers
switched: true there, and changes nothing, rather than the switched:
false the docs promised.
Assisted-by: Claude:claude-opus-5-5
Three things that failed on cream-dvt after a reflash:
- open: mediad has served the console on loopback since b23644e5, so
http://<robot>:8080 could not work. open now runs a bridge on this
machine. It serves the console page on 127.0.0.1 and tunnels its
WebSocket through duck-gateway with the stored setup code, as the
app's media_proxy does. Loopback is not private: browsers apply no
same-origin policy to WebSockets, so a connection is tunnelled only
with a per-run 128-bit token in its path and this page's Origin.
--port is gone.
- ssh-wifi sends system.openWifiSsh. ssh now names the cause when a
shipping image refuses port 22, instead of leaving a bare "Connection
refused".
- scan ignores devices BlueZ remembers but has not heard in this scan.
A bond from before a reflash showed up as a second cream-dvt at an
address the robot had left days before. The connect-failure hint now
names the stale bond and the bluetoothctl remove that clears it.
Docs: webrtc-console.md §2.2 owns the bridge; duckctl.md links to it.
Assisted-by: Claude:claude-opus-5-5
A robot with a setup code refuses the PIN and serves only a client that
proves the key in the Noise handshake btd/src/secure.rs answers. duckctl
now speaks it:
- `duckctl setup-code add|list|remove` keeps codes in
~/.config/duckctl/setup-codes (0600), filed under the robot id and any
name the robot was reached under; `duckctl name` adds the new name.
- A command against a robot with a stored code runs the handshake from
duck-auth instead of the PIN, and seals/opens every line after it.
- A wrong key fails after 5s with a message naming it, rather than a
15s "no reply".
- On Linux, a pairing agent for the length of the command, consenting
for the robot being connected to only. Without one BlueZ refused the
just-works bond ("No agent available for request type 2") whenever no
desktop agent was up.
Tested against cream-dvt (daemon 0.19.0, secure mode): fresh pairing
with an external agent, handshake, system.info, and the wrong-key path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tags are NTAG215s, which the Type 2 path already reads, and the
e-ink display is told by its SAK alone (ISO 14443-4), with no Crypto1.
So the Crypto1 cipher, the MIFARE Classic reader and the ST25R100's raw
framing go: st25r100.rs and reader.rs are back to main's. What stays is
the SAK from selection, and a Classic touched to the reader is said once
in the journal instead of retried as an NTAG.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The tag puts the robot in walk and switches soccer mode on by hand —
the bumpers kick, D-pad down plays — rather than starting autonomous
play: a robot that sets off after a ball the moment a card touches it
surprises whoever holds it. Every other mode tag switches soccer off,
the rule the laser already followed; both switches go through one
`Switch` so the next one is a line.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two switches in robotd, set by `robot.soccer {active, autonomous}`:
- soccer mode: the pad's LB/RB run kick_left/kick_right whatever they
are bound to, and D-pad down starts autonomous play instead of
body + head;
- autonomous: the robot turns until it sees the purple ball, walks to
it, steps sideways until the ball is in front of the foot on its
side, kicks, and looks again. Any pad button takes it back to manual,
and that press does nothing else. A pushed stick wins over it, as
over the laser.
mediad finds the ball (`media.ball`, beside `media.laser`, sharing its
look loop): purple is the hue with both chromas above grey; passing
cells on a 4x4 grid are grouped into blobs, and a blob is the ball when
big enough, filled and round — a ball cut by the frame's edge keeps its
centre and radius from its uncut sides. Every look carries the most
purple colour seen, passed or not, for tuning. robotd projects the
centre onto the plane a radius above the floor with the laser's own
projection, now shared, and carries it by odometry through the last
steps where the ball is under the beak.
The pads learn soccer mode from `robot.mode`, which they already poll
each second — so an NFC tag switching it reaches the pad. Soccer and
laser tracking switch each other off. `[soccer]` holds the detector
thresholds, the kick spot and the gains, all live; `robotctl soccer
on|auto|off` switches it and is the tuning view; the web console draws
the ball.
API_VERSION 54: `robot.soccer`, `robot.mode`'s `soccer`,
`robot.state`'s `soccer` block, `media.ball` / `media.ballSeen`.
Colour thresholds are a first guess; to be tuned on camera images.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Laser tracking landed in main as robot.laserTrack, a switch on top of
whichever mode runs rather than a robotd mode. laser_mode now puts the
robot in walk and switches it on; walk_mode and roller_skating_mode
switch it off first, so a tag is the mode the robot is then in. A robotd
without the method refuses it, which is logged and does not stop the
walk or roller switch.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A MIFARE Classic selects as ISO 14443A and is told apart by its SAK, then
refuses the Type 2 READ: every sector opens only after a Crypto1
authentication, and from then on its bytes and parity bits are encrypted.
The ST25R100 has no Crypto1, so the cipher runs here and the chip is
driven with parity and CRC off, sending and receiving raw 9-bit groups
(a_tx_par/a_rx_par clear, fifo_lb for the received bit count).
The card is read the NFC Forum way: the MAD in sector 0 with key
A0A1A2A3A4A5 says which sectors are NDEF, each opens with the public
key D3F7D3F7D3F7, and their data blocks are the same TLV area a Type 2
tag has. A card that refuses those keys is not NDEF-formatted and is
said once per touch rather than retried.
Not yet run against the board's reader: st25r100_classic is the bench
tool for that. The CLRC663 path reports such a card as unreadable.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
While the EEPROM holds something that is not a valid code, export uses
no key at all, so a key installed beside it would be reported as
installed and never used. Refuse with the EEPROM's error instead, and
document that such a robot stays reachable over Bluetooth with its
label PIN.
Assisted-by: Claude:claude-opus-5-5
The EEPROM line is now <label serial>:md1:<first name>:<64 hex>, with
the code from offset 19, and the QR printed on the robot carries that
whole line. A colon after the serial with no code, or a code with no
colon (the previous layout), is an error rather than a code read one
byte off. `robotctl system setup-code` shows the same line, so a dev
board's QR goes through the same app path as a factory label; at
error correction L that is version 5, 82 columns at worst.
Assisted-by: Claude:claude-opus-5-5
The factory writes the setup code into the robot's ID EEPROM with an
external programmer, after the 18-digit label serial:
md1:<first name>:<64 hex>, the same string as the QR printed on it.
robotd-params::label decodes it.
configd's unit runs `robotctl system setup-code export` before it
starts: it takes the EEPROM's code (or a dev board's installed key),
refuses one whose id is not this robot's first name, and leaves the key
in /run/credstore. btd and duck-gateway are ordered after configd and
ImportCredential=ble-psk, so secure mode follows the robot with no
drop-in; without a key btd serves the PIN path and the gateway exits
cleanly. The gateway gains an [Install] section.
`robotctl system setup-code` shows the code and where it came from;
`install` is now for dev boards with nothing in the EEPROM. The factory
doc's sequence becomes: read the first name, generate a random key,
program the EEPROM, print the QR, verify against the printed label.
Assisted-by: Claude:claude-opus-5-5
On the stress test, cream-dvt-antoine broke about 6 times fewer gearboxes per km
than the stock robot with the guard on, but about half its falls were its own,
against 8-14 % on every other robot, on V3 and V4 alike. Until that is explained
bus.impact_guard ships off, so the code is merged and an update that sets it is all
a robot needs. Off is V4's switch at 0 and never-firing settings on V3; Current
Limit stays 1000 mA either way. Off is now every robot's normal state, so saying so
at start is info rather than a warning.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Measured on a face-board-v1, each look costs about the same — ~5 ms of
scan plus a 1.8 MB frame copy — so the search cost is the rate: 3 Hz was
3.4% of one core in mediad. 1 Hz is about a third of that, for up to a
second before a dot is first noticed; tracking still starts at
`track_hz` from that look.
The two staleness timeouts sized for 3 Hz — robotd's DOT_STALE and the
console's overlay timeout — go to 2.5 s, so one look a second (each of
which may wait half a second for its frame) is not read as a stall.
Assisted-by: Claude:claude-opus-5-5
Every look mediad's laser detector takes is now also broadcast to the
WebRTC peers as `media.laserDot`, on the control channel the duck boxes
already use. The console draws a red ring on a dot that passed and a
dashed amber one on a candidate rejected for its size, and puts the peak
colour in the stats row — the number `[laser]`'s thresholds are tuned
against, now visible beside the picture that produced it.
`LaserDot` gains `frame` (the upright picture's size) and
`candidate_px` (where a near miss was), so a display needs nothing
about the camera or its mount. Additive, inside the unreleased v52.
Looks are still only taken while robotd has tracking on.
Assisted-by: Claude:claude-opus-5-5
Comments across uyvy, mediad, robotctl and the console said the head
camera "is mounted a quarter turn off". That is the Zero 3W; the beta
boards' GC2093 is upright, and robotd_params::board owns the mount.
mediad/src/camera.rs also still said the GC2093 had no calibration,
though CameraIntrinsics::beta ships for beta and face-board-v1.
Wording only, plus a duck-detect test for the landscape letterbox —
the beta boards' real case, which had none.
Assisted-by: Claude:claude-opus-5-5
Ported from the prototype runtime, rebuilt for the daemon split.
mediad finds the dot (`media.laser`, a local subscription on media.sock):
it scans frames the tee already hands out, at the stream's own
auto-exposure, so the video is untouched. It looks at `search_hz` until
it sees a dot and `track_hz` while it does, and publishes a direction —
a ray in the upright camera frame, intrinsics and board mount undone —
plus the colour of the best candidate whether it passed or not.
robotd projects that ray onto the floor through head FK, the IMU and
odometry, points the head with the existing look_at IK and walks to the
spot. Each half is taken only while no client wants it: a pushed stick
always wins, and with no dot in sight the robot does what it was told.
`robotctl laser-track on|off` switches it, and its live view is the
tuning tool. `[laser]` in `robotctl configure` holds the thresholds,
rates and walking gains; every key applies live, `enabled` included.
API_VERSION 52: `robot.laserTrack`, `robot.state`'s `laser` block,
`media.laser` / `media.laserDot`.
Assisted-by: Claude:claude-opus-5-5
The id in a setup code (md1:<id>:<key>) was whatever an operator passed
to btd's --secure-robot-id and the gateway's ROBOT_ID, so nothing on the
robot could print a QR for it. Use the robot's first name instead: the
duck-xxxx default name derived from the SoC serial. It moves from
configd into robotd-params::serial so configd, btd, duck-gateway and
robotctl all derive the same one, and a rename changes none of them.
robotctl system setup-code install reads the 64 hex characters on
stdin, refuses a missing data mount and an existing key without --force,
and commits the file root-only and atomically; it never prints the key.
robotctl system setup-code shows the md1: line and a QR on the terminal.
The robot never generates its key: the station does, per
factory-provisioning.md.
btd --secure-robot-id, duck-gateway --robot-id, ble-gateway.env and
scripts/generate-ble-dev-credential.sh are gone. A btd drop-in still
passing --secure-robot-id fails to start after this; remove the flag.
Assisted-by: Claude:claude-opus-5-5
With pairing required, a phone bonds with the robot. Forgetting the
robot in the phone's Bluetooth settings drops the phone's keys but not
the robot's, and BlueZ's default JustWorksRepairing = never then refuses
the phone's fresh just-works pairing: PIN or Key Missing (0x06) until
the bond is removed on the robot over ssh.
Set JustWorksRepairing = always on every board. The bond is encryption,
not identity, so nothing is given away. Measured on a face-board-v1
beta with an iPhone: refused twice under never, re-paired with no
robot-side step under always.
Assisted-by: Claude:claude-opus-5-5