Commit Graph
8 Commits
Author SHA1 Message Date
apirroneandClaude Opus 5.5 fa16f967ed autod: the duck chases the laser and plays with the ball; a tag switches it on
The brain gains two states, both driven by robotd and wanted by the brain:

- Laser: tracking is on whenever the duck could chase (not tired, not
  napping, petted or playing ball). A followed dot interrupts any
  standing or walking state; the chase ends 2 s after the dot goes, and
  costs twice a walk's energy. Below 0.2 the laser goes off and the duck
  naps; it comes back above 0.45.
- BallPlay: picked from the standing pool when rested and off cooldown,
  less often the more bored of the ball. No ball in 20 s backs off 3 min,
  doubling per miss up to 30. A game ends on 3-8 kicks, 1-3 min shrunk by
  boredom, the ball lost for 15 s, or tiredness; then 4-8 min of rest.

While robotd drives either, autod sends a zero twist and a centred head,
which robotd reads as nobody asking. A game somebody else started is
stood aside for, and the brain's own is switched off when the pad takes
over.

The on/off switch moves into robotd (robot.autonomous, read back in
robot.mode and robot.state; part of v59), so the NFC autonomous_mode tag
can switch it — nfcd cannot write robotd.toml. [autonomous] enabled is
now only where each boot starts; robotctl autonomous on|off switches it
now. autod stands the robot up on the switch's rising edge, and once per
boot for the switch at boot. padd learns it from robot.mode. mapd starts
mapping the first time it sees the duck switched on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 17:27:01 +01:00
apirroneandClaude Opus 5.5 b6b7990339 mapd: buffer the map save — a million syscalls became thirteen
serde_json wrote straight into the File, token by token: 967,464 write calls for a 1.2 MB map.
On graphite-bang, throttled to 408 MHz, a save of 52 keyframes took 21 s, and the worker that
places stops waited for it. Buffered: 13 writes, 7 ms on the laptop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 12:38:46 +02:00
apirroneandClaude Opus 5.5 2f191a0069 maploc: a map too young to be recognised starts over instead of staying lost
On the robot: the map wiped, one thin stop, then a sit — every stop after was searched for in
that one stop, refused, and kept in an island; the map never grew. Now:

- a stop made while lost, when the map has fewer than 3 keyframes, restarts the map there (decided
  at the first stop, not when the robot went lost: a bump puts it back on track — deciding at the
  pick-up dropped session 3's map at its two opening bumps and the bench failed badly);
- an island of 12 stops, twice the size of the map it cannot join, becomes the map.

Ground-truth bench: PASS, unchanged. New sim test reproduces the robot's case and fails without.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 12:30:34 +02:00
apirroneandClaude Opus 5.5 e03989a771 maploc: a stop costs the same in any map, and a covered place adds no scan
Every stop re-solved the whole pose graph, and every match to an old keyframe made its skyline
row dense back to it: 8 ms a stop at 50 keyframes, 390 ms at 600 (laptop, synthetic room), with
keyframes added at every stop forever.

- A stop re-solves only its 10 newest keyframes (Graph::optimize_only); the whole graph is
  re-solved on a loop closure, a relocalization, every 50 stops, and the moment the robot goes
  lost — the last was what the ground-truth bench asked for (two carries were no longer found).
- A whole-graph solve over 64 free nodes renumbers them (reverse Cuthill–McKee): in walk order a
  robot pacing one room made the skyline nearly dense, 55 ms an iteration at 380 nodes.
- A stop at a place two keyframes already cover keeps no scan: matched, it stays a graph node
  without one; unmatched, it is dropped and odometry spans it.
- mapd logs each stop's time and the map's size ("stop processed"), and the save's time.

600 stops of laps: 4 ms median per stop, ~120 ms for the rare whole-graph solve, ~250 scans kept
instead of 600, and the same accuracy after eight laps (8.1 cm vs 8.0 cm). Ground-truth bench:
PASS. Covering is not exercised by the recorded sessions at the default; with one view enough it
fails one seated carry at 16 cm (docs/design/mapping-design.md §3).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 12:12:29 +02:00
apirroneandClaude Opus 5.5 081fa1daa7 maploc: the sensor model, bumps and relocalization fixed against ground truth
Scored on pollen-robotics/SLAM_JJ_Salon_with_GT (a 4-minute session with the
robot's true pose and the scanned room). Before: lost at the first bump for
good, stops 12 cm off. After: stops within 3.3 cm median, 7.7 cm worst, a
seated carry of 1.34 m relocalized 4 cm from the truth, map precision 71 ->
81 % within 5 cm.

- ToF model, measured with the true pose: axial range, 60 ms latency, the
  sensor 3 deg further down than the kinematics (58 -> 81 % of returns on the
  room's obstacles). ProjectConfig/MapParams defaults; the simulator models
  the same sensor.
- A pick-up under brief_pickup_s is a bump: keep tracking (Event::Bumped),
  match the next stop in a wider window. Going lost over one never recovered.
- Tracking matches are gated by odometry's reach (track_max_correction_*):
  confident narrow-scan fits 30-50 cm off made the pose 7x worse.
- Relocalization is judged pinned in metres/degrees, heading allowed to come
  from the gyro-narrow window; carry/fallback searches look within +/-8 deg.
  The old 40 %-of-window rule refused every right answer (2-8 cm off).
- A refused stop no longer erases the pending candidate; agree_m 0.25.
- replay: --set key=value for any MapperConfig field, --tof-pitch-deg,
  --max-range.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 15:36:28 +02:00
apirroneandClaude Opus 5.5 9851e81ff7 maploc: a sit is a kidnap marker again
The pick-up detector watches only while the walking and standing networks
drive, so a robot sat down, carried across the room and stood up reported
nothing: the 2026-10-14 field test kept tracking from where it sat. The
first maploc treated the sit itself as the marker; the rewrite had dropped
it.

Standing up now ends the chain (LostCause::Sat, map.status lost "sat" —
additive, the field is a string) with the pose it sat at as a tight hint
(sat_xy_tol_m 0.15, sat_yaw_tol_rad 10°). Acceptance is still two agreeing
stops; a nearby search failing local_search_keyframes widens to the whole
map as for any other. A pick-up while seated is still a carry.

maploc::sim gains Step::Sit { secs, to }; sat-in-place resumes within three
stops on the spot it held (5 cm, 0.3°), carried-while-seated finds the new
place in six (9 cm, 3.7°).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 11:02:02 +02:00
apirrone c1937fc55f maploc: a brief pick-up is a bump, searched for nearby; every search logged
On graphite the pick-up detector fired for 0.36 s as a fall began, then the
limp fall: mapd read it as a carry, dropped the position and searched a thin
map everywhere at a strict uniqueness gate, and never found itself — silently.

- A pick-up shorter than brief_pickup_s (2 s) becomes lost=bumped with a
  nearby hint (±0.5 m, ±25°); a fall while lost widens a nearby hint.
- A nearby search that fails local_search_keyframes stops keeps the heading
  and widens to the whole map (±30°).
- Every relocalization search is an event, logged by mapd with its scope,
  window, candidate and the gate that refused it.
- The saved map is handed to the robot group (dir 0751, file 0640), so it
  can be copied off a robot and replayed.

maploc::sim gains Step::Stumble; the test reproduces the journal's sequence
and relocalizes in 2 stops (1 cm).

Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 16:57:25 +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