Commit Graph
118 Commits
Author SHA1 Message Date
Pierre Rouanet 3372424f7b Review: monitor says stopped, one age helper, the pool is eight
- robotctl monitor's camera caption read camera.json the same way health
  did, so a stopped camera kept its last rate on the border. It now
  shows "camera · stopped" once the file is older than
  CAMERA_STATS_MAX_AGE.
- camera_stats_age_at(path, now) is the one file-age helper;
  webrtc_peers_at uses it, so the clock-step rule lives once, and it
  has its own test.
- The capture pool is eight, not four: CAPTURE_BUFFERS plus the four
  v4l2src adds when downstream proposes no pool, and bufcnt:8 on an idle
  board. The comment and media-bringup.md now say so, and record the
  30 s WebRTC session that held 30 fps on the beta board with the cap.

Assisted-by: Claude:claude-opus-5-5
2026-11-06 10:10:29 +01:00
Pierre Rouanet c22e9cbc5f mediad: cap mpph264enc at two pending frames, or the camera stops
On microduck OS 1.1.0 the camera stopped three seconds after mediad
started, on every boot, with nobody connected. /proc/rkisp-vir0 showed
the ISP still counting frames in and mediad's output at
frame:95 frameloss:11182 bufcnt:0: no capture buffer was ever returned.

That OS pins gstreamer-rockchip at a tip where mpph264enc takes DMABuf
input (JeffyCN/mirrors 048e72f), so it holds the capture buffers
themselves, up to max-pending = 16 of them. The pool is four deep, and
webrtcsink's codec-discovery encoder emptied it.

Set GST_MPP_ENC_MAX_PENDING=2 before gst::init. The plugin reads it at
class init, so it reaches every mpph264enc in the process, including
the discovery one webrtcsink builds and we cannot configure. Verified on
the beta board with the same value as a systemd drop-in: capture back at
30 fps, bufcnt:7.

Assisted-by: Claude:claude-opus-5-5
2026-11-06 09:11:32 +01:00
Pierre Rouanet a4b88154e3 Merge remote-tracking branch 'origin/main' into telemetry 2026-10-30 15:50:50 +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
Pierre Rouanet 14e096948d configd: back the pad reconnect sweep off, and say why classic is paged
A classic pad left switched off was paged every 12 s forever, each page holding the radio for its
~5 s timeout on a chip that also carries the Wi-Fi. The sweep now reports whether a pad is still
down after its page, and the loop doubles its interval up to two minutes while that holds,
returning to 12 s once nothing is waiting. A pad switched back on pages the robot itself, so the
wait costs nothing.

One object without a proxy no longer ends the sweep for the others, `reconnect_bonded` is a
required trait method rather than a silent default, and the post-bond log lines carry the MAC.

The module doc and the pairing doc said a bonded pad reconnects by itself and that a reconnect
poller does not work; both are true of LE only, and now say so.

Assisted-by: Claude:claude-opus-5-5
2026-10-30 09:05:02 +01:00
apirrone 2fee378bbc mediad: the beta's exposure is rkaiq's; do not run a second loop on it
Seeed's GC2093 tuning ships rkaiq's AE on and running every frame, and it
keeps converging. With mediad's loop on top, mediad saw each darker step it
wrote overwritten a frame later, stepped its belief down to its floor (4
lines, 1x), and re-asserted that floor on its 10 s heartbeat: a black frame,
rkaiq overshooting to 1688 lines at 16x, and a picture that flashed white and
hunted back every ten seconds under strong lights.

Each sensor profile now names who steers its exposure. The IMX219 keeps
mediad's loop (setup-rkaiq.sh turns the alpha engine's AE off); the GC2093
leaves it to rkaiq.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit d91dbd8f07)
2026-10-26 11:50:03 +01:00
Pierre Rouanet 910b411b4b duckctl: push the Homebrew formula on each release
After the PyPI publish, a homebrew job renders the formula for the version
just released from PyPI's wheels and pushes it to pierre-rouanet/homebrew-tools,
so brew upgrade duckctl follows the releases. It writes with a deploy key
scoped to the tap, held by a homebrew environment.

Assisted-by: Claude:claude-opus-5-5
2026-10-15 12:47:13 +02:00
apirroneandClaude Opus 5.5 8c8a57820c duckctl-pypi: the first upload is the next release, not a dispatch from an old tag
A dispatch runs the workflow files of the ref it starts from, and
daemon-v0.16.1 has neither this workflow nor duckctl/pyproject.toml.
The pypi environment now exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 14:24:56 +02:00
apirroneandClaude Opus 5.5 a2e48c4aa7 duckctl: uvx duckctl on any machine
duckctl becomes a PyPI package: maturin's `bin` bindings put the CI-built
binary in a wheel per platform, so `uvx duckctl` (or `uv tool install
duckctl`) downloads and runs it with no toolchain. Wheels only, no sdist,
so nothing ever compiles on the user's machine.

libdbus is now compiled in on Linux (libdbus-sys `vendored`), which makes
the Linux wheels genuine manylinux_2_28 rather than ones with a grafted
library, and drops the apt step from building it.

The build moves out of dev.yml into `_build-duckctl.yml`, which builds the
wheel and takes the branch tarball/zip back out of it: one binary, two
forms. The Linux archives are manylinux_2_28 too now, not the runner's
glibc. `duckctl-pypi.yml` publishes the wheels on every `daemon-v*` tag
via trusted publishing, and refuses a tag that disagrees with Cargo.toml.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 14:15:23 +02:00
apirroneandClaude Opus 5.5 a41a674617 Read the beta's head IMU (LSM6DSV16X) in robotd, on by default there
The beta board's head IMU is an LSM6DSV16X on the face board's own I²C bus
(/dev/i2c-3, 0x6a), the chip the body's power board carries. It fuses the
orientation itself (SFLP game vector) and batches gyro, accel and quaternion
into its FIFO, so robotd wakes 30 times a second and reads every queued
record in one burst: two transactions for ~4 samples, no fusion on the CPU.

- robotd/src/head_imu.rs: the bring-up from imu_to_dxl (reset, reload the
  trimming, configure, read back: the fw 6 "drunk robot" fix), the FIFO
  decoder, and a reader thread. robotd serves head_imu.stream on its socket,
  in the same HeadImuFrame shape tofd serves on a zero3.
- [head_imu] enabled is now optional: unset means the board decides, off on
  zero3 (unchanged), on on beta. An explicit value wins on both.
- zero3 is untouched: tofd still reads its BMI088. On a beta, tofd leaves the
  bus alone, and either daemon's answer names the right one when asked on the
  wrong board. robotctl configure restarts whichever daemon reads it.
- Docs: the config template, the cheatsheet, tof-on-demand.md, and the frame
  docs, which no longer say BMI088.

Measured on a beta board: 116 frames/s (the chip's clock runs ~3% slow), no
seq gaps, |accel| 9.93 m/s² at rest, unit quaternions, timestamps increasing.
The head-imu thread costs ~1.5% of one core at 120 Hz, against the BMI088's
~4% at 100 Hz. A multi-record burst read of FIFO_DATA_OUT_TAG was checked on
the chip first: the address wraps from 0x7E back to 0x78.

Open: frames.head_imu, the mount pose that rotates samples into the head
frame, is still the zero3 HAT's. The model has no face-board mount yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011N2umWfRzHL71umm3VKfc7
2026-10-06 15:26:49 +02:00
Pierre Rouanet 127f181cb2 robotctl: a source not checked yet is not one that never answered
`health` warned "has not answered once on this robot" for the minute after
`updaterd` starts, before its first check: every board just updated to the
release that brought the record in. It reads `last_check_attempt` now, from an
`updaterd` at API_CHECK_ATTEMPT or later:

- no attempt yet is a line, `source not checked yet`, with the command that
  checks it now, and no warning;
- attempts that failed are the warning, and it gives the error in place of
  pointing at the journal;
- an answer the clock was too early to record is a line, not a quiet source.

A failure after an answer is said beside the "last answered" line, in `health`
and in `update status`, and warns only once the week is up, as before. An older
`updaterd` reads as it did.

`health --check` has `updaterd` check each component first, so the report says
whether the source answers now. A flag, not the default: the login banner runs
`health` and would wait on the network at every ssh. An update in progress
holds the engine, and the report says the check did not run rather than
passing the last one off as fresh.

Assisted-by: Claude:claude-opus-5-5
2026-09-23 14:19:25 +02:00
Pierre Rouanet 85ca669145 docs: a server-side agent drives a duck over the rendezvous lane
architecture.md §5.3 still said a server-side agent reaches the robot
over a WebSocket, which was written before the rendezvous control lane
existed. That lane is the answer: JSON-RPC over HTTP/SSE, no WebRTC,
reachable from a data centre, authenticated by the account. Nothing in
docs/design described it; only relay.rs and wire.py did.

- remote-access-design.md §3.8 now owns the control lane.
- architecture.md §5.3 names it and links there.
- remote-webrtc.md §12 drops the deferred WebSocket item.
- webrtc-console.md §6 and the roadmap's SDK paragraph follow.
- mediad comments stop pointing at the deferred item.

Assisted-by: Claude:claude-opus-5-5
2026-09-23 11:53:35 +02:00
nityam 02ac0457af updater: say when the update source last answered 2026-09-23 10:21:10 +02:00
Pierre Rouanet bfa5b8ba5a health: what the heat is costing, beside the board temperature
`robotctl health` reported `cpu 96 °C` and stopped there, which reads as a robot somebody
should keep an eye on. The board it was read from was in fact pinned to 408 MHz of 1800 by
the thermal governor — under a quarter of the CPU the gaits were tuned on — and a duck
walking badly on a hot board is walking badly *because of that*. The temperature named the
symptom and withheld the consequence, and the consequence was only reachable by sshing to
the robot and reading `sysfs`.

So the once-a-second `soc.rs` sample now also reads the clock ceiling —
`scaling_max_freq` against `cpuinfo_max_freq` — and the cpufreq cooling device's state,
and `robot.health` carries them as `CpuThrottle`:

    cpu       96 °C · throttled to 408 of 1800 MHz (level 6 of 6)

Both readings, because either alone is half an answer. The cooling state names heat as the
cause but is an index into a frequency table, so "6 of 6" says nothing about what was lost;
the ceiling is what was lost but can also be a userspace policy rather than heat. The two
disagreeing — a lowered ceiling at level 0 — is itself the useful reading, and it is why
the level is printed rather than reduced to a yes.

Silent while nothing holds the clock down. An unthrottled board is every healthy robot, and
a clause worn on all of them is a clause nobody reads on the one that matters.

Worst cluster and deepest cpufreq cooler win, for the same reason `hottest_zone_c` takes the
maximum across zones: a big.LITTLE board throttles its big cores first, and reporting
`policy0` there would show a board running freely while the cores the loop is on are halved.
The cooling device is matched on its type *containing* `cpufreq` — this board spells it
`cpufreq-cpu0` and other kernels spell it `thermal-cpufreq-0` — which also keeps the devfreq
coolers beside it out of the answer, since a GPU at its floor says nothing about the loop.

Reported, never judged. Same rule as the battery and the servos, and the strongest case of
the three: gating on a throttled clock would roll back a release on a board that had got
warm once, then judge its replacement on the same hot board — so the release that fixes the
heat is the one the gate would refuse to keep.

`robotctl monitor` says it too, on the uncut half of the power row rather than beside the
temperatures. The temperatures are nice to have and get dropped on a narrow row; this
explains a robot moving badly, and it is the wrong thing to lose to a terminal's width.

API v32: one `Option<CpuThrottle>` on `HealthResult`. `None` is "this robot does not say" —
an older `robotd`, or a board with no cpufreq sysfs — so a robot on an older daemon prints
exactly the line it printed before.

Assisted-by: Claude:claude-opus-5
2026-09-21 12:22:14 +02:00
Pierre Rouanet a299eb30ff pad: a bonded pad cannot reconnect while a phone is connected
Found using the phone app. The two faults this page already records are about
bonding; this one is about coming back, and it is what somebody using the app
meets first.

With the pad already bonded and trusted: app connected and the pad switched on,
it never connects. App quit, it connects immediately. Pad connected first and
then the app, both work. So whichever link is established first is kept and the
second can be added — but a new central connection cannot be started while
`btd` holds a peripheral one.

An explicit `bluetoothctl connect` says so rather than timing out:
`le-connection-abort-by-local`, which is the local host giving up rather than
the pad refusing. BlueZ's background auto-connect fails the same way, which is
why the pad just sits there.

Worth ruling out explicitly: `btd` is **not** advertising at the time — it
stops while a central is connected, which is why `duckctl scan` cannot see a
robot somebody's phone is talking to. So this is not fault 2 in another
costume. Advertising is off and initiating still fails.

The obvious fix does not work: a poller in `configd` or `padd` that connects a
trusted-but-disconnected pad is making exactly the call that returns the error.
The two that would work — `btd` dropping its link whenever a pad wants one, or
a pairing sequence driven across a deliberate disconnect — are real work
against a chip this page is otherwise about replacing.

So the answer is the order that works, written down: turn the pad on before
opening the app. `pad.status` reports `paired` and `connected` separately, so a
client can see this state and say it rather than leaving somebody pressing the
Xbox button at a robot that is ignoring it.

Assisted-by: Claude:claude-opus-5
2026-09-17 14:25:37 +02:00
Pierre Rouanet 785614539b media.frame: carry the mount angle, and serve an upright PNG
A frame off the tee is the picture the sensor took, and this robot's camera
is mounted a quarter turn off — so a snapshot came out sideways with nothing
in the reply to say by how much. The geometry cannot recover it: a 180° mount
is indistinguishable from an upright one, and a quarter turn is only a guess
from the aspect ratio.

`MediaFrameHeader` now carries `rotate`, degrees clockwise from upright, the
same number `media.video` already tells a WebRTC peer — and zero when
`--flip-in-pipeline` turned the pixels, the rule the detector's sampler and
the JPEG streamer already follow. `valid_uyvy` refuses anything that is not a
quarter turn, so a nonsense angle is rejected rather than silently ignored.

The console's `/frame` applies it instead of reporting it. That route is the
one consumer with nowhere to put an angle: a PNG opened in a browser carries
no metadata a viewer will act on, so reporting it there would hand every human
a sideways picture and no way to know why. It costs one rotation per request
on a blocking thread, not one per frame in front of the encoder, which is what
made `videoflip` expensive.

The recipe in npu-bringup.md grew the `-vf transpose=1` it was missing; it
produced a sideways image and said nothing about it.

Assisted-by: Claude:claude-opus-5
2026-09-14 14:07:35 +02:00
Pierre Rouanet a180788e74 Merge remote-tracking branch 'origin/main' into feat/media-frame 2026-09-14 13:48:31 +02:00
apirrone 35edb84713 Merge remote-tracking branch 'origin/main' into detector-from-hub
# Conflicts:
#	mediad/src/main.rs
2026-09-10 17:32:31 +02:00
apirroneandClaude Fable 5.1 c49fcd8d21 Rename [detect] to [duck_detector], and robotctl detect to duck-detector
In robotctl configure, `detect.enabled` one line from `chorale.accept` read as
"detect what?". The section, its struct (DuckDetectorParams) and the robotctl
namespace are named for the thing detected. A file that still says [detect]
loads through a serde alias and the editor carries it to the new name on its
next save, the way [imu_head] was handled.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-10 16:51:08 +02:00
apirroneandClaude Fable 5.1 c0479c16b7 The duck detector comes from the Hub, the way the policies do
mediad reads its model from /opt/robot/detector/current rather than from
inside the release. The release's postinstall hook seeds that directory
from a pin in [workspace.metadata.detector] (pollen-robotics/
microduck-duck-detector@duck-v1) with scripts/seed-detector.sh, which is
seed-policies.sh with a fixed file list and the same rules: a floor not a
ceiling, nothing partial goes live, never touch a set it did not install.

`robotctl detect check` and `sudo robotctl detect update [--version]`
are `policy check`/`update` against the other root — new updaterd calls
detector.check / detector.install (API v28), sharing the policy set's
types, provenance record and install path. An install restarts mediad,
which is where the model is loaded, and reports whether that took.

The 14 MB of vendored weights leave the repository and the three
packaging sites; xtask holds the pin, the file list (script, updater,
robotd-params) and the packaging together.

The model repo shares its name with the dataset repo. The robot only
addresses the model (resolve/ without a datasets/ prefix, api/models/),
which is written down where the URLs are built.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-10 16:43:50 +02:00
Pierre RouanetandClaude Opus 5 50164b8369 [media] camera is now source, because false did not mean off
`camera = false` does not mean "no video". The WebRTC control channel rides the
video track, so a pipeline that never starts costs a robot its control surface
along with its picture, and what the key actually selects is *synthetic* video —
a test pattern. Nothing in a boolean named `camera` said so.

That is not a hypothetical misreading. A board in the fleet was set up with
`camera = false` because it was not using its camera, and it spent every idle
minute drawing 720p30 test frames for nobody at five times the CPU the real
camera costs. The key answered a question nobody asked ("is there a camera?")
instead of the one that matters ("where does the video come from?").

So: `source = "camera"` or `source = "test"`, `MediaSource` in `robotd_params`,
`Kind::Choice` in the registry so the editor cycles names rather than toggling a
bool, and `MediaParams::geometry` matching on it. `mediad` matches too rather
than testing for equality, so a third source added later fails the build here
instead of quietly arriving as a test pattern. `--sim-camera` is still a flag and
still wins: it carries an address, so it was never expressible as a choice.

**The install consequence.** A `robotd.toml` carrying `camera = false` gets the
unknown-key warning this file has given retired keys since the `[chorale]`
incident — ignored, named in the journal, not fatal — and this build's default,
which is the camera. So a board deliberately set up without one starts using it
again until somebody writes `source = "test"`. Refusing to boot over an inert
key is the worse failure and the rule here is already settled; a test pins that
the old key is ignored rather than parsed into something.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-10 12:47:51 +02:00
Pierre RouanetandClaude Opus 5 fb2d8a8d30 The test pattern was drawn at the camera's resolution
A board with `[media] camera = false` streams `videotestsrc`, so a robot with no
camera still has a whole session — signalling, negotiation, the datachannel, the
control API all ride the video track, and a pipeline that cannot start costs
every one of them. It ran at `[media] quality`, the same rung a camera streams
at.

The difference is where the pixels come from. A camera's frames arrive off the
ISP in hardware and cost `v4l2src` almost nothing to hand on; a test pattern's
are drawn by this process, one packed UYVY frame at a time. Two boards of the
same model, both idle with nothing connected:

| source | idle `mediad` |
|---|---|
| `Camera`, rkisp | 6.1% |
| `Test`, 720p30 | 29.4% |

Five times the cost of the thing it stands in for, to synthesise 1.84 MB thirty
times a second for a tee whose readers had all said no — `camera.json` on that
board read `"frames":23142` against `"consumers":0`. The raw branch already
declines to copy a frame nobody asked for; nothing had asked whether the frame
was worth drawing.

So a test pattern gets its own geometry: `TEST_PATTERN_GEOMETRY`, 256x144 at
5 fps, 16:9 with both axes a multiple of 8 like every `Quality` rung, 73 KB a
frame. That is 0.7% of the pixel rate, and it is not a compromise — nothing in
what the pattern is *for* wants resolution.

**The resolved geometry is what gets published and logged**, not the configured
rung. `media.video` tells a peer what the robot is actually producing, and the
startup line no longer names a resolution nothing is emitting. `--sim-camera`
keeps the rung: a simulated camera is a camera, and `mediad` applies that
precedence in the one place it picks a source.

`robotd_params` owns the rule rather than `mediad::pipeline`, which is a
testability decision: `pipeline` is Linux-only for GStreamer, and the question
of what geometry a source runs at is answerable — and now tested — on any host.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-10 12:42:09 +02:00
Pierre Rouanet 69ccd5f03e Merge pull request #249 from pollen-robotics/tof-on-demand-spec
The head IMU is off by default, and the measurements that got there
2026-09-10 09:48:29 +02:00
larai-w 291bd901db Expose fresh camera snapshots through robotctl and HTTP
Support hello on the local frame socket, bound clients and reads, and claim configurable sockets without unlinking live listeners. Validate binary replies and expose uncached PNG snapshots on the console.

Assisted-by: OpenAI Codex
2026-09-10 08:38:09 +09:00
larai-w c87d47b38f Merge upstream main for media.frame review follow-up 2026-09-10 07:52:15 +09: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
Pierre RouanetandClaude Opus 5 4d287d17a9 The theremin ships off, like the chorale
`[theremin] enabled` was on by default, so every duck with audio held a
subscription to `tofd`'s depth stream from boot for a party trick nobody had
asked for. It is opt-in now, per duck, the same way `[chorale] accept` is and
for the same reason: it moves the beak.

The refusal had to be split to make that liveable. `robot.theremin` answered a
switched-off duck with "no depth frames -- the ToF sensor is not delivering (is
tofd running?)", which was the right sentence for a wedged sensor and is now the
common case for a duck that is working perfectly. The params gate is read once
at startup, beside `has_voice`, and it names the key; the depth complaint stays
for when depth is genuinely the problem.

Nothing about `tofd` changes. It ranges and polls whether or not anything is
subscribed -- no subscribers is its normal state -- so `robotctl monitor`'s ToF
grid works exactly as before on a duck that has never played a note, and no
component starts or stops that unit.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-09 15:18:04 +02:00
larai-wandClaude Opus 5 6c309f091e mediad: answer one raw frame on a local socket (media.frame)
`npu-bringup.md` names this: "a call that answers with one frame. Useful for far
more than perception (a snapshot in the console, a still for a bug report), and it
makes capture stop fighting the daemon."

A frame stays off the WebRTC control channel. At the default geometry the UYVY
payload is ~1.8 MiB, so JSON/base64 would make a control request several MiB and let
a slow peer tie camera data to the network. The socket answers one JSON-RPC header
naming a byte count, then precisely those bytes.

It asks the tee for the next frame rather than taking a cached one. `Frames` is a
rendezvous, not a cache — the capture branch copies a buffer only when a reader has
asked for one — so a caller waits for the capture that answers it, bounded by
FRAME_TIMEOUT, and a camera that has stopped is reported as a timeout rather than
answered with the frame it stopped on. `next_frame` parks on a condvar, so it runs
on a blocking task rather than the runtime thread.

The socket is handed to the `robot` group after binding, the same way `tof` and
`padd` hand over theirs, with a missing group a warning rather than a failure: mode
0660 alone would leave it `mediad:mediad`, and the operator is only ever added to
`robot`.

The request read is bounded before the line is buffered rather than checked after,
so a client that never sends a newline cannot make this process hold an unbounded
string.

`Frame` gains `captured_at`, which is what makes a snapshot joinable to a separately
sampled robot state. It is observation time, never used to pace capture. Under the
demand-driven tee it costs one clock read on a frame someone already asked for.

`architecture.md`'s service table said `mediad` had no unix socket of its own.
Giving it one is a deliberate change to the service split, so that is updated here.

Five tests cover the timeout, an unknown method (which must not leave demand behind),
an oversized request, a request with no newline at all, and a delivered frame whose
header names exactly the bytes that follow.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RP691H7VvDPD8yQvTgEW7G
2026-09-09 20:29:32 +09: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 50bdd66552 A robot can belong to a Hugging Face account
Three calls — `account.login`, `account.status`, `account.logout` — reachable
locally, over BLE and over a WebRTC datachannel. Nothing consumes the credential
yet; that is the relay, and this is what it needs to exist.

The flow is RFC 8628. `login` asks Hugging Face for a device code and answers
with it; `updaterd` polls; a client comes back to `status`. That shape is the
requirement rather than a convenience: a phone that opens a browser to show
somebody the code backgrounds itself, and iOS then tears the GATT link down, so
a login that reported success by holding a connection open would work from a
laptop and fail from the device it is for.

Hugging Face ships a first-party public device-code client, so this registers no
OAuth app anywhere. Two things came out of running the flow against the real
service, and both changed the design:

A token lasts 30 days and its refresh token **rotates**. So the store is two
strings plus an absolute expiry, `maintain` renews at a week left rather than on
the last day, and the one window rotation leaves open — HF issued a new pair, the
board lost power before the write — is named in `Store::save` and surfaces in
`status`, because no write ordering can close it.

The token also carries **every scope HF grants**: write-repos, manage-repos,
jobs, read-billing. That client takes no `scope` parameter. A duck holding a
credential that can push to its owner's repositories is worse than it needs to
be for something whose job is proving an identity, and the fix is a public app in
the org with `openid profile read-repos` — one constant here, one click there.
Recorded as the thing to do before a duck ships rather than done, since the flow
works today and a scope change is a re-login.

`updaterd` owns it for `policy.*`'s reasons: the network stack, and a credential
that also reaches a private Hub repo. `/etc/robot/hf-token`, root:robot, 0640 —
not `robotd.toml`, where `configure --list`, the config editor and the "what
changed on this robot" report would all print it. Written 0600 and relaxed after
the group is set, rather than through `fsutil::write_atomic`, which does not set
a mode: a token that lands 0644 and is chmodded a moment later is world-readable
for that moment.

Routing `account.login` to WebRTC is the decision worth reading. It is the only
call on that transport whose effect outlives the session the way an account does
— it converts having been on the wifi once into remote access that outlives being
there. Permitted anyway, with the argument and its three mitigations in
`mediad::route`: a robot already signed in refuses by name, the binding is
readable by anybody without authorisation, and it is revocable from more places
than the robot.

That also means `mediad` needed `allow_users` in updater.toml, so two files now
have to agree — hence `only_these_mutating_calls_are_reachable_over_webrtc`, the
named list `btd` has had since BLE could apply an update.

**Writing that list down found two methods nobody had noticed were broken.**
`policy.install` and `policy.fetch` are routed to WebRTC and `mediad` was not in
`allow_users`, so `updaterd` answered them PERMISSION_DENIED: the console could
offer a Hub browser whose install button could not work. The line added here for
the account fixes them too. Which is the argument for a named list over a counted
one — it is where a transport's authority and a config file's grants are made to
agree out loud.

`API_VERSION` 21 → 22, additive.

Assisted-by: Claude:claude-opus-5[1m]
2026-09-02 17:41:04 +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 77adf18b95 Somebody else's gait, from any Hub repo, into one slot
`robotctl policy load walk RemiFabre/microduck-flamingo-cycle` fetches a policy
into /var/lib/robot/policies/<org>/<name>/<rev>/ and runs it, and `robotctl
policy search microduck` says what is out there. Both through updaterd, which is
the process with a network stack.

Looking at what people have actually published changed the design rather than
confirming it. There are already several microduck policies on the Hub, and they
share two conventions nobody wrote down here: one `policy.onnx` at the repo
root, and a `manifest.json` carrying obs_len, action_len, model_api,
robot.model, a name, a kind and a description.

So the fetch reads the manifest first. A policy that says it is 51-D, or needs a
newer daemon, or is for a different robot, is refused before 800 KB is
downloaded and before the robot is asked to run it — the same verdict robotd
would reach at load, arriving somewhere a person can act on it. That is also
where `model_api` stops being the thing updater-design.md §5.5 specified and
neither side implemented: robot.modelApi answers, and this is what asks.

Three rules keep the manifest from becoming a trap. It is untrusted, so it can
refuse and never bless — one that lies is caught by the shape gate, which is
where the real check has always been. Absence is not evidence: a repo without
one is accepted, because most of the Hub follows no convention of ours and
refusing on silence would reject nearly all of it, including one of the three
policies published today. And the numbers it is checked against now live in
duck-ipc-proto, with a compile-time assertion in duck-control that the two
agree, because a contract with whoever publishes a policy belongs where both
sides of it can see it rather than in two copies.

Origin is the org in the path, which is why the library mirrors the repo: a
stranger's policy reports `community` with no lookup and no sidecar read. It is
a label and not a boundary, and the comment says so — anyone who can edit
robotd.toml can name a directory whatever they like, and anyone who can do that
can run whatever they like anyway.

A repo carrying two policies is refused by name rather than guessed at. None
does today; picking wrong means running the wrong network on a real robot.

Checked against all three published policies: two pass the manifest gate on
their real fields, and the one with no manifest is accepted for the shape gate
to judge.

Assisted-by: Claude:claude-opus-5[1m]
2026-08-31 16:56:06 +02:00
Pierre Rouanet 53902b634e A retrained gait now reaches a board without a daemon release
Slice 2 moved the policy set out of the artifact and onto the Hub, and this
section of the design claimed that bumping the pin was therefore "the whole of
shipping a new gait: no daemon release". That was wrong, and wrong about the
thing the channel exists for: the pin lives in Cargo.toml and in
seed-policies.sh, both of which ship inside a daemon release, so bumping it
needs exactly the release it was supposed to avoid.

The pin is a floor. It decides what a freshly provisioned board installs, and
`robotctl policy check` / `policy update` is how a board moves past it — which
is the part that needed building, and now exists.

  policy.check    what is installed against what the repo offers
  policy.install  fetch a revision and make it live

Both on updaterd, because they need a network stack: robotd has none by design
and robotctl must not link one, being the tool that has to work when everything
else is broken. `check` is a read and stays ungated and answerable during an
update; `install` is mutating and takes the engine lock, because two things
rewriting what the robot runs at once would be decided by whichever finished
last.

Three things worth their own lines.

The repo comes from the set, not from configuration: each installed set carries
a `.source` record naming where it came from, written by whatever installed it.
Nothing configures the repo twice and there is nothing to drift, and a set some
future tool installs answers the same question the same way.

Newest is the repo's own newest reversed, not a semver sort. A policy repo is
not obliged to use semver and ordering `bouncy-2` against `v10` would be a guess
presented as a fact — so `check` prints every revision and lets a person choose,
which is also what makes going *back* a first-class thing rather than an
afterthought.

And robot.reloadPolicies, because installing a set swaps `current` underneath
unchanged paths: every slot still resolves to the same string, so loadPolicy is
right about the paths and wrong about the bytes. It is never short-circuited —
"already loaded" is the answer it exists to disbelieve.

That last one nearly shipped a bad bug. The intent was a pair of Options, in
which "reload" and "reset every slot" are the same value, so the reload at the
end of every install would have silently discarded every `policy load` on the
board. Three things to say needs three things to say them with; it is an enum
now, and a test says a reload is not a reset.

API_VERSION 17 -> 18. Refused over BLE, and over WebRTC too: a daemon update
that goes wrong reverts itself, while a gait that goes wrong walks badly, which
nothing detects and only somebody watching the robot can judge.

Assisted-by: Claude:claude-opus-5[1m]
2026-08-31 15:52:41 +02:00
Pierre Rouanet ef4becf1b2 policies/ leaves the repository, and six megabytes leave every daemon release
The set is on the Hub at pollen-robotics/microduck-policies, so the copies here
have nothing left to do. Verified before deleting: the real fetch pulls all nine
files and every one is byte-identical to what was vendored.

Gone with them: the nine --include lines at each of the three packaging sites,
and every_policy_in_the_repo_is_packaged, which existed to keep those three
lists honest against this directory and now guards nothing. The transitional
fallback goes too — seed-policies.sh no longer takes a release directory,
because there is no longer a release copy to fall back on.

A board that cannot reach the Hub on a first install therefore has no gait, and
that is the accepted shape rather than an oversight: robotd holds its pose and
reports degraded, so the update gate passes and nothing rolls back, and the next
update fetches. It is the bargain setup-board.sh already makes for ONNX Runtime
and setup-gstreamer.sh for the plugins — a board needs a network once. What the
seeder must never do is *fail*, since a non-zero exit from the post-install hook
would roll back a release over a network problem that had nothing to do with it;
every error path exits zero and says so on stderr.

The provenance table moves to policy-channel-design.md §10 rather than being
deleted with the README. It records which upstream training run each role name
points at — including the roller_crouch typo fix — and that mapping is not
recoverable from the file names on the Hub, so this repository was about to be
the only place it had ever been written down and then not be.

The pin is still v1 and the tag does not exist yet, so boards keep whatever they
have and the fetch starts working the moment it is created.

Assisted-by: Claude:claude-opus-5[1m]
2026-08-31 14:43:07 +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 eefde4d8d6 Merge branch 'main' into install-path-rule-reachable 2026-08-27 16:59:39 +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
Pierre Rouanet 5f873c64e5 Merge branch 'main' into update-show 2026-08-27 15:34:26 +02:00
Pierre Rouanet 1baba31204 Record what an update did, and add robotctl update show to read it
`robotctl update log` says an attempt happened and how it ended. Nothing said
what it *did*, and the timeline that would have — preflight, checking,
downloading, verifying, extracting, the hooks, the swap, the gate — was
generated and then thrown away. `Engine::apply`'s `emit` closure sent each phase
to `update.subscribe` and nowhere else, so the state machine's account of itself
existed for exactly as long as a client held a socket open. An apply that nobody
watched left, in the journal, one `mutating request` line, the hook's output,
and whatever went wrong. An outline with the middle missing.

So the phases now go somewhere that outlives the socket, and there is a command
that reads them back.

## The record

One file per run, `runs/<id>.jsonl` under `state_dir`, `fsync`ed per line. Not
the journal, for the reason the update log is not the journal either: `/var/log`
on this board is zram, so `Storage=persistent` buys survival of a clean reboot
and not of a power cut — and the updates anyone needs this for are
disproportionately the ones that end in a power cut. `state_dir` is already
validated to sit outside every `install_dir`, so a swap or a rollback cannot
destroy the account of the swap or the rollback.

A run holds the target as the caller named it, the source, who asked (from
`SO_PEERCRED`), the verified manifest — version, hash, size, URL, **which**
trusted key admitted it, the revision it was built from — every phase with the
time it took, hook output verbatim with its exit code, each unit restarted and
what systemd said, the gate's verdict, and how it ended. `LogEntry` gains a
`run` number pointing at it, so `log` and `show` compose the way `git log` and
`git show` do.

`ProgressTx` + `emit` become one `Recorder`. They were always the same event
seen twice, and two parameters made it possible to tell one and not the other —
which is precisely what had happened.

Recording never fails an update: every write is best-effort and reports failure
to the journal. An update that completed and lost its diary beats one abandoned
to keep the diary honest.

Rollback, select and reset-to-golden get transcripts too. They stream no
progress today and still do not; "the robot is on an old release and nobody
knows why" is answered by a rollback's transcript at least as often as by an
apply's.

## Runs that end somewhere else

A daemon update restarts `updaterd` itself, so its transcript stops mid-flight
by design and the verdict lands minutes and a reboot later, from the
boot-counter trial. That revert opens a run of its own — the first process is
gone and cannot append — and the pairing is made legible instead: a transcript
with no `ended` is a run whose verdict is elsewhere, and `show` says so where
the verdict would have been. The rescue-to-golden path, run by a shell script
before `updaterd` starts, gets a thin run rebuilt from its breadcrumb, marked
as second-hand.

## The command

`robotctl update show [run]`, defaulting to the most recent, which is nearly
always the one meant. Times are UTC — that keeps a timezone database out of the
one crate whose dependency tree is small on purpose, and `journalctl --utc`
makes the two halves of the output agree for free. The `+` column is the gap
since the line above, because the question a transcript gets asked is where the
two minutes went. Long fields — the artifact URL, hook output — go in a gutter
so no row runs off the side of a terminal.

Then the journal for the same window, scoped to the units the run itself says
it touched, so a release that adds a daemon is covered the day it ships. Run by
`robotctl` rather than served by `updaterd`: reading the system journal is a
privilege the daemon has and should not lend out over a socket whose read side
is deliberately ungated. An operator without journal access gets the transcript
and the `journalctl` line to run for the rest, rather than an empty heading.

`update log` stops printing one compact JSON object per line — which is what a
diagnostic command prints when it *cannot* parse what it got, not when it can —
and prints the run number, the time, the versions and the outcome.

`API_VERSION` 15 → 16 for `update.show`. Additive; an older `updaterd` refuses
it by name, which is the designed skew behaviour. Permitted over BLE and over
the datachannel on the same footing as `update.log`: read-only, and the
question an owner whose update failed actually has.

Assisted-by: Claude:claude-opus-5[1m]
2026-08-27 15:32:26 +02:00
Pierre Rouanet dc8b8cb83b The numbers the NPU page asked for, from a board
`## Numbers` shipped as four empty rows and "fill in from a real board". Three of
them are now filled: driver 0.9.8 against runtime 2.3.2, 25.7 ms p50 and 58.4 ms
p95, and 63 °C at the end of a paced run. Detections stays empty — it wants frames
somebody has labelled, and the run that produced these was against a camera
capture nobody had.

The cpu row comes with what it actually means, because the way `duck-bench` reports
it invites reading 20.7 ms as the NPU's cost. The latency column times `infer` and
`decode`; the cpu column is the whole loop's process CPU over frames, so it also
carries the 1280x720 to 320x320 letterbox, which is on the CPU and is not in the
latency at all. Whether the rest means `rknn_run` busy-waits is not known yet. It
is 4% of one core at 2 Hz either way, and that is the number people will quote, so
the page now says what is inside it.

Assisted-by: Claude:claude-opus-5
2026-08-27 15:07:31 +02:00
Pierre Rouanet a4be5a9425 The rule the install path keeps teaching, written where it is read
`updater-design.md` §9 described the hook contract — when it runs, what it gets,
what a non-zero exit costs — and never said what a hook is *for*. Its "typical
uses" line said config migrations, udev tweaks and data conversions, which is a
list narrow enough to read as "not this" for every case that has actually gone
wrong.

§9.1 states it instead: a release is not installed until everything it needs is on
the board, and the hook is the only thing that runs on every board on every update.
Shipping a file into the release directory is not installing it; shipping a script
there is not running it.

Three instances, in three shapes — units left where systemd never looks (btd,
203/EXEC), a GStreamer stack only provisioning installed, and now a setup-npu.sh
packaged beside the model and never called. The shape is identical each time: the
work was done, and the thing that makes the work reach a board was left out. It
survives review because the diff that adds the script looks complete.

The corollaries each name the test that enforces them, and the last one is why
none of this may be fatal: a board with no camera, no radio or no NPU is still a
robot, and a hook that failed the update over one would cost more than it saved.

Also here, both found by writing it:

- `install-path-gap.md` is under docs/project/, and three source comments plus the
  postinstall header pointed at docs/. The retrospective now points forward at the
  general rule rather than being the only place it is written down.
- §9's claim that successful hook output is discarded, and the matching open
  question in §17, were closed when hooks.rs started logging line by line. That is
  the same fix for the same reason, and it was found the same way: a grep of the
  journal for a hook that had plainly run came back empty.

Assisted-by: Claude:claude-opus-5
2026-08-27 14:49:50 +02:00
Pierre Rouanet 15afc9baf1 The update hook installs the NPU, like every other setup script
`hooks/preinstall` runs `setup-gstreamer.sh` and `setup-rkaiq.sh` from the release
on every update, never fatally, with their reports in the update log. This branch
added a third setup script, packaged it, and never wired it in — so a release that
ships a duck detector also shipped a manual SSH step before the model in it could
run, on every board, for ever.

The hook's own comment already says why that is wrong: "This is what the split
between provisioning and updating is for. `provision.sh` installs the stack on a
new board; every board provisioned before that existed ... is fixed by an ordinary
update instead of by somebody remembering a command."

`install_npu` is `install_gstreamer` with different words. A board with no NPU
still walks, still streams and still sees — on its CPU, via the `.onnx`, which is
why `DetectParams::models()` is a list rather than a choice.

The header's claim that this is "deliberately not run by the update hook" goes
with it. The reason it gave was that the runtime is a download, and
`setup-gstreamer.sh` downloads Rockchip's MPP and RGA debs from the same hook.

Three things found while wiring it up, each from a board rather than from reading:

- **The overlay was not pinned to its script.** `setup-npu.sh` compiles
  rk3568-npu-enable.dts from beside itself, exactly as `setup-rkaiq.sh` compiles
  its LD_PRELOAD shim — and only the shim had a test saying it must be packaged.
  Without the .dts the hook installs the runtime, cannot find the overlay, and
  leaves the node disabled: an update that succeeded, a detector on the CPU for
  ever, and one warning in a log. `the_npu_overlay_travels_with_its_script` now
  fails the build instead.

- **`rknn_init` named two causes and not the one every stock board hits.** A
  disabled device-tree node is not "a model built for another platform" nor "a
  driver older than the runtime", and the runtime's own line for it — "failed to
  open rknpu module, need to insmod rknpu dirver!" — sends people after a module
  that is built in. It reads the node now and says which of the three it is.

- **`mediad.service` named the wrong device.** `/dev/dri/renderD129` is panfrost
  on a Radxa Zero 3, and renderD128 is rockchip-drm, both held before the NPU
  binds at all. The `render` group is still required; the number never was.

Assisted-by: Claude:claude-opus-5
2026-08-27 14:45:21 +02:00
Pierre Rouanet 6006231c3c setup-npu.sh turns the NPU on, instead of explaining how to
Armbian ships `npu@fde40000` as `status = "disabled"` on every Radxa Zero 3, so
`--enable-node` being opt-in meant this script's whole purpose went unachieved on
every board it will ever run on: it installed a runtime that cannot reach an NPU,
then printed a diagnosis. Enabled by default now, `--no-enable-node` to opt out.

The comment defending the old default said rebooting somebody's robot is not a
thing a setup script decides — but the script never reboots, and says so twice.
What is actually left is that it edits /boot, which is one property appended to
`overlays=` rather than replacing it, compiled by dtc before it is installed,
with the previous file kept as `.before-npu`.

Three things follow from doing it by default:

- The driver state is read *before* anything is changed, so a board whose NPU
  already works no longer has its /boot touched on a re-run.
- A missing overlay source, a missing dtc and a non-Armbian layout all warn and
  carry on rather than dying. Opt-in, `die` only cost you what you had asked
  for; on by default it would have cost a script copied to a board on its own
  the runtime install as well, which is the half it can still do.
- The summary ends with the reboot and the `dmesg | grep rknpu` check, rather
  than leaving them in a warning further up.

dtc is installed rather than demanded. `setup-gstreamer.sh` installs its plugins
and `setup-board.sh` its DKMS toolchain; stopping to ask for one `apt install`
was a round trip for nothing. It returns non-zero rather than dying, because the
runtime is still worth having on a board whose apt cannot reach a mirror.

The header's reason for staying out of provisioning had gone stale in this same
branch — it said the model is not shipped in a release yet, and this branch ships
it. The reason that survives is narrower: the runtime is a download, and
provisioning that fetches from github.com fails in a room with no route to it.

Both docs pointed at the old two-step and at /usr/local/sbin/robot-setup-npu,
which cannot do the device-tree half on a first run: it looks for the overlay
beside itself, and the copy it leaves there has nothing beside it.

Assisted-by: Claude:claude-opus-5
2026-08-27 14:25:08 +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 a60e87c0b6 Merge pull request #158 from pollen-robotics/roadmap-rewrite
Roadmap: the first one reached its target, so this is the next one
2026-08-27 11:57:25 +02:00
Pierre Rouanet 4283e0ef4a Say what was decided, not what is about to happen
Everything the rewrite added about going public was written in the future
tense — "the repository goes public", "until it does", "until this week" — and
all of it reads wrong the day the flip happens. The decision is what these docs
record, so they now record the decision: *publish this repository*, phrased so
it is true on both sides of the switch and needs no second pass afterwards.
§6.1's heading loses its "so this one goes public" for the same reason.

`install-dev.md` had the sharper version of the problem: it walks a reader
through baking a GitHub token onto a board and `chmod 600`-ing it, listed as a
flat prerequisite. Once the repo is public that credential buys nothing but a
higher rate limit, and a reader following the steps unchanged would put one on a
board for no reason. The prerequisite and the by-hand section now say when a
token is actually needed — while the repo is private, or for the anonymous API
budget §6.1 documents. `provision-board.sh` already said this ("only while the
repository is private"); the docs were behind the script.

Two smaller things a public reader would hit:

- The link to `microduck_rl` 404s for anyone outside the org, and it is M8's
  central artifact. De-linked and named as private, rather than pointing a
  stranger at a page they cannot open.
- M6 no longer carries a delivery estimate. "Preorders are open" is the whole
  reason the section orders by lead time; "shipping is a few months out" is a
  schedule commitment in a versioned file, doing no work in the argument.

Not touched here, because it is a decision rather than an edit: `ci-setup.md`
states in bold that anyone with push access can read the release signing key,
and why no protection rule can be turned on. The roadmap links to it. That goes
public in the same flip and is worth settling first.

Assisted-by: Claude:claude-opus-5[1m]
2026-08-27 11:48:44 +02:00