Commit Graph
48 Commits
Author SHA1 Message Date
apirroneandClaude Opus 5.5 7bc9fb2e26 Merge autonomous-mode (autod) into autonomous-revive: the brain is API v59
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>
2026-11-12 17:01:35 +01:00
apirroneandClaude Opus 5.5 5076bb6542 Merge maploc-v2 (maploc, mapd) into autonomous-revive: map.* is API v58
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:52:01 +01:00
Thomas Wolf c820cace8d docs: propose factory secret provisioning over Recovery USB 2026-11-09 00:58:39 +01:00
Fabien Danieau 08cdd65191 updater: anonymous usage telemetry to PostHog, with an opt-out
Same design as Reachy Mini's daemon. updaterd sends daemon_started,
update_result (on a version change) and daily_heartbeat to PostHog EU,
with a random robot id, the board, versions and arch. On by default;
telemetry.status / telemetry.set (API v47) are the owner's switch,
routed over BLE and WebRTC, and the console drawer has a checkbox.
Off forgets the id. MICRODUCK_TELEMETRY=0 or DO_NOT_TRACK=1 forces it
off; duck-sim sets the first.

The PostHog key is still empty, so nothing is sent until a microduck
project exists. docs/robot/telemetry.md owns what is and is not sent.

Assisted-by: Claude:claude-opus-5-5
2026-10-30 10:12:01 +01:00
apirroneandClaude Opus 5.5 f7e2f10949 Merge origin/main into maploc-v2
main took API v42–v44 for the vet book, so map.* moves to v45. netpadd
joins mapd in the release units, the restart order and configd's MANAGED
list (now ten); the Call variant count is 77 with both sides' routes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 10:10:35 +02:00
apirrone 66384dd6ba mapd: the onboard map as a service, map.* (API v42)
mapd subscribes to robot.state and tof.frame like any client, feeds the maploc
mapper on its own thread, keeps the map in /var/lib/mapd/map.json across
reboots, and answers map.status, map.stream, map.grid and map.wipe on
/run/mapd/map.sock. It commands nothing: the robot walks without it, and the
head moves by robotd's own idle glances.

The map file is replaced atomically, saved every autosave_s, when the pose has
moved 30 cm and on shutdown; a file it cannot read is set aside as
map.json.bad-<secs>, never overwritten.

[map] in robotd.toml (on by default); robotctl map / map show / map wipe;
routed over WebRTC by mediad, refused over BLE. Packaged in both release
workflows and dev-push, named in install.sh, configd's unit list and
updater.toml. docs/design/mapping-design.md owns the mechanism.

Checked end to end against a recorded living-room session served over real
sockets: same 21 stops as the offline replay, saved on SIGTERM, and after a
restart relocalized within four stops onto the first run's nodes (2-3 cm).

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 16:16:02 +02:00
drenayazandClaude Opus 5.5 fc2cc40a13 docs: the pad over UDP — udp-pad.md owns it
The page owns turning it on, the wire format and the sender's rules; the spec's wire table
becomes a link. restart-order.md names netpadd in the install and skew lists. robotctl configure
now maps [netpad] to a restart of both netpadd and padd, which the registry-completeness test
had been failing on since the keys were added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 11:48:20 +02:00
apirrone fe427c7690 bring back autonomous mode 2026-10-01 12:57:18 +02:00
Pierre Rouanet 8672bdecad docs: the phone app, now that it is built
This page was written before the first line of the app so the decisions would
be arguable rather than implied by a repo. The app exists, so it now describes
what it is built from rather than what it might be, and points at
`pollen-robotics/microduck-app` for the code and the operational half.

Most of the reasoning survived contact with hardware and stays: the protocol in
Rust, BLE as the permanent channel rather than a setup step, the session layer
as the app's actual core, and Reachy Mini as a reference rather than a base.
Three things changed enough to be worth reading again.

**The session layer turned out to be testable.** §8.2 of the robot page says
the scenario worth testing is not testable off a board — true of three robots
in a room, and not true of a link that drops. `blec` ships a mock that drops
one on demand, and those tests have caught three real defects.

**The version floor is the opposite of the daemon's rule**, and now says so.
The daemon reports a version difference and never refuses; the app refuses
below robot 0.14 at the handshake. That is a different trade, deliberately, and
the cost is named: a robot below the floor cannot be updated from the phone.

**And the app has now tested the property §3.1 exists to give**, four times.
`update.rollback`, `update.select`, `robot.init` and `robot.enable` were each
opened because using the app found the refusal costing something the refusal's
own reasoning had not accounted for. Those, the 512-byte ceiling and the pad's
third fault move from "what the robot owes" to what using it settled.

The spike section goes. It ran, it answered what it was for, and it was thrown
away as intended — what it found lives in §3.6 of the robot page and in the
rows above.

Assisted-by: Claude:claude-opus-5
2026-09-17 15:01:23 +02:00
Pierre Rouanet 9aec85a62a docs: the phone app, before the first line of it
`app-path-design.md` covers the robot half of the app path and says almost
nothing about the client. This adds `docs/design/mobile-app.md` for the other
half, and links the two.

The protocol belongs in Rust: `tauri-plugin-blec` exposes the same handler to
Rust as to JS, so the app can depend on `duck-ipc-proto` and `btd::framing` and
drive the radio from the Rust side, which makes it unable to drift from the
daemon. `duckctl` is the proof, and the caveat — depending on `btd` for one
module pulls tokio, clap and tracing-subscriber with it.

Bluetooth is the permanent channel, not a setup step. Reachy Mini's BLE code
runs once and hands over to the LAN; ours is where the robot's interface lives,
so the app needs a session layer that reconnects and re-authenticates silently.
That layer has no counterpart to copy.

A phone spike comes before any screen. §5.5 is the blocker and it is still a
fact about CoreBluetooth on a laptop.

Assisted-by: Claude:claude-opus-5
2026-09-14 14:10:29 +02:00
Pierre RouanetandClaude Opus 5 2dd630ad42 docs: WebRTC is the default transport, and a FAQ that says so
Three things this repository could not tell somebody who wanted to run a model
too heavy for the board.

There was no page about it at all. `spaces/` appears nowhere under `docs/` —
not in the index, not linked, nothing. The only writing was a Space card
published to Hugging Face and a lot of source comments.

What writing existed argued the wrong way. `media.stream` was built when the
relay endpoint was dead and WebRTC genuinely could not connect from a data
centre, so `stream.rs` made its case at length and, once the dead-endpoint
premise was removed, read as though outbound frames were the preferred design.
They are not. WebRTC carries encrypted media, a control channel on the same
session and a return path; `media.stream` has none of those and exists for a
program consuming frames only on a long-running stream, where a relay's metered
bandwidth is the cost that matters.

And nothing recorded the rule for whoever changes this next, which is how it
would have been re-derived backwards from the volume of prose in `stream.rs`.

So: `docs/faq.md`, task-shaped rather than linear, because somebody arrives at
this with a situation and not a curiosity. `AGENTS.md` with `CLAUDE.md`
symlinked to it, carrying the transport rule and three others. `stream.rs`
demoted to the fallback it is, with what it gives up stated rather than implied.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 13:24:44 +02:00
Pierre RouanetandClaude Opus 5 6944e8f4d0 The head IMU is off until something reads it
Reading the BMI088 at 100 Hz costs ~3.5-4.5% of a core on this SoC, from boot,
on every duck with the head module -- for a stream nothing in the tree
subscribes to. `bench_imu` takes the loop apart at 100 Hz with the bus to
itself:

    sleep only  (0 reads)   cpu  0.69 %
    filter only (0 reads)   cpu  1.00 %
    update      (2 reads)   cpu  3.35 %
    update_all  (2 reads)   cpu  3.86 %
    three-reads (3 reads)   cpu  4.20 %

Wakeups are 0.69 points, the Madgwick fusion adds 0.31, and the rest is the two
I²C transactions a sample takes. A gyro sample and an accelerometer sample *are*
twelve bytes at two addresses, so a full sample cannot cost fewer than two
transactions and there is nothing in the loop left to fix. (`update` and
`update_all` do identical work and differ by 0.51, which is the noise floor.)

So the switch, rather than an optimisation. `[head_imu] enabled` lives in
`robotd.toml`, read through `robotd-params` exactly as `mediad` reads `[media]`
-- one schema, so `robotctl configure` writes the key this daemon reads, and it
offers the tofd restart. `tofd --imu` reads the chip for one session without
touching the file; `--no-imu` still forces it off; `--imu-hz` trades rate for
cost linearly, which is the one lever left.

A subscriber while it is off gets a sentence naming the key, not the silence a
board with no sensor fitted gives: those need different fixes and they are the
same absence of frames. `ImuStatus::off` is that sentence and a test pins it.

Depth is untouched. tofd ranges the ToF whether or not anything subscribes, so
`robotctl monitor`'s grid works on a duck whose IMU has never been on.

`docs/project/tof-on-demand.md` carries the measurements and what they closed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-09 16:14:54 +02:00
Pierre RouanetandClaude Opus 5 510394ef5a The board says it is the IMU, not the laser
`ps -L` on olducky, idle, nothing subscribed: `head-imu` 4.5% of a core,
`tof-sensor` 0.5%, the socket runtime 0.0. So `tofd`'s ~5% in top is nine
parts head IMU to one part depth, and the spec's main proposal -- gating
ranging on a subscriber -- was aimed at the half percent.

Rewritten around that. Gating the ranging and starting/stopping the unit are
both closed, with the numbers that close them, and the theremin keeps its
startup subscription because there is no longer a laser to pin on. What is
left is the head IMU: 4.5% of a core, nearly all of it I²C wait rather than
Madgwick, read at 100 Hz from boot for a stream that has no consumer in this
tree. It opens on the first subscriber and closes after the last, which needs
the subscribe answer not to say "no BMI088 fitted" while the chip is opening.

Also written down because it is the thing that made the 5% look load-bearing:
the walk policy's IMU is a different chip on a different bus -- the
`imu_to_dxl` board on the Dynamixel bus, read in the 50 Hz sync_read with the
fifteen servos -- so nothing in here can cost the policy a sample.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-09 15:45:20 +02:00
Pierre RouanetandClaude Opus 5 93b7e212ee Spec: the head sensors when nobody is looking
`tofd` ranges a laser 15 times a second and reads an IMU 100 times a second
from boot, subscribers or not, and the poll work in idle-cpu.md left the
question of why it polls at all open. This writes down what gating it on a
subscriber would take.

The change as posed -- a client starts tofd.service and stops it after -- is
the wrong one, and the doc says so with the reason: `Sensor::open` uploads
~90 KB of ULD firmware over I²C, per process, taking seconds, so every
session would open on a blank grid and a theremin could not arm until the
upload finished. Three more counts against it, and socket activation is
named as the right mechanism for a different goal.

What the daemon can do instead is hold the open sensor and gate *ranging*,
which is one transaction each way. That needs a subscriber count that means
what it says: `accept` currently subscribes a connection to both channels
before reading the request, so a client that wants the IMU -- or that says
nothing at all -- holds a depth receiver. That is step one and it is a bug
fix whatever gets decided about the rest.

Also written down: the head IMU is the biggest of the three numbers and has
no consumer in the tree at all, the theremin's startup subscription would
pin ranging on for the ducks that play notes, and the one hardware
assumption the design rests on -- that stop/start ranging does not re-upload
firmware -- has never been tried on a real VL53L8CX.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-09 15:35:18 +02:00
apirroneandClaude Fable 5.1 1ab6f20974 docs: how to use the simulated duck, linked from the README and the index
docs/robot/simulation.md is the user's page — what --sim is, what it is good for and cannot tell
you, the one-duck and container forms of scripts/duck-sim, scenes and cameras, every knob, and the
traps (real time, no hot-join, --sim vs --fake). design/simulation.md stays the design, and its
status paragraph no longer says the containers, ether and camera are unbuilt. Both pages are now
in docs/README.md, which had listed neither.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-08 09:36:26 +02:00
Pierre Rouanet 2f7812086e Merge main: #191 landed, so v22 is robot.skills and the account takes v23
The version is the whole of the conflict. This branch was written when the policy
channel's five were still in flight and took 22 for `account.*`; #191 landed
first, so 22 is `robot.skills` and the account block moves to v23 — with
`btd::route`'s pointer at that note moving with it, since a comment naming the
wrong version is worse than none.

Main's v17 entry comes back with the merge: this branch predates the base's own
merge of main and had dropped it.

And one sentence in §2.6 was claiming more than the mechanism does. "That grants
`mediad` exactly what its route table permits and nothing more" is not what
`allow_users` is: it gates the caller, not the method, so `updaterd` will perform
any mutating call `mediad` makes, `update.apply` among them. What stops a remote
peer is `mediad`'s route table refusing to relay it — which makes that table the
only narrowing there is, on the process most exposed to a stranger's traffic.
That is the same shape `btd` has had since BLE could apply an update, and the
named list with a test is the same answer; a per-method gate in `updaterd` is
what would make it two layers, and this now says that choice was made rather
than missed.

Assisted-by: Claude:claude-opus-5[1m]
2026-09-03 14:24:34 +02:00
Pierre Rouanet 29dfef5a0f Merge main: main took v17, so the policy channel's five move up
Both sides spent `API_VERSION` 17 — main on `UnitState`'s `Restarting` and
`Failed`, this branch on `robot.policies` and `robot.loadPolicy`. Main's is
released, so it keeps the number and the policy channel's entries become v18
through v22, with the two docs that quote the bump moving with them.

The `padd` conflict is only adjacency: the `--config` argument this branch adds
sits on the line above the `hz` doc comment main reworded.

Assisted-by: Claude:claude-opus-5[1m]
2026-09-03 11:20:27 +02:00
Pierre Rouanet 068e8e2245 The manifest contract has an owner now, so §9.4 goes
`docs/policy-manifest.md` arrived from the schema-2 work and says what it is:
"§9 has the reasoning; this file is the contract." §9.4 was written before it
existed and was the contract — the whole manifest inlined, every field, the
publishing steps — so the two now describe one mechanism from two places, which
`docs/README.md` names as the failure that put six documents in agreement about
something none of them was right about.

§9.4 is gone. §9.3 keeps the reasoning that lives nowhere else: why the manifest
is on the Hub and not in this repository, and the two hardcoded lists whose
removal is the point of it existing. Its two duplicated tables — the three kinds
and the encodings — go with the section; what is left is the one sentence that
explains why the mechanism is there at all.

The inlined JSON deserves its own note. I argued in §9.3 against a checked-in
copy of the manifest, because a test over a copy passes while a board downloads
something else — then pasted the copy into §9.4 two sections later, where it can
go stale in exactly the same way and did: it was schema 1. The new page links
the live file on the Hub instead, which is the version of that argument I should
have followed the first time.

The publishing steps stay in the cheat sheet, which is where steps belong, now
pointing at the contract rather than at a design section. And the new page is in
`docs/README.md` — it was reachable only from prose, which for the page a
publisher needs first is the wrong front door.

Assisted-by: Claude:claude-opus-5[1m]
2026-09-02 17:48:01 +02:00
Pierre Rouanet 33294d13a5 Reaching a duck that is not on your LAN needs an account first
`remote-webrtc.md` §7 has said since it was written that the remote path is a
bridge to the signalling server already running on the robot, and that whether
we adopt reachy-mini's Hugging Face Space and how a robot is bound to an account
were out of scope "until local mode works". Local mode works.

So this designs the two things that shape needs and does not have: a credential
that names an account, and a service to present it to.

The account is an OAuth **device** flow, not the redirect flow reachy-mini runs.
That is not a preference — its flow points HF's callback at a URL on the robot,
which costs a registered redirect URI per hostname, requires the authorising
browser to resolve and reach the robot, and is why its mobile app carries a
loopback HTTP bridge whose stated purpose is avoiding an HF-side config change.
The device grant asks HF for a code, says "type M8HJ-FMGN at hf.co/oauth/device",
and polls. A phone on cellular can do it.

Established by probing the live services rather than by reading about them:
HF advertises the device grant and the full round trip short of the user's click
works today; the client must be public, so reachy-mini's confidential client id
cannot be reused; the rendezvous Space is live and 401s without a token; and its
wire is the gst envelopes over HTTP — SSE in, POST out — with per-hop ids, not
the WebSocket protocol a LAN client speaks.

That last one corrects §7 in this repository, which said the bridge "parses
nothing" and is "a relay rather than a translator". The payload stays opaque; the
envelope does not. Fixed there, with the two sides side by side in the new page.

Four decisions are open and named with who can close them: the OAuth client id
(one public app in the org, no secret — an admin's click), whether the token
expires (one real authorization, then read the response — a click), which
rendezvous, and where the remote client is served. The order of work puts the two
slices that need no client first, because both are verifiable on their own.

Assisted-by: Claude:claude-opus-5[1m]
2026-09-02 17:36:20 +02:00
Pierre Rouanet 4a6b68e18c What the daemons do when nobody is asking them to
The four changes on this branch, the two candidates that were measured and left
alone, and — for every figure — where it came from.

The declines are the reason this is worth writing down. The 50 Hz sync-write of
sixteen goal positions looks like obvious waste on a parked robot, and it is
0.075% of a core: 94 bytes and one `write(2)` per tick, against a bus already at
a quarter utilisation where the tick's own sync-read is four times larger.
Making it conditional means enumerating every path that can invalidate a servo's
stored goal, and being wrong means a robot that stops holding its pose. The
next person to notice the write should find the arithmetic rather than redo it.

Same for the `#[tokio::main]` worker pools, which look like twelve threads doing
nothing across three daemons and are exactly that — parked, measured at 0.00 s
of CPU over 20 s against `current_thread`'s 0.00 s. The difference is stacks,
not heat, and `current_thread` would cost something real in `updaterd`, which
has synchronous file work on its async path.

And it says plainly that nothing here has been near a board: every number is
arithmetic on a packet layout or a frame size, or a measurement on a laptop.
The last section is what to run on hardware and what would change the answers.

Assisted-by: Claude:claude-opus-5
2026-09-02 15:41:11 +02:00
Pierre Rouanet 2f836de667 Docs for what a robot can now be asked to do
The commands landed one at a time and the documentation did too, so the cheat
sheet had five policy subsections filed under "Configuring the robot" — the
section about the TUI editor — in the order they happened to be built. Two of
them were wrong by the time the next one landed: `policy add` was documented
nowhere at all, and the advice for running a community one-shot still said to
put it in the walk slot, switch the standing network off and drive it from a
script, which was true this morning and has not been since it could be a skill.

"Policies and skills" is now its own section, ordered as somebody actually
arrives at it: what is running, a newer official set, your own file, somebody
else's, adding a skill, putting it on a button, and putting it all back. The
gamepad section points at it rather than repeating a button list that is now
config.

The ideas note graduates into `policy-channel-design.md` §10. `docs/ideas/` is
for thinking written down before it has a design; this has one now, and the
design doc is where a page that owns a mechanism belongs — §10.1 on who supplies
a policy's ending, §10.2 on what stays in the daemon and why, §10.3 on the
button. Four decisions added to the table and two items to what is open: a
running skill has no fall reflex, and `configure` lists the skill table without
editing it.

Assisted-by: Claude:claude-opus-5[1m]
2026-09-01 17:55:00 +02:00
Pierre Rouanet 602d293150 What happens when you press a button, written down before PR2 changes it
A holding-pen note, not a design. Adding a one-shot move touches seven places
today, and a community policy that is the same shape as roulade — zero command,
four seconds, selecting it is the trigger — still cannot be added without a
release. Before changing that it is worth having the current picture somewhere
other than in six files.

The thing worth separating, and the reason for writing it out: there are three
layers, and only the third is what a move list touches. padd's modes and its
compiled-in button table; robotd's bring-up and limp-fall machines, which decide
*whether* a policy drives; and the select cascade, which decides *which* one. The
first two know nothing about which policy is running.

It also settles a premise I had wrong: one-shots already run on top of walk and
stand with nothing disabled. The eviction a community policy needs today is only
because it goes into the walk slot — the fallback itself — rather than into the
cascade.

Assisted-by: Claude:claude-opus-5[1m]
2026-09-01 13:17:38 +02:00
Pierre Rouanet 15d41d4dee The policy channel has a design, so the pages that guessed at it stop guessing
Three questions were open every time policies-on-the-Hub came up: whether a
policy that is not ours may run at all, what "try one" does to a robot that
then reboots, and how many components nine files trained together should be.
They are answered in docs/design/policy-channel-design.md — origin decides
trust (pollen-robotics is official, everything else is community, local paths
are neither), load and reset are a config edit plus a live reload rather than
a new persistence mechanism, and the set ships as one component because it is
trained as one.

Two design pages disagreed with that and now point at it instead. robotd-design
§2.3 keeps what a policy is and how it is validated; which file fills a slot is
no longer implicitly its business. updater-design §5.5 keeps the general rule —
a component is a thing with its own version line — and says the control
policies took the other branch of it, so the model-walk/model-jump sketch reads
as illustration rather than as the plan.

Nothing behavioural. robotd-design's description of where policy files come
from is left alone because it is still true: they do come from the release
directory, and slice 2 is what changes that.

Assisted-by: Claude:claude-opus-5[1m]
2026-08-31 11:56:50 +02:00
Pierre Rouanet 8791b145b4 The install-path rule, reachable from where it gets broken
§9.1 was written the day after the fourth instance of the thing it forbids merged,
and would not have caught it. Two reasons, both in the docs rather than in the rule.

**It had one inbound link, from the paragraph above it.** Every pointer in the tree —
`hooks/postinstall`, `updater/src/engine.rs`, `updater/src/robot.rs`, four design docs,
the docs index — goes to `install-path-gap.md`, a closed retrospective that then
forwards to §9.1. A reader has to know to take the second hop, and nobody editing
`install.sh` was ever on the first. The hooks and the index now name the rule; the
retrospective says outright that it is the story and §9.1 is the rule.

**And "needs" is a judgement that let the case through.** A snippet putting the robot's
name in the prompt is not something a release *needs*, so it went into `install.sh` and
nowhere else, and a board that has only ever updated does not have it. §9.1 asks the
mechanical question instead — does `scripts/install.sh` write this file or run this
command — which can be answered by grepping one file. The heading changes with it.

The fourth instance is written down, including the way it looked correct while it was
being written: `install_completions` and `install_login_banner` sit on the two lines
above `install_name_prompt` and have the same gap, so the surrounding code read as the
pattern. Three functions in a row that only a fresh install runs are not a precedent.

`install.sh` now says this at that call site, which is the one place all four authors
would have been standing.

The corollary list grows the one the other three are instances of — anything a fresh
install does to a board, a hook does too — and says plainly that it is the only one
without a test, and the only one that would have caught all four.

Assisted-by: Claude:claude-opus-5
2026-08-27 16:13:57 +02:00
apirrone 1207c0d74d The duck detector on the NPU: a binding, a decoder, and a benchmark
A trained detector exists (yolo11n at 320, one class, mAP50 0.976 on a
held-out session, 3.9 MB quantised) and nothing on the robot could run it.
This is the three things between a camera frame and a bounding box, plus
the tool that measures them on a real board.

`dlopen`, not link. librknnrt.so is a vendor blob in no Debian suite, and a
crate that linked it could not be cross-compiled in CI at all — robotd
reaches ONNX Runtime the same way, for the same reason. The cost is one
file of transcribed ABI; the benefit is that `cargo board --bins` still
works on a laptop, which it does.

Four things in here are where this goes wrong quietly rather than loudly.
The head is `[1, 5, N]` **planar** — every cx, then every cy — and read as
five-per-box it produces boxes that are almost plausible, which looks like
a bad model rather than a bad reader. It suppresses nothing, so one duck is
twenty overlapping boxes until the decoder does. The letterbox has to match
what training did, padding included. And the sampler folds the camera's
mount rotation into the resample it is already doing, because rotating in
the pipeline costs the encoder its zero-copy path — 8 fps and 97 °C, which
is the branch before this one.

Three ABI values were guessed wrong and only a board could say so, so they
are now comments rather than constants anybody has to rediscover:
`rknn_query`'s INPUT_ATTR is 1 and OUTPUT_ATTR is 2 (swapped, it answers
about the output and complains it cannot make sense of `[1, 5, 2100]` as an
input); SDK_VERSION is 5; and **NCHW is 0 while NHWC is 1** — backwards,
`rknn_inputs_set` logs a normalize error and *returns success anyway*, so
inference runs on an unset buffer and reports two confident boxes on every
frame for ever. The struct-offsets test caught two more of my errors before
the board did.

`duck-bench` answers three questions in order: does it run, does it still
see ducks (a model that runs and detects nothing looks exactly like one that
works), and what does it cost — latency percentiles, CPU, and the SoC
temperature, because running it flat out took the board to 95 °C and the
CPU to 408 MHz. It paces at 2 Hz for that reason; `--hz 0` finds the
ceiling deliberately.

`scripts/setup-npu.sh` installs the runtime at a pinned tag and reports on
the driver, which is the real gate: Armbian ships `npu@fde40000` as
`status = "disabled"` on this board, and the only overlay it offers is one
that disables it further. `--enable-node` writes the one-property overlay
(deploy/overlays/), never reboots, and says how to undo it. The pin agrees
with Cargo.toml by a test.
2026-08-27 11:58:21 +02:00
Pierre Rouanet b315ae46bb docs: make the reference pages describe the seven daemons that exist
Six crates and two daemons landed after the pages that describe the system
were written. `mediad` and `tofd` ship units with `[Install]` sections;
`kinematics`, `odometry`, `sounds`, `pet-detect` and `robotd-params` are
libraries `robotd` drives. The docs still said five daemons and `mediad`
not built.

The one that would have cost someone an afternoon is `restart-order.md`:
it named `configd, padd, robotd` as the restart set, which is the page you
read while diagnosing a version skew. It is `configd, mediad, padd, robotd,
tofd` — derived from shipped units, exactly as that page's own rule says,
and `deploy/updater.toml` had said so for two releases.

Also:

- `architecture.md`: the overview and the diagram, which still boxed
  `mediad` as not built while §1's own table described it.
- `robotd-design.md`: odometry left the deferred list — `monitor`'s path
  map reads it now, which was the objection. New §4.4 for it, and §4.5 for
  the voice, theremin, chorale and pet detection, saying why none of them
  earns a design page and where each one's reasoning lives.
- `CONTRIBUTING.md`: 508 tests was 936; 13 board checks were 60. Neither
  Linux nor macOS builds `cargo test --workspace` out of the box any more —
  Linux wants libudev and GStreamer, and `tof` does not compile on a Mac at
  all. Both written down, with the commands.
- `roadmap.md`: M5 is in progress rather than unstarted, and the crate
  layout defers to CONTRIBUTING rather than keeping a second copy.
- `docs/README.md`: `pad-minimal-pairing.md` and the whole `ideas/`
  directory were off the index.
- `cheatsheet.md`: the monitor's 3D robot view, its ToF contact points and
  the odometry path map were documented nowhere. `d`, `[`, `]`.
- `_build-release.yml`: a comment claiming `mediad.service` has no
  `[Install]`, two releases after it grew one.
- two dead links: `updater.example.toml` from `updater-design.md`, and
  `README.md#drive-it` from `pair-a-gamepad.md`, whose target the README
  rewrite removed.

Assisted-by: Claude:claude-opus-5
2026-08-26 16:35:17 +02:00
apirroneandClaude Fable 5 e4a2a3b6b0 A README for the front door, and the technical tour moved to its owners
The README was 354 lines of walkthrough — the health output annotated, the
monitor screen explained, how to cut a release — for a repo that is now
where somebody lands after reading about the robot. It was also mostly a
second copy: the cheat sheet's monitor section is strictly richer than the
one here was, cheatsheet-dev owns branch builds and candidates, and
CONTRIBUTING owns releasing. Per the docs' own rule, the page that does not
own the mechanism is the bug.

So: a landing page, ~120 lines. What the duck does, with a placeholder per
shot; three commands to say hello; then two tables that point at whoever
owns the answer. It links the website (which links back), and says plainly
that this repo is the brain and the website is where you get a robot.

The two things here that lived nowhere else moved rather than died:
driving from a laptop over a forwarded socket, into cheatsheet-dev beside
the other from-a-laptop workflows, and pointing robotd at your own .onnx,
into the cheat sheet under configuring robotd.

The placeholders are real SVGs rather than dead links, so the layout reads
correctly before any photo exists — each one renders as a dashed box naming
the shot it stands in for, and docs/images/README.md says what to take and
at what size.

Two facts corrected on the way through, both mine: the voice is `robotctl
quack` rather than a sound subcommand, and the robot has fifteen joints
rather than twelve. Also the cheat sheet still promised a coo when petted
in walk mode, which stopped being the default when the always-on version
wore thin.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-26 11:33:02 +02:00
Pierre Rouanet d9da9b5ca8 Merge remote-tracking branch 'origin/main' into webrtc-console 2026-08-25 16:22:41 +02:00
Pierre Rouanet 4917771546 docs: the WebRTC client, from a test page to the robot's console
The page proved the transport and stops there: it needs `python3 -m http.server`,
a URL typed by hand against a hostname every board shares, and it reaches almost
none of what `route.rs` permits.

Four changes, each standing alone — `mediad` serving the page from the binary,
the producer meta, `duck-btctl` handing over the address `btd` already
broadcasts, and the page itself. Plus the one thing that shapes the order: a
microphone needs a secure context, which a robot on plain http cannot be.

Assisted-by: Claude:claude-opus-5
2026-08-25 16:01:20 +02:00
Pierre Rouanet baf912e236 duckctl: the client is named for the robot, not for the radio
`duck-btctl` was an example of `btd`, and both halves of that stop fitting.
`mediad` gives a robot a second transport, and the two reach different method
sets by design — `robot.move` is refused over BLE and permitted over WebRTC,
`net.connect` the other way round — so a tool named after one radio teaches
everyone that it is the way in, at the moment it stops being the only one.

Its own crate, because a transport-agnostic client cannot be an example of the
BLE daemon: it would need btleplug and a WebSocket client, and only one of those
belongs to `btd`. The guarantee the example arrangement bought — btleplug never
in a release — survives as something stated rather than incidental: nothing on
the robot depends on `duckctl`. `advwatch` comes too; it is a scanner, and
scanners run on laptops.

`default-members` is what keeps it off the board. `cargo board --bins` builds
every default member for aarch64, and cross-compiling a Bluetooth stack for a
board that must never see one is both wasted and wrong. One list, rather than
naming binaries at each of the two `--bins` call sites.

No shim: `duck-btctl` is gone rather than aliased. `docs/project/` keeps
saying it, because those are records of a moment and a tool did not have this
name when they were written — their links are repointed, their prose is not.

Assisted-by: Claude:claude-opus-5
2026-08-25 16:00:36 +02:00
Pierre Rouanet 4a0beedf0d Merge pull request #133 from pollen-robotics/webrtc-design
docs: the WebRTC design, scoped to local signalling
2026-08-25 15:06:05 +02:00
Pierre Rouanet 84ad16f04b Merge pull request #131 from pollen-robotics/gstreamer-install-script
media bring-up: GStreamer, hardware H.264, and the camera overlay
2026-08-25 11:58:46 +02:00
Pierre Rouanet aedddcbf8a docs: the WebRTC design, scoped to local signalling
architecture.md §5 states the requirement; this owns the mechanism. Local
signalling only: everything in it runs on the robot and works on a LAN with no
backend, because the remote case is defined in terms of the local one rather
than beside it.

The load-bearing choice is `webrtcsink` over `webrtcbin`. It brings a signalling
protocol, a session model and per-consumer encoder management, so what is left
to design is the control surface rather than the media plumbing — and that
protocol is what a remote bridge proxies, which is why the bridge is a relay and
not a translator. `run-signalling-server` (verified present in gst-plugins-rs
0.15.3, with host and port properties) means mediad runs the server in its own
process, so the separate gst-webrtc-signalling-server binary never has to be
built or shipped.

Four things it decides rather than defers:

  - Authorisation reuses `system.authenticate`. The signalling port is open on
    the LAN by necessity — loopback-only would force every session through a
    bridge — so the control channel serves that one method and refuses the rest
    until it passes, exactly as a BLE session does. Two schemes for two
    transports is how the newer one ends up weaker.
  - The control channel is a pipe to the JSON-RPC that already exists. btd is
    the precedent and three of its four files are transport-independent; the
    routing table should be lifted so the exhaustive match over proto::Call
    holds *per transport*, or WebRTC becomes the hole in it. Replies stay
    uncorrelated, so the pipe needs no per-method work.
  - Teleop carries sequence numbers. intents.rs takes last-writer-wins, which is
    correct over a unix socket and wrong over SCTP with maxRetransmits=0 — a
    twist from 80 ms ago can land after a fresher one and win. Transport
    property, so it belongs in mediad.
  - update.* mutations are refused, and the refusal says why: preflight already
    declines an update during a remote session, and restarting mediad drops the
    session the client is watching progress on.

And the thing this feature breaks. intents.rs says its slots are "single-writer
in practice"; a pad and a remote peer both driving at 50 Hz makes that false,
and the result is not a contest but two writers interleaving into one slot.
architecture.md §6 already calls for priority and handoff and the roadmap defers
it to M6 — WebRTC is what makes it due. That is the one part touching a file
robotd owns, and the part most worth arguing about before it is written.

Assisted-by: Claude:claude-opus-5[1m]
2026-08-24 18:19:16 +02:00
Pierre Rouanet ffc90af28f docs: the media bring-up findings, and give the VPU node a group
Everything the board said over the last few sessions, in
`docs/project/media-bringup.md` — a dated record next to `slice-2-bringup.md`
and `update-over-ble.md`, which is where "what the hardware actually did"
lives. Indexed in docs/README.md.

It separates measured from assumed, because most of what looked true here at
the start was not. The VPU encodes 720p H.264 and the bitstream decodes clean
as High/4.0; the encoder is reached through /dev/mpp_service and not V4L2, and
on a BSP kernel that is the expected shape rather than a fault; a plugin built
against GStreamer 1.14 registers fine in 1.26.2, so plugin ABI is not the risk
it was assumed to be. What has not been measured is stated as such: neither
plugin has been built, no camera is attached, and no pipeline exists.

It also answers a question the conversation kept blurring — there are **two**
plugins to build, for unrelated reasons. `gstreamer-rockchip` (meson, C) for
`mpph264enc`, because Debian ships no Rockchip encoder and Radxa's build
predates the encoders. `gst-plugin-webrtc` (cargo-c, Rust) for `webrtcsink`,
because gst-plugins-rs is packaged in no Debian suite. `webrtcbin` is already
installed and needs neither.

And the udev rule the permission finding calls for: `/dev/mpp_service` to group
`video` at 0660, so a non-root `mediad` can open the VPU at all. `video` rather
than `robot` because `robot` gates the sockets we define and a kernel device
node is not ours to redefine. In `setup-gstreamer.sh` rather than
`setup-board.sh` because this script already probes and reports that node, and
a board that skips GStreamer has no use for the rule. It verifies rather than
assumes — `udevadm --name-match` is not in every udev, so a node still
root-only afterwards gets the mode set directly. All three paths, plus a
missing rules directory, exercised against fixtures.

Assisted-by: Claude:claude-opus-5[1m] shellcheck
2026-08-24 15:38:21 +02:00
Pierre Rouanet c57d5cf003 Merge main into docs/robotd-design-reorg
Only `robotd-design.md` conflicted, in §2.4 Safety: this branch rewrote the
section, and main meanwhile removed the fall gate and the fall recovery, made
`limp_fall` the only answer to a fall, and shipped it on.

Both sides are kept. The section keeps this branch's corrections against the
code — non-finite refusal, the actuator range clamp, the deadman — and takes
main's newer facts on top: the verdict is published and gates nothing, and
limp-fall becomes §2.4.1 under the new numbering.

The rest of the page said the old thing in five more places, so it says the new
one instead: the `safety.apply` box and the `driving` line in §1.4, the
bring-up conditions in §3.3 (the "not fallen" gate is gone, and being down is
now called out as deliberately *not* a condition), "fall recovery" in §5.3, and
the safety test in §6. §7 gains the decision itself.

Assisted-by: Claude:claude-opus-5
2026-08-24 15:23:18 +02:00
Pierre Rouanet 0f9d0d7eee docs: robotd-design is organised by subsystem, and draws the bus
The page was ordered by the slices it was written for, so finding out how
anything works meant knowing which increment built it. The tick was
described twice, in §4.1 and §5.10; the two diagrams that orient a reader
were inside §3.1; the bring-up state machine was a §5.7.1.

Reordered into three tiers. §1 is the whole system on one screen — the bus,
the clients, the crate boundary, the tick, the five invariants. §2–§4 are
the reference detail, in the order data moves: bus, observations, policy,
safety, then the API, then what surrounds the loop. §5 onward is why it
looks like this, what is deferred and what is open. No reasoning was
dropped, only moved and deduplicated.

Adds what no page owned:

  - The bus topology. Sixteen devices on one UART, /dev/ttyS2 at 1 Mbps:
    the imu_to_dxl board at id 200, then 20-24 / 30-34 / 10-14.
  - Who owns the port, and that nothing enforces it. serialport sets
    TIOCEXCL, but robotd runs as root, so `robotd init` against a running
    daemon puts two writers on one bus. serial-getty@ttyS2 is the other
    claimant, and `fuser -v /dev/ttyS2` is the command that answers it.
  - The slow path: registers 144-146 once a second, on the same clock as
    the achieved-rate window, and why it cannot fold into the tick's read.

Corrects what had drifted from the code:

  - MissedTickBehavior is Skip, not Delay, and the reason Delay is wrong.
  - RobotIo is six methods plus two defaulted, not two.
  - Net selection is the priority chain, not walk-or-stand on |twist|.
  - Fall -> limp is a mode that ships off; the fall verdict is always
    reported. The page called it unconditional.
  - The wheeled configuration is a params preset, not a dropped variant.
  - Tunables pointed at §8, which was the testing section.

Section numbers moved, so the five call sites that cite them move with
them. robotd's own module doc claimed no observations, no policy and no
intents, in a file that has all three.

Assisted-by: Claude:claude-opus-5[1m]
2026-08-20 11:31:12 +02:00
Pierre Rouanet 117ad2d61f docs: what driving the update path from a phone turned up
The plan becomes the record: what was already working and not rebuilt, the four
fixes, the rollback/select decision and its cost, the two things recorded rather
than fixed, and what is left — none of it has run on a board.

The lane mechanism moves to app-path-design.md §3.5, which owns it, so this page
points rather than explains it twice.

Assisted-by: Claude:claude-opus-5[1m]
2026-08-19 16:34:29 +02:00
Pierre Rouanet 9445d14f3d docs: the plan for driving updates from a phone
The update subset is routed, updaterd streams progress on the apply's own
connection and duck-btctl already prints it — so the missing pieces are
narrower than the roadmap implies. This records them and asks the two
questions that decide app screens.

The one that matters: btd holds a single connection per service per session,
and updaterd serves a connection one request at a time. So `subscribe` then
`apply` writes the apply into a socket nobody reads — an update the owner
asked for that the robot silently never performs — and `apply` then `status`
times out having heard nothing. Everything else here is testable only once
that is fixed.

Also names the two updaterd faults a phone inherits (per-chunk download
progress against a 20-byte pipe; `update.check` blocking on the engine lock
instead of answering BUSY), the rollback/select routing decisions with their
trade-offs, and a duck-btctl surface mirroring `robotctl update`.

Assisted-by: Claude:claude-opus-5[1m]
2026-08-19 16:07:21 +02:00
Pierre Rouanet 60f622c6ca docs: the install as separate commands
provision-board.sh in one shot is the right tool for a board you want working. Bisecting which
layer breaks something needs the same work as steps that can be run and tested one at a time.

Assisted-by: Claude:claude-opus-5
2026-08-19 10:34:09 +02:00
Pierre Rouanet 4d55a8e188 docs: the local build-and-push loop has its own page
Building on a laptop and installing straight on the board was a section
inside the dev-board cheat sheet, which is the wrong place for the thing a
developer does dozens of times a day: the setup, the container build, the
dry run and every failure mode were compressed to fit alongside the
`--ref` commands, and the debugging half of the loop — journal, log level,
what a stale daemon looks like — was not there at all.

`docs/robot/dev-push.md` is now the page for it, and every pointer that
used to send readers to the cheat sheet for setup goes there instead. The
cheat sheet keeps one entry and a link.

Assisted-by: Claude:claude-opus-5[1m]
2026-08-17 15:07:30 +02:00
Pierre Rouanet b64872b988 The laptop client is duck-btctl, not btctl
It is the one artifact of this repo that lands on a developer's PATH, and
`btctl` claims a name in that namespace that says nothing about what it
controls. It sits next to `bluetoothctl`, `btmgmt` and `btmon` — all of which
drive a Bluetooth stack rather than a robot — and a year from now, in
`~/.cargo/bin`, nothing distinguishes it from one of them.

`duck-btctl` says whose robot, matches the prefix the non-robot-local crates
already carry (`duck-control`, `duck-ipc-proto`), and is what `duck-<Tab>`
finds when the name has been forgotten. `robotctl` and the daemons keep their
bare names: they live on the robot's filesystem, where the context is not in
doubt.

`--version` is part of this. It answered `btd 0.5.1` — clap takes the name from
the crate unless told otherwise, so the laptop client reported itself as the
daemon it is an example of.

Anyone who installed the old name keeps a stale binary that no longer tracks
the branch, so the page says to remove it.

Assisted-by: Claude:claude-opus-5
2026-08-17 14:46:42 +02:00
Pierre Rouanet fb34331d2c docs: one page for every btctl command
`btctl` was documented as a section of the dev-board cheat sheet, which is
where it started and no longer fits: the tool now covers scanning, identity,
wifi, health, updates and the `call` escape hatch, and reaching a robot over
Bluetooth has nothing to do with having a dev board — it is how a robot that
has never seen a network gets configured at all.

So it gets a page, on the same footing as `cheatsheet.md` for `robotctl`, and
the cheat sheet keeps a pointer instead of a copy. docs/README.md says one page
owns a mechanism and the others link to it; two copies of a command list is the
shape that rule exists to prevent.

The page also writes down what the section never did: which methods `call`
reaches and with what parameters, that an apply can outrun the 60-second reply
budget while the robot carries on, that replies go to stdout and everything
else to stderr, and the steps for a robot the scan cannot find.

Assisted-by: Claude:claude-opus-5
2026-08-17 14:37:44 +02:00
Pierre Rouanet 8e497c4ed0 An update must not restart the recovery net's oneshot
`robot-boot-check.service` was in `on_apply`'s restart set:

    units_to_restart = ["configd", "padd", "robot-boot-check", "robotd"]

It asks whether the release that booted came up and hands over to `robot-rescue` if
not, so an update restarting it points a rollback check at daemons that are
legitimately mid-restart — and `robot-rescue` can answer by swapping to golden and
rebooting. Mid-update.

`hooks/postinstall` already declines to `enable --now` it, and says exactly why:
"`enable --now` on it would run a rollback check in the middle of the update that
installed it, with daemons legitimately mid-restart". The engine then read every
`*.service` and restarted it a moment later anyway. Two places, one rule, one unit,
and they disagreed.

What kept it harmless is a guard for a different caller: the script declines when
uptime is over ten minutes, and its comment names `postinstall` as the reason that
guard exists. Inside the first ten minutes of a boot — a dev board, or `auto_apply`
polling sixty seconds after `updaterd` starts — the guard does not apply and the check
evaluates its members while two of them are restarting. It needs `failed` or three
restarts to act, so it would usually decline; "usually" is not the property wanted from
the thing that reboots the robot.

Keyed on `[Install]` rather than on a name in `NEVER_RESTART`. A unit without one is
triggered by something else, so its lifecycle is not the update's to drive; and stating
it as the rule makes `postinstall` and the engine agree by construction rather than by
both being remembered. An unreadable unit counts as one to restart, because that is
more likely a permissions problem than a triggerless unit, and failing loudly beats
skipping quietly.

Demonstrated rather than argued: the fixture now ships a unit shaped like the real one,
recording each time it runs, and the harness asserts it did not. With the rule disabled
that assertion fails, printing the `ran` the unit left behind.

`install-path-gap.md` is retitled and closed. Its own body has said the gap is shut
since the artifact-install test landed, while its title and revision note still said
otherwise. `restart-order.md` gains the rule and stops calling five units the whole
set.

Assisted-by: Claude:claude-opus-5
2026-08-11 19:03:38 +02:00
Pierre Rouanet 93afa4ed18 docs: one page owns the boot recovery net
The net is built, so its description belongs in `design/` rather than in a dated
`project/` record: `design/` is how it works and why, and one page owns a mechanism
while the others link to it.

`boot-recovery-net.md` owns the deadline and its predicate, the membership rule, the
rescue, the `golden` symlink and the loop guard — including the reasoning that is
invisible in the code it describes:

  - why a deadline and not `OnFailure=`. All four members use `Restart=always` for
    reasons argued in their own unit files, and none overrides the default start
    limit, so a `btd` restarting every 5s crash-loops forever without ever entering
    `failed`. `OnFailure=` would only fire if those units were retuned to give up.
  - why the predicate is two conditions of positive evidence rather than "is it
    active". A false negative costs a diagnosis, a false positive costs a good
    release, so a stopped unit, an unloaded one and a slow one are all left alone.
  - why the rescue parses nothing, why `golden` is a symlink `updaterd` republishes
    on every start, and why a configured golden that is not installed publishes no
    link at all.
  - why clearing the breadcrumb precedes the boot counter: the trial would revert to
    `previous` while the rescue already went to golden, so an armed trial moves
    `current` back off golden a boot later.
  - what is not tested, which is systemd itself.

Two owners of overlapping mechanisms now point here instead of describing it.
`updater-design.md` carried a paragraph specifying the `OnFailure=` design that was
never built, and its on-disk layout gains the `golden` symlink. `restart-order.md`
owns the startup sequence, so `record_rescue` and `refresh_golden_links` are listed
there as the steps they are, with the reasons kept on this page — and §4 now says
that everything it describes presupposes an `updaterd` that starts, which is the gap
the net exists for.

Assisted-by: Claude:claude-opus-5
2026-08-11 17:25:34 +02:00
Pierre Rouanet ddc29da598 docs: one page owns a mechanism
The rule the previous two commits are an instance of. Six documents promised that
`updaterd` and `btd` kept their old binaries until the next reboot, two releases
after they stopped doing so, and each of the six was locally reasonable — nobody
wrote a wrong thing, they wrote a true thing next to code that later changed.

Stating the rule is cheaper than another pass: the index table already assigns
scope per page, so this only says that the assignment is binding, and that a page
which does not own a mechanism gets a sentence and a link.

Assisted-by: Claude:claude-opus-5
2026-08-11 16:17:24 +02:00
Pierre Rouanet d784b07226 docs: one page for what restarts, and when
"Which daemon restarted, and at which step" has been answered several different
ways from several different documents, and the answer decides how a version skew
is diagnosed. This reads the sequence out of the code once: the shipped set
versus the restart set, the postinstall hook's `enable --now`, the self-test, the
deferred updaterd/btd restarts, the startup reconciliation that checks those
landed, what each of select/rollback/reset-to-golden skips, boot recovery, and
the first install.

Assisted-by: Claude:claude-opus-5
2026-08-11 15:23:56 +02:00
Pierre Rouanet 4f285b70a2 One command to pair a gamepad, and Start to bring the robot up (#49)
* feat: pair a gamepad with one command, and let padd run itself

Driving the robot used to take: `Privacy = device` plus a reboot; three
`bluetoothctl` commands in an order that is not the obvious one, with the
pad's MAC found first; membership of two groups, having logged out and back
in since; and then a binary run by full path that died with the ssh session.
Four places to get it wrong, each silent when wrong.

It is now one command — `sudo robotctl pad pair`, with the pad held in
pairing mode — and nothing after it.

`pad.status`, `pad.pair` and `pad.forget` are served by `configd`, next to
wifi, because bonding a device needs root and BlueZ. Not by `padd`: that
process has no privileged access on purpose, which is what makes it an
honest daily exercise of the intent API the phone app will use. `btd`
forwards them, so pairing a pad from the phone comes for free.

The BlueZ client is zbus, matching the NetworkManager one, rather than a
second vendored libdbus in this crate. `connect` before `pair`, then
`trust` — the order that works on this board, now in one place with the
reason attached instead of in a provisioning script's comments. The pairing
agent is registered per-bond and scoped to the one device being paired, so
it does not collide with `btd`'s default agent and does not auto-accept
whatever else is in the room.

`padd.service` runs from boot and drives whatever pad connects. Safe with no
pad: it sends nothing and `robotd`'s deadman holds the robot, so no udev
rules or device units are needed — and nothing moves until Start is pressed.
It runs as its own `padd` user with `input` and `robot`, which is what
retires the operator-in-the-input-group step and its log-out-and-back-in.
The no-pad loop backs off from 50 Hz to 500 ms, since it is now a permanent
process, and logs a pad appearing or going away once rather than never.

Install consequence: `API_VERSION` 4 → 5. Additive, but the handshake is an
exact `!=`, so between installing this release and `updaterd` restarting,
every `robotctl` call fails with a version mismatch — `install-path-gap.md`
§2, unchanged and still recurring. `hooks/postinstall` installs and enables
the new unit and creates its account, so an ordinary `update apply` lands it
working; `install.sh` now reads sysusers files from the directory rather than
naming them, which is how the two paths stop drifting.

Assisted-by: Claude:claude-opus-5[1m]

* fix: name the right button, and do not dead-end a search or a bond

Three things found by trying it on a robot rather than in CI.

**The instruction named the wrong button.** "Hold the pad's pairing button
— on an Xbox controller the sync button" reads as "hold the Xbox button",
and holding that switches the controller off. It is two presses and the
second is the easy one to get wrong: a short press of Xbox to switch on,
then the small Sync button on the top edge until the light flashes quickly.
Said that way in `robotctl pad pair`'s help, in the line it prints while
searching, in its not-found advice, and in both docs.

**A failed search was a dead end.** BlueZ reports a freshly-discovered
device with an address and often nothing else — no `Name`, no `Class`, no
`Icon`, since those need a further exchange — so a pad that resolves none of
them is invisible to the is-this-a-gamepad guess. The answer was "no gamepad
found", and the only escape, naming an address, needed an address nobody
had. The refusal now lists what the radio did see, unpaired first, so
pairing by address is one more command rather than a bluetoothctl session.

**A `Connect()` failure ended the bond attempt.** `connect` before `pair` is
still the order tried first — leading with `Pair()` on an Xbox controller
returns `AuthenticationCanceled` — but a device BlueZ has never bonded with
has no profile to connect to, so `Connect()` can answer
`br-connection-profile-unavailable` before pairing has happened. Refusing
there would reject a pad that `Pair()` would have bonded a moment later. The
first connect is soft now, `Pair()` runs when the device is still unbonded
after it, and a second connect follows for the case the first failed for
want of a bond. The preferred order is tried, not enforced against the radio.

Assisted-by: Claude:claude-opus-5[1m]

* fix: a pad bonded by connect is trusted, and an untrusted one says so

Both found on a robot, and they compound into "pairing does not work" about
a pad that is in fact paired.

`Connect()` bonds a gamepad on its own — a HID profile needs an encrypted
link, so connecting triggers the bond. Calling `Pair()` after that does not
answer `AlreadyExists`; it **hangs** until the timeout. So a successful
pairing was reported as `Timeout: the pad did not finish pairing` thirty
seconds later, and because the error returned early, `Trusted` was never
set — leaving a pad that drives now and does not come back after a reboot.
The re-read after connecting is what avoids the call, and it logs the
state it saw so the next surprise here is one journal line rather than an
inference.

The status line then hid the consequence: it printed `connected` for any
connected pad, trusted or not. Trust is now reported alongside, because
`connected, but NOT trusted` is the state that looks like everything is
fine and silently ends at the next reboot.

Assisted-by: Claude:claude-opus-5[1m]

* fix: wait for the bond instead of believing Pair()

Bonding is asynchronous. `Connect()` on a gamepad triggers it — a HID
profile requires an encrypted link — and **returns before it has
completed**. So reading `Paired` straight afterwards says `false` about a
bond that is already in flight, and the `Pair()` that follows never
answers: BlueZ leaves it outstanding rather than reporting `AlreadyExists`.

On the board that was: first `pad pair` bonds the pad, waits thirty seconds
for a reply that is never coming, returns `Timeout: the pad did not finish
pairing`, and never reaches `set_trusted`. The second `pad pair` then
succeeds instantly and needs no pairing mode at all, because the bond is
already there and only the trust flag is missing. Two symptoms, one cause.

`Paired` turning true is the ground truth for "this worked", so it is what
decides now: `Connect()` gets BOND_SETTLE to produce it on its own, and the
`Pair()` that follows is raced against the same property rather than
believed. A `Pair()` that never answers no longer fails a pairing that
worked.

The module header stops claiming this is untested against a real BlueZ,
since it is not — it names what a Radxa and an Xbox controller have now
shown work, and what still has not been near hardware: a DualSense, two
pads in pairing mode at once, and pairing by explicit address.

Assisted-by: Claude:claude-opus-5[1m]

* fix: do not spend pairing-mode time waiting for a bond nobody started

The settle window after `Connect()` exists because a successful connect
starts a bond that lands a moment later. After a *failed* connect there is
no bond in flight, so the same wait is dead time — and dead time here does
damage rather than nothing: a pad holds pairing mode for a limited window,
and spending five seconds of it waiting for something that was never started
is how a fresh pairing arrives too late and ends in `AuthenticationFailed`,
which is what a board did.

So the window is now conditional on the connect having succeeded, and
`Pair()` follows immediately otherwise.

`AuthenticationFailed` also had misleading advice attached. It was blamed on
a missing `Privacy = device`, which is a real cause of a pad that bonds and
drops but not of a refused exchange; the common cause is the pad having left
pairing mode before the exchange began. The advice now says to press Sync
and re-run while the light is still flashing, and keeps the config check as
the fallback for a pad that never succeeds.

Assisted-by: Claude:claude-opus-5[1m]

* fix: Privacy = off, which is what lets a gamepad bond at all

`setup-board.sh` had this backwards, and every board provisioned so far
carries the wrong value.

It set `Privacy = device`, inherited from microduck_runtime's installer,
whose notes credit it with fixing a pad that pairs and drops straight back
out. With that setting an Xbox controller cannot bond with this board at
all. `btmon`, with no key on either side and `btd` stopped:

    SMP: Pairing Public Key x2 · Confirm · Random x2 · DHKey Check
    > ACL Data RX: SMP: Pairing Failed — Reason: DHKey check failed (0x0b)

The DHKey check is computed over both devices' addresses, and privacy makes
the adapter pair from a resolvable private address rather than its public
one. The two sides compute different values and the pad refuses — every
time, unaffected by retrying, by `JustWorksRepairing`, or by clearing the
bond on either side. `bluetoothctl pair` fails identically, which is what
places this below anything in `configd`.

With `Privacy = off` the same pad pairs first time, is trusted, drives, and
reconnects by itself across a reboot. The drop-on-connect symptom the old
value was meant to prevent has not returned. If it ever does, the two are in
genuine tension and the answer is to pair with privacy off and re-enable it,
not to set `device` and lose the ability to pair.

So a measurement replaces an inherited setting, and the reason travels with
it: the trace is in `configure_bluetooth`, in `bluez.rs`, in the cheat sheet,
and in what `pad pair` says when a pairing is refused — which until now told
you to add the setting that breaks it.

`board-test.sh` gains the case that was never tested: a board that already
carries `Privacy = device` must have it *corrected*, not left alone. An
absent setting and a wrong one need different work.

`pad forget` also stops implying a clean slate. It removes the robot's half
of the bond, which is all a robot can remove; a pad holding its own half
refuses to pair again until it is back in pairing mode, and it reports the
same `AuthenticationFailed` as everything above.

Assisted-by: Claude:claude-opus-5[1m]

* fix: a bonded pad must not block pairing a new one

`pad pair` short-circuited on any already-paired, trusted gamepad before it
even started discovery. That reads as an obvious optimisation and it meant a
robot could only ever have the pad it already had: adding a second one
required forgetting the first, and forgetting is the operation that leaves a
pad refusing to bond until someone puts it back into pairing mode.

Two pads bonded is a state worth supporting rather than working around —
`padd` drives whichever connects, so two people with two pads is exactly the
bench case — so the search now runs every time and prefers a pad that is
**not yet paired**, which is the one somebody just held Sync on. A bonded pad
is in BlueZ's cache in every sweep and is not a competing answer.

`find` had the same assumption one level down: it returned on the first match,
which would have been the bonded pad before the new one ever advertised. It
now only ends early on an unpaired candidate — or immediately, when an
explicit address was given, since then there is nothing to prefer. The cost is
that re-running with nothing new in pairing mode waits out the window before
reporting the pad you already have, which `--timeout` shortens.

Idempotence moves to where it belongs: `bond` already skips connecting and
pairing for a pad that is paired, and re-asserts `Trusted`. So a re-run still
repairs the trust flag, which is what it was for.

`FakePads` modelled "in pairing mode" and "already bonded" as two lists,
which is tidier than BlueZ and is why no test could fail on this. It is one
`visible` list now, each pad carrying its own bond state, and two tests come
with it: a bonded pad does not win over a pad in pairing mode, and a re-run
with nothing new restores trust.

Assisted-by: Claude:claude-opus-5[1m]

* feat: Start brings the robot up, instead of a manual init nobody documented

Pressing Start on a fresh robot did nothing visible. The policy ran, the loop
wrote positions, and the servos ignored them because they had no torque.
Torque came from `robotd init` — a separate subcommand which opens the motor
bus itself, so it needs the daemon stopped, and which appears in no
documentation. The step existed, worked, and was invisible.

`robot.enable` now advances a bring-up state in the control loop:

    Limp --enable--> Homing (torque on, 2s ramp to home) --> Ready --> drives

**The invariant the old rule protected is unchanged.** "The control loop
never touches torque" was defending one property — an update that restarts
`robotd` must not move a standing robot — and that property does not need the
broader rule. Nothing here runs because a process started; only an explicit
`robot.enable` moves the state on, which is a human pressing a button.
`a_restart_asks_for_no_torque` pins it on the *absence* of any write rather
than a write of `false`, so a restart leaves the servos exactly as they were.

Three conditions gate the bring-up, each for its own reason. A loaded policy,
because `enable` means "enable the policy" and powering the joints to run one
that would not load would stand a robot up on a broken release. Not fallen,
because `Safety::apply` commands a fallen robot at limp gain and holds it, so
ramping there would write a stand-up that cannot happen — `robot.enable`
already refuses in that state, and `robotd init` with the daemon stopped is
still the way to pick a robot up. And a fresh sample, because the ramp starts
from where the joints are, and starting from a position nobody read is the
lurch the ramp exists to avoid.

`set_torque` joins the `RobotIo` trait and `Safety` gains a passthrough,
because `Safety` owns the only handle — that is what keeps "nothing commands a
motor except through here" a fact the borrow checker enforces. It bypasses no
clamp: torque decides whether the motors hold what `apply` writes, and every
limit, the fall gate and the limp gain still decide *what* gets written.

Tested where CI can reach: the ramp arithmetic directly, no torque at startup,
and no torque when the policy is absent. The homing path itself needs a loaded
policy and therefore a board — same as the policy path it gates.

Assisted-by: Claude:claude-opus-5[1m]

* docs: pairing a pad is a page, not a section of the README

It happens once per pad, so it does not belong in the first thing anyone
reads about driving the robot. `docs/robot/pair-a-gamepad.md` now holds the
whole one-time procedure — which button, what a refusal means, adding a second
pad, forgetting one and the half-bond that leaves behind, and the
`Privacy = device` trap with the btmon recipe for when it is something else.

The README keeps what is true every time you pick up a pad: switch it on and
drive, `pad status`, the controls, the speed flags, and the forwarded-socket
path from a laptop. It links to the page for the rest.

The cheat sheet keeps the four commands, as a reference should, and points at
the page instead of repeating the procedure. Driving with non-default limits
stays in the README, so each fact has one home.

Assisted-by: Claude:claude-opus-5[1m]

* feat: robot.init and robot.relax, so powering the joints is a command

`robotd init` was the only way to power the joints, and it opens the motor bus
itself — so it needs the daemon stopped, two writers on one UART corrupt each
other's replies, and it appeared in no documentation. There was no way at all
to take torque *off*: not Start again (which stops the policy and keeps the
robot standing, deliberately), not stopping robotd (torque lives in servo RAM),
only cutting power.

Both are now methods on the daemon that owns the bus:

    sudo robotctl robot init          torque on, ~2s ramp to the home pose
    sudo robotctl robot relax --yes   torque off; the robot collapses

`init` deliberately needs no policy — standing up is reasonable to ask of a
robot with no walking network — and that has a second effect worth having: the
bring-up path becomes testable in CI, which `enable` could never be, since
there is no ONNX Runtime here. Two of the four new tests exercise the real ramp
through the real loop for the first time.

`relax` wants `--yes` for the same reason `system reboot` does, except more
immediately: it takes effect in milliseconds and the robot is standing. Named
`relax` rather than `limp` because `gain_limp` already means the soft yield a
fallen robot is commanded at, which keeps torque on. This is the register.

Neither is reachable over BLE. A phone button that drops the robot is not one
to offer, and standing up moves every joint at once, which wants whoever asked
to be looking at the robot rather than at a screen.

They arrive as a request the loop takes once per tick, not a flag it keeps
applying: `set_torque` is a bus transaction per joint, so a level would put
sixteen writes into every tick. The later request replaces an unread earlier
one, and `relax` clears `enabled` — otherwise the next tick sees a robot that
was asked to drive and stands the one you just let go of straight back up.

Still refused on a fallen robot, both of them, and the refusal now says why and
what to do: the fall gate holds a fallen robot limp on purpose, so a ramp there
would write a stand-up that cannot happen. `robotd init` with the daemon
stopped remains the bypass, and remains documented as such.

API_VERSION 5 → 6.

Assisted-by: Claude:claude-opus-5[1m]
2026-08-10 17:26:22 +02:00
Pierre Rouanet ef9162bb01 docs: rework for people who use the robot, and organise by audience (#48)
* docs: a README a robot user can actually start from

The README was four documents in one — pitch, dev setup, board operations
manual, dev-key plumbing, release process and status — at 457 lines. Someone
handed a robot met `robotctl monitor`'s projected-gravity paragraph before
learning how to make the thing move.

Most people joining will use the robot, not develop the shipping machinery.
So the README is now the first hour for that reader: is it alive, drive it
with a gamepad, watch the loop, run your own .onnx, put a branch on it. The
padd socket-forward recipe — pad on your laptop, robot on the bench, nothing
cross-compiled — was buried in a source comment and is now the centrepiece.

Everything else moves rather than disappears:

  docs/install-dev.md  new: the linear dev-board install, split out of
                       deploy/README.md, which stays as the reference for
                       what those steps do. Leaves a slot for the
                       regular-user install doc.
  CONTRIBUTING.md      new: building, testing, layout, conventions,
                       releasing — the daemon-developer door.
  docs/cheatsheet.md   absorbs monitor, completions, update log, and
                       select/pin/reset-to-golden with the three
                       easy-to-get-wrong notes.

Services and status were duplicated in architecture.md §1 and roadmap.md, so
they are links now rather than a third copy.

padd ships in the release but only robotctl gets a PATH symlink
(scripts/install.sh:633), so the on-robot invocation is the full path.

Assisted-by: Claude:claude-opus-5[1m]

* docs: drop self-referential commentary from the front docs

A doc that describes itself spends the reader's attention on navigation
rather than on the robot. Cut the paragraph telling the reader what the
README covers, the 'shorter door' framing, and the repeated 'read it
when' stems in the link table.

Assisted-by: Claude:claude-opus-5[1m]

* docs: plainer opening, and defer the dev-install prerequisite to its own page

The socket path and the wire format are not what a reader needs in the
first two lines; robotctl being the thing you talk to is. The branch
section likewise only needs to say the dev install is a prerequisite,
not re-explain what it consists of.

Assisted-by: Claude:claude-opus-5[1m]

* Update README.md

* Update README.md

* docs: basic update commands in the README, health contract where tools need it

The README jumped from watching the robot straight to installing branch
builds, with no answer for someone who only wants the current release.

The health rationale that came out of the README lands in architecture
§8.4, next to the version discussion it belongs beside, and the exit-code
contract is repeated in the cheat sheet where anyone scripting will look.

Assisted-by: Claude:claude-opus-5[1m]

* docs: explain apply-without-ref where the command is introduced

The warning sat two sections below the command it was about, so the
reader met the plain form first and the caveat only if they carried on
into branch builds. Stating what the stable channel means at the point
of use leaves the branch section to say what --ref adds.

Assisted-by: Claude:claude-opus-5[1m]

* docs: move the policy tensor contract into robotd-design

Tensor widths and the legacy 51-D refusal are what you need when a
policy will not load, not when you are swapping one in. They join the
rest of the load-time validation in §5.3, and the params file outliving
an update joins §7.2, which is already about that file's lifetime.

Assisted-by: Claude:claude-opus-5[1m]

* docs: dev-channel mechanics out of the README

Tag movement and version uniqueness join the --ref explanation in the
cheat sheet; the trust argument for dev builds joins install-dev, where
the reader is deciding to trust that key. 'A merge does not publish
instantly' was already in the cheat sheet, so the README keeps only the
short form.

Assisted-by: Claude:claude-opus-5[1m]

* docs: branch workflow as steps

Assisted-by: Claude:claude-opus-5[1m]

* docs: trim the update section to the commands

Assisted-by: Claude:claude-opus-5[1m]

* docs: group by audience — robot, design, project

Ten docs sat flat in docs/, so a design doc, a runbook and an open
post-mortem all looked equally authoritative. install-path-gap.md reads
as current architecture until you notice the Status line.

  robot/    cheatsheet, install-dev        — you have a robot
  design/   architecture and the three     — you are changing the daemon
            design docs
  project/  roadmap, ci-setup, and the     — dated records, stale on
            two records                      purpose

docs/README.md indexes all three. deploy/README.md stays next to the
config files it documents. Every cross-link repointed and checked.

Assisted-by: Claude:claude-opus-5[1m]

* docs: split the cheat sheet by audience, dedupe the deploy quickstart

The cheat sheet was 435 lines serving two readers: robotctl on a robot,
and btctl plus the dev channel, which need a clone and a dev board.
Split at that line — cheatsheet.md is the robot, cheatsheet-dev.md is
the dev board. 'Building and checking' was neither, so it joins the
build commands in CONTRIBUTING.

deploy/README.md kept a full copy of the dev-board provisioning walk-
through that install-dev.md now owns. It keeps the two commands and the
flags, and defers the rest.

Where next is now two groups rather than six flat rows: going further
with a robot, and contributing.

Assisted-by: Claude:claude-opus-5[1m]

* ci: follow the docs move when packaging a release

dev.yml and release.yml ship architecture.md and updater-design.md
inside the artifact, by source path. The move to docs/design/ broke
packaging on every push. The destination inside the release is
unchanged, so nothing on a board moves.

Assisted-by: Claude:claude-opus-5[1m]

* docs: repoint doc paths in comments after the move, and note --help in the README

Around ninety source comments cite docs/<name>.md by path. They break
nothing, but a path that does not resolve teaches the reader to stop
trusting the next one. Includes the rustdoc intra-doc links in
updater/src/lib.rs.

The README now says robotctl explains itself, so the commands can be
explored rather than looked up.

Assisted-by: Claude:claude-opus-5[1m]

* docs: start install-dev at flashing the board

The doc began at 'a board you can reach over ssh', which is several
steps in. Name the image and the imager profile, since setting wifi and
the user there is what makes the board reachable without a serial
console.

Assisted-by: Claude:claude-opus-5[1m]

* deploy: commit the team dev key, outside trusted_keys/

Keeping team.dev.pub out of the repository protected nothing. A board
accepts dev builds only when the key is in its own trusted_keys_dir and
allow_dev_keys is true, and signing a build needs the private half,
which has not moved. What the absence did buy was a round trip for
every new developer, asking someone for a file.

It goes in deploy/dev-key/ rather than deploy/trusted_keys/, because
install.sh copies the latter onto every robot and this must reach only
boards that opt in. provision-board.sh now falls back to the committed
copy when ~/.duck-keys/team.dev.pub is absent; your own copy still wins.

Assisted-by: Claude:claude-opus-5[1m]

* provision-board: read the dev key from the repo only

The ~/.duck-keys lookup was the primary path and the committed copy a
fallback, which is backwards now the key ships with the repo: the two
files are identical, so the home-directory branch only ever selected the
same bytes by a longer route. One default, and --dev-key for a key from
somewhere else.

Also repoints the doc paths in markdown prose that the earlier sweep
missed — it only covered .rs, .sh, .yml and .toml.

Assisted-by: Claude:claude-opus-5[1m]

* docs: repoint install-path-gap references that arrived with main

xtask/tests/artifact.rs and board-test.sh landed on main while this
branch was moving docs into groups, so they cite the old flat path.

Assisted-by: Claude:claude-opus-5[1m]
2026-08-10 12:52:45 +02:00