Start a new sandboxed app that does nothing but stay alive, read position,
read encoders, advertise and accept commands. No estimator, no steering law, no waypoints.
Then re-add the control loop one layer at a time, in dependency order, each layer testable
with only the layers beneath it. The minimal app is the measurement rig the existing
precision campaign already needs, and if it wins it becomes the sandbox app.
Where this came from
Verbatim: "im thinking if I create a totally new dotbot main file altogether! like, start
from a very bare minimal sandboxed app that can only do swarmit keepalive and swarmit
localization get position, and can send advertisements, and can receive stuff from radio,
and that's all (nothing of control loop). then, we slowly work to re-add a control loop,
picking the pieces in the right order."
Raised while reading why the arrival error resists tuning. The answer that kept
recurring is that the current app's faults are entanglement faults rather than algorithm
faults, and entanglement is cheaper to rebuild than to unpick.
Live state
Status done (closed 2026-09-25, close-out)Progress7 of 7 phasesValidatedhil (phases 4 to 6, v3 B4AB5A04DF9E2426 and 811EFD28FACDE21A, 2026-09-23 and 2026-09-24)
Created 2026-08-27Updated 2026-09-25Tracker DBK-129; initial heading for phase 5 is DBK-142Architecture survey complete; decisions incorporated into dotbot-next
Siblings Kalman primerA camera as the second witness, an idea for external ground truthA library of behaviours, ideaAn autoresearch loop, idea
Builds on the LH2 calibration wave, merged 2026-09-23 (DotBot-libs#31, swarmit#165, DotBot-firmware#424, PyDotBot#296), which carries phases 1 to 3 of this plan: the fix sequence and the deleted gate, dotbot-next, the NSC veneer swarmit_get_min_tx_interval_us() in a regenerated cmse_implib.a, the net core clearing a request before acking and dropping TX while not joined, ipc_network_info_t, the RTC timer re-arm fix, float32 homographies, the 10 x 10 m validity rectangle and device info v2.
Code refs phase 4, branch wheel-control in each repo, merged 2026-09-25: DotBot-libs#32 (caa788b), PyDotBot#298 (1ed5f7b), DotBot-firmware#425 (ff3e4c8); the wheel loop is now on main in all three repos. The loop as tuned untethered on 2026-09-23 plus the review fixes of 2026-09-24 (stall protection, mailbox, 700 mm/s cap).
Phase 5, branch estimator, merged 2026-09-25: DotBot-libs#33 (plain merge commit cd5f862, same tree as d2a88c5) and DotBot-firmware#426 (plain merge commit 21eba1b, after a final bump of its submodule to cd5f862 in e91c8df), with the kidnap rule, the phase 4 fixes, the 2-tick fix age and the hard-stop slip fix (floor-tested 2026-09-24): DotBot-libs d2a88c5, DotBot-firmware e91c8df (submodule at cd5f862), both on fork. The whole stack, phases 5 to 7 and the cut-over in both repos, was rebased onto main on 2026-09-25: linear, no merge commits, trees unchanged, every PR mergeable.
Phase 6, branch steering, merged 2026-09-25: DotBot-libs#34 (plain merge commit 55cefbe, same tree as 75e9033) and DotBot-firmware#427 (plain merge commit 9435f5f, after a final bump of its submodule to 55cefbe in a9fb650), single-target steering floor-tested 2026-09-24; phase 6 is now on main in both repos.
Phase 7, branch waypoints: DotBot-libs#35 merged 2026-09-25 (plain merge commit 739d285, same tree as 62f1f14) and DotBot-firmware#428 merged 2026-09-25 (plain merge commit 0e0ab7b, after a final bump of its submodule to 739d285 in c277e84); PyDotBot#301 merged 2026-09-25 (plain merge commit 6668874 of 9d2e148); and the pose-waypoints console, PyDotBot#302, merged 2026-09-25 (plain merge commit 3a38ee1 of 25c170f), floor-tested 2026-09-24; the waypoint half of phase 7 is on main in all three repos. Branches on fork.
Cut-over (phase 7), branch cutover, on main since its base was retargeted after #35 and #428 merged (DotBot-libs#36 rebased onto main to its own 3 commits and merged 2026-09-25 as c1ff6ca; DotBot-firmware#429 rebased onto main to its own 8 commits, its dotbot-libs pointers remapped to #36’s rebased commits, bumped to c1ff6ca in ac15985 and merged 2026-09-25 as db3cdb6; PyDotBot#303 already linear, rebased onto main after #302 (9d9fb84 to ae0ca6e, same tree) and merged 2026-09-25 as ab48d87, the last; the cut-over is on main in all three repos), PRs DotBot-libs#36, DotBot-firmware#429 and PyDotBot#303, floor-smoke-tested on 2426 2026-09-24: DotBot-libs b6027b3 (rebased to c11eb27, same tree), DotBot-firmware 7afb215 (submodule at the libs tip; rebased to ac15985, same tree apart from the submodule), PyDotBot 945a20e (rebased to ae0ca6e, same tree), all on fork. dotbot-next is now apps-sandbox/dotbot, the old sandbox app and drv/move are deleted; the bare apps/dotbot and drv/control_loop stay (phase 7 log).
Pose geometryPyDotBot#297 merged 2026-09-23, now under PyDotBot wheel-control; swarmit#166 was in review with it. What they carry: the geometry record with wheel paths, photodiode, reach, core and envelope; a body pose expanded from each LH2 fix; Body | Sensor console drawing; the controller skipping the -1000 no-heading sentinel that dotbot-next always advertises; and a simulator that withholds its heading until 50 mm of travel and steers its waypoint loop on the true angle. PyDotBot wheel-control is rebased onto the merge; the simulator still has to learn the wheel velocity command. Mm per count: see the open conditions (DotBot-libs#27).
Open conditions from the readiness verdict of 2026-09-23, before phase 4 closes and phase 5 starts:
Met 2026-09-23: an untethered measurement path, the reworked radio telemetry frame (every 10 ms step and every fix); with it the per-wheel feedforward, the spin threshold and check (a) over 10 s were measured on the cableless robot, and check (a) passes at 100, 200 and 300 mm/s.
Met 2026-09-23: distance per count is 0.0946 mm, from 28 counts per motor revolution, a 51:1 gearbox and a 43 mm caliper diameter. The 1428 nominal counts per wheel turn match 1430 ± 1.5 hand-turned (8 trials, both wheels) within 0.14 per cent, and the result agrees within 0.3 per cent with the 0.0948 ± 0.001 from 24 LH2 legs. geometry.h, the PyDotBot record and the dotbot-next gains carry it on wheel-control; DotBot-libs#27 is closed. The 2 per cent over the nominal 1400 is closed: the gearbox is about 51:1, not 50:1 (phase 4 log, 19:57).
Met 2026-09-23: check (c). At full duty with no slew limit the loop reaches 90 per cent from rest in 20, 40 and 55 ms at 100, 200 and 300 mm/s (10 ms speed), inside the 100 ms outer period, with check (a) still passing. The 75 ceiling was dropped by the developer's decision (3.10).
Partial 2026-09-23: check (b), shortened. Dev-corner is 1 x 1 m, so the straights are 0.52 to 0.80 m, on two robots, not 2 m on three: 6 runs each at 150 mm/s end 4 mm right of the start line on average (sd 7 and 10 mm, worst 16), heading change under 2 degrees; 4 runs at 400 mm/s end 11 mm left (sd 2). Not met: the between-robot spread needs a third robot and the full length (phase 4 log, 22:10).
Met 2026-09-23: the bench bot runs the merged main images, bootloader and net core from swarmit main and the committed dotbot app, after a recovery and an end-to-end run by the developer.
Measured 2026-09-23 18:11: open-loop duty against wheel speed on four trajectories (phase 4 log, Figures 4 and 5). Wheel speed stops 14 to 18 mm off on straights, open loop 76 to 230 mm off, and open loop failed to start in 11 of 45 runs, mostly at duties of 41 or below. Turning is under by 12 to 25 degrees with wheel speed, which is for the estimator. A zero setpoint coasts, which leaves 12 to 41 mm of run-on.
Requirement, stated by the developer 2026-09-23: seen from the outer loop the robot behaves close to a unicycle, with very sharp turns including turning in place. Phase 4 already gives independent per-wheel speed in either direction, a spin that stays within about 3 mm of its spot, push from rest, dead-zone braking and braking to zero; phases 5 and 6 owe a (v, ω) to wheel-speed layer on an effective track calibrated on the floor, and heading feedback from the estimator.
Measured 2026-09-23 22:10: the effective track, 229 spins and arcs on both robots against LH2 at rest (phase 4 log, Figures 6 and 7). It is not one number: 80.1 mm for a spin at 50 mm/s per wheel, 81.0 at 100, 83.0 at 200, 86.7 at 300 and 94 to 107 from 400 to 600; arcs of 100 to 250 mm radius give 84.9 (sd 1.5), rising from 81.5 at 20 mm through the pivot (82.1) to 84 at 100. Direction and robot change it by under 1 mm; the carpet by ±1 mm with the heading swept. The developer's decision: turn in place only below a trusted spin limit, and go fast only once aligned (the contract below).
The camera is a qualitative witness only: no number in this plan is taken from it until it is validated, and night frames are out. A first check on 12 fast spins before the lights went off (about 20:54) put the stream 5 to 9 s behind LH2, drifting, and camera minus LH2 rotation at +1.4 ± 7.2 degrees: too loose for a track.
Recommended 2026-09-23 22:10: phase 4 complete on its measurable conditions, (a), (c), distance per count, braking to zero untethered and the effective track, with (b) partial because of the space. Still open for phase 4: (b) on three robots over 2 m, the loop above 700 mm/s, and whether the encoder drops counts near its sample-rate limit. The chip stays active until the developer closes it and the phase 4 PRs merge.
The initial-heading design for phase 5, tracked as DBK-142.
TODO, not scheduled (phase 5, the developer's idea): lift detection. A wheel holding its setpoint at a duty far below the feedforward (duty ≈ 32 + 0.097 × mm/s), a large negative integral sustained, means it is lifted and unloaded; on detection freeze odometry, probably stop the motors, and re-acquire the pose when set down. Complements the kidnap rule (phase 5 log, 2026-09-24).
Merge order
Done 2026-09-25 06:41: DotBot-libs#32 merged with a plain merge commit (caa788b).
Done 2026-09-25 06:58: DotBot-firmware#425's submodule re-bumped to the new DotBot-libs main commit, then merged with a plain merge commit (ff3e4c8); PyDotBot#298 merged 06:54 (1ed5f7b), back to back with #425 as planned.
Done 2026-09-25: DotBot-libs#33 merged with a plain merge commit (cd5f862), after the whole stack was rebased onto main (linear, trees unchanged).
Done 2026-09-25 10:27: DotBot-firmware#426's submodule bumped to cd5f862, the merge of #33 on DotBot-libs main (e91c8df), then merged with a plain merge commit (21eba1b) once CI was green.
Done 2026-09-25 10:56: DotBot-libs#34 merged with a plain merge commit (55cefbe, 10:49); DotBot-firmware#427, already rebased onto main, got its final bump to 55cefbe (a9fb650) and merged with a plain merge commit (9435f5f) once all 32 checks were green.
Done 2026-09-25 11:54: DotBot-libs#35 merged with a plain merge commit (739d285); DotBot-firmware#428 got its final bump to 739d285 (c277e84) and merged with a plain merge commit (0e0ab7b) once all 32 checks were green.
Done 2026-09-25 12:00: PyDotBot#301 (9d2e148) merged with a plain merge commit (6668874) once all checks were green.
Done 2026-09-25 12:11: PyDotBot#302 (25c170f, 13 commits) merged with a plain merge commit (3a38ee1) once all checks were green; the waypoint batches are complete.
Done 2026-09-25 12:20: DotBot-libs#36 rebased onto main (b6027b3 to c11eb27, its own 3 commits, tree identical to a merge of the old tip), then merged with a plain merge commit (c1ff6ca) once all checks were green.
Done 2026-09-25 12:27: DotBot-firmware#429 rebased onto main (7afb215 to 1343219, its own 8 commits, submodule pointers remapped to #36’s rebased commits), given its final bump to c1ff6ca (ac15985) and merged with a plain merge commit (db3cdb6) once all 31 checks were green.
Done 2026-09-25 12:28: PyDotBot#303 rebased onto main (9d9fb84 to ae0ca6e, one commit, tree identical to a merge of the old tip), then merged with a plain merge commit (ab48d87) once all checks were green. The chain is complete.
Closed 2026-09-25 at the converge pass: what was still owed is carried out of this plan, listed in 08 Close-out.
Merge convention (set 2026-09-25): PRs land on main with a plain merge commit, not a rebase merge - #32 and #425 landed this way; #298 landed as a rebase merge before this was settled. A plain merge commit does not rewrite the branch's own commits, so a DotBot-libs branch stacked on an already-merged one (#33 on #32, and so on through #36) keeps the same commit ids and stays mergeable and CI-green on main with no rebase. A DotBot-firmware PR gets a final dotbot-libs: bump to ... merge on main commit before it merges, moving its submodule to its libs PR's merge commit on DotBot-libs main, so firmware main always points at libs merge commits: #425 at caa788b, #426 at cd5f862. The next firmware PR then conflicts on that submodule line and is rebased onto main when its turn comes. If any other stacked branch conflicts, the fix is a local rebase onto main and a developer force-push; the agent never force-pushes itself.
The chain as each PR body states it: DotBot-libs#32, PyDotBot#298, DotBot-firmware#425, DotBot-libs#33, DotBot-firmware#426, DotBot-libs#34, DotBot-firmware#427, DotBot-libs#35, DotBot-firmware#428, PyDotBot#301, PyDotBot#302, DotBot-libs#36, DotBot-firmware#429, PyDotBot#303.
Interface contract of the wheel loop (phase 4, measured 2026-09-23 on two untethered v3 robots, dev-corner carpet), what phases 5 and 6 may rely on:
Input: one speed per wheel in mm/s, either sign, clamped to ±700 in dotbot-next and bounded to ±700 at the REST API; a zero setpoint brakes the wheel until it stands, then releases it.
Stall protection: a wheel held at duty 80 or more with no encoder counts for 500 ms coasts and is flagged stalled (PWM_STALLED = -127 in bench telemetry). A changed setpoint or a reset clears it; repeating the same setpoint does not.
Command mailbox: the newest command wins; the deadman is refreshed only by drive commands.
Settling: 90 per cent of a step from rest in 20, 40 and 55 ms at 100, 200 and 300 mm/s; not characterised above 300.
Steady tracking: within 1 per cent of the setpoint from 20 to 600 mm/s per wheel (100.2 to 100.7 at 100, 605 at 600), with no measurable change as the battery fell from 2.95 to 1.0 V: the duty at 100 mm/s stayed at 38 to 40 throughout.
Minimum speed: 15 mm/s holds within 5 per cent; 10 mm/s runs 12 per cent slow and counts arrive in pulses; 5 mm/s runs 40 to 47 per cent slow. Measured at 1.1 to 1.3 V only.
Maximum speed: 600 mm/s holds with under 6 per cent of steps at the duty ceiling; 700 holds with 30 to 40 per cent at the ceiling (2.9 V); 750 and 800 saturate. Straights may use up to 600, and up to 700 on a charged battery.
Trusted spin limit (developer's decision: turn in place slowly, go fast only once aligned and straight): 200 mm/s per wheel, about 275 deg/s, with an effective track of 82 mm. Across 50 to 200 mm/s the spin track is 80.1 to 83.0 (sd at most 0.6, direction under 0.2), so 82 is good to ±2 per cent; at 120 mm/s (170 deg/s) 81 is good to ±1 per cent. At 300 the track is 86.7, and at 400 to 600 a commanded turn loses 13 to 30 per cent. For arcs of 100 mm radius or more use 85.
Run-on at a stop, brake to zero: about 0.05 s times the speed: 3.4 mm from 100, 6.0 from 150, 8.7 from 200, 15 from 300, 19 from 400, 26 from 500, 32 from 600, 37 from 700, stopped within 100 to 210 ms.
For phase 6: its 100 ms period is only about twice the settle time, so the outer loop must model this lag and the run-on rather than assume the speed it asks for is instant.
Review summary
Phases 1 to 3 shipped in the LH2 calibration wave, merged 2026-09-23. Phase 4 (the wheel loop) is written and was driven untethered on two robots on 2026-09-23, where it passes checks (a) and (c) after the step-rate fix, a stall push, braking through the motor dead zone and a full-duty ceiling; braking to zero at a stop was added after (18:51) and measured untethered at 22:10, with the effective track, the speed limits and a shortened check (b) on two robots. The three phase 4 PRs merged 2026-09-25 (DotBot-libs#32, PyDotBot#298, DotBot-firmware#425), landed in that order; the wheel loop is now on main in all three repos. The whole stack was rebased onto main on 2026-09-25, linear with identical trees, and DotBot-libs#33, the phase 5 estimator, merged the same morning, and its app side, DotBot-firmware#426, followed after a final bump of its submodule to #33's merge commit (merge convention); phase 5 is on main in both repos. The two phase 6 steering PRs, floor-tested on 2026-09-24 (5.0 to 7.2 mm misses for a 5 mm threshold, never past the target; phase 6 log), merged 2026-09-25: DotBot-libs#34, then DotBot-firmware#427 after a final bump to #34's merge commit; phase 6 is on main in both repos. The phase 7 waypoint PRs followed, DotBot-libs#35 and DotBot-firmware#428 merged 2026-09-25 (the latter after a final bump to #35’s merge commit), as did PyDotBot#301 and the pose console, PyDotBot#302, so the waypoint half of phase 7 is on main: batches, poses, a completion report, lost-packet resend, max speed and precise arrival, floor-tested the same day (mean axle miss 1.5 mm at a 1 mm threshold; new app 6 of 6 arrived against the old one's 2 of 6; phase 7 log). The cut-over followed as DotBot-libs#36, DotBot-firmware#429 and PyDotBot#303: dotbot-next replaces the old sandbox app and drv/move is retired for an odometric goal on the wheel loop; the bare apps/dotbot stays on the old loop until it is ported. The developer reviews and merges phase by phase; the cut-over is complete: DotBot-libs#36, DotBot-firmware#429 and PyDotBot#303 merged 2026-09-25, so all seven phases are on main. The plan closed on 2026-09-25; the docs sweep and the unrun checks are carried out of it (08 Close-out).
Headline result (Figure 9, results slide): against open-loop PWM the wheel-speed loop stops 5 to 15 times closer on straights (14 to 18 mm against 76 to 230) and never failed to start (0 of 16 runs, against 11 of 45).
Lines added / removed by the plan's code PRs, all merged (closed ones left out), from git diff --numstat on each PR's own range as of 2026-09-25: each PR against its merge commit's first parent, so nothing counts twice. Test means tests/, test_*, *.test.* and the console's dev/ fake server; DotBot-libs projects/ count as code. Not counted: seven dotbot-libs submodule bumps and two cmse_implib.a binaries; the bumps, at +1 / -1 each, are the whole difference from the GitHub counts in the rows above, which sum to +17644 / -3378.
01Why rebuild rather than repair
The faults are entanglement, not algorithms
timers
3 of 3usable RTC0 channels already taken; an encoder tick has nowhere to go
latching gates
2the same absorbing structure in the app and again behind the NSC boundary
motor writers
5calls to db_motors_set_speed() with no precedence rule between them
LH2 code needed
0lines, in a sandbox app: the secure side owns the whole pipeline
Every individual defect in the current control path has a known fix. What makes them
expensive is that they share state, so each fix lands in a system whose other faults are
still live and still confounding the measurement.
Entanglement
Where
Consequence
The position anchor is also the outlier reference
apps/dotbot/main.c:239-251
A fix more than 500 mm from the anchor is rejected, and only an accepted fix
moves the anchor. Absorbing state; power-cycle is the only exit.
The heading update is welded to the position write
same block, compute_angle()
Position only advances in 50 mm quanta, so an arrival threshold below
50 mm is not meaningful, and heading is stale through any low-displacement
manoeuvre.
Five writers to the motors, no precedence
apps-sandbox/dotbot/main.c:131,139,166,280,311
Adding a wheel-velocity loop makes the ordering load-bearing, and nothing in the
code states it.
RTC0 is full
bsp/nrf/timer.c:57, .cc_num = RTC0_CC_NUM - 1
Three usable channels, all three used (timeout, position, advertisement). The
next periodic tick lands on RTC1, which the swarmit bootloader owns, and
db_timer_init() would STOP+CLEAR the secure side's position pipeline.
The estimator is a compile flag inside the steering function
drv/control_loop/control_loop.c
Predict and update fire on the same call, so the filter cannot predict between
fixes, which is the only reason to have it.
Separately, several checks the precision work needs cannot be run against the current
app at all without modifying the thing under test: a wheel-speed interface that bypasses
navigation while retaining encoder feedback, raw fixes tapped before any gate, and encoder
counts on a known tick.
Verdict
The minimal app is not extra work chosen over repair. It is the measurement rig the
campaign already owes, built as construction instead of archaeology, and it happens to
become the shipping app if it wins.
02Why the sandbox is the vehicle
Three reasons and one landmine
The secure side already owns lighthouse. A sandboxed app calls
swarmit_localization_get_position() and gets a solved position. No TS4231
handling, no sweep decode, no polynomial. That deletes the largest and subtlest subsystem
from the thing being built, which is exactly what a minimal app wants.
It is flashed over the air. When a check reads "16 runs per configuration per
start pose", per-robot cabling dominates every other cost. This is the single biggest
determinant of how fast the campaign moves.
It is where the fleet actually runs. Validating on the vehicle used at scale
beats validating on the bare app and porting afterwards.
The real coupling: the application is the position pipeline's clock
An earlier draft of this section claimed RTC1 belonged to the bootloader and that
touching it would clobber a secure-side position tick. That was wrong. Those RTC1
ticks (bootloader/Source/main.c:437-439) are in the bootloader-ready path
only; when it boots a user image the bootloader jumps to it at :423 and
spins, never reaching them. While a sandbox app runs, RTC1 is idle, and
setup_ns_user maps RTC0, RTC1, TIMER0 and TIMER1 non-secure with NS IRQs
(:196-197, :206-207, :228-235). The app has more timer resource than assumed,
not less.
The actual coupling is tighter and less visible. swarmit_keep_alive() is
not only a watchdog feed: it runs the lighthouse solve and republishes it to shared data
(cmse_implib.c:23-35). The rate the app calls it at is the position
rate, and lighthouse sweeps only arrive because the app forwards its SPIM4 interrupt
to swarmit_localization_handle_isr(). So the app is the clock and the
interrupt path for a pipeline that looks like it belongs to the secure side. Reading the
position without having just called keepalive returns the previous solve.
03Design
What the app is, and what it deliberately is not
3.1 The minimal app
Six responsibilities and nothing else. This is the phase 1 deliverable and it is an
instrument on the day it boots.
1
swarmit keepalive
Required to stay resident. Unchanged from today.
2
Position poll, raw
swarmit_localization_get_position() on the scheduler tick, with
no outlier gate, no displacement threshold, no anchor. Bounds checking
only, to reject a garbage solve.
3
Encoder read
Already present under #ifdef DB_QDEC_LEFT_A_PORT. Always on where the
hardware has encoders; the flag exists for boards that do not.
4
Advertisement
Byte-identical to today's format, because PyDotBot's parser is a
cross-repo contract. One additional bench-only frame carries raw fix, sequence,
timestamps and encoder counts, and is never registered in a shipped target.
5
Command receive
The existing four types, with their meanings frozen. See 3.3.
6
Nothing else
No estimator, no PD, no waypoint sequencing, no heading state.
3.2 One scheduler tick
The current apps take three RTC0 channels for three unrelated periods, which is what
leaves no room for a fourth. Building fresh means the tick architecture is a choice rather
than an inheritance: one periodic tick at the fastest rate the app needs, with every
slower activity derived from a counter.
That frees two RTC0 channels, removes the temptation to touch RTC1, and makes the
phase relationship between sampling, estimation and actuation explicit rather than emergent
from three independent timers drifting against each other. It also gives every logged
sample a common time base, which the estimator needs and the current code does not have.
3.3 Command surface: add, never overload
Once a wheel-velocity loop exists, MOVE_RAW's payload becomes ambiguous:
duty or speed? The wire format cannot show which, and PyDotBot's joystick path would not
notice the change. So the rule is that no existing command changes meaning.
Command
Meaning
Change
DB_PROTOCOL_CMD_MOVE_RAW
per-wheel duty, bypassing every loop
frozen, permanently
DB_PROTOCOL_CMD_RGB_LED
LED colour
frozen
DB_PROTOCOL_CONTROL_MODE
stop and drop to manual
frozen
DB_PROTOCOL_LH2_WAYPOINTS
waypoint batch plus threshold
frozen
new: DB_PROTOCOL_CMD_WHEEL_VELOCITY
signed per-wheel speed in mm/s on the wire
PyDotBot's REST model takes mm/s too; metres exist only at the SDK boundary
new: bench telemetry frame
raw fix, sequence, timestamps, counts
new type, bench builds only
The first draft put counts/s on the wire to avoid depending on an unsettled encoder
scale. Phase 3 has now settled that scale, so leaking encoder units into PyDotBot would buy
nothing. The REST model and the integer wire field both carry mm/s, metres appear only at the SDK surface (which converts once, at its own boundary), and the
firmware keeps mm/s all the way to the PI, converting only the encoder measurement, once, with DB_MM_PER_COUNT. With the v3 geometry, 0.1 m/s becomes 100 mm/s on the wire and stays 100 mm/s in the controller; ten counts in one 10 ms tick read as 98.7 mm/s.
This is a new command for two reasons. MOVE_RAW is permanently PWM, so
overloading it would silently break existing clients; and phase 4 needs a direct way to
exercise the wheel loop before navigation exists. Later, waypoint steering calls the same
internal setpoint function on the robot. PyDotBot does not stream wheel speeds during
normal waypoint driving.
3.4 Cascaded control: who commands whom
The final controller is a cascade, but there is no
waypoint PID writing PWM. The outer navigation layer chooses left and right wheel-speed
setpoints; the two inner wheel controllers are the only normal path that writes PWM.
The waypoint controller sets speed; the wheel controllers set PWM
Both entry paths meet at one wheel-speed interface. Only the inner loop closes around the motors.
Figure 1. The two PI blocks are independent, one per wheel. The compact paired nodes
keep the overview readable; each PI receives its own target and encoder rate, then writes
its own PWM. MOVE_RAW is the deliberate diagnostic bypass. Status as of 2026‑09‑24, evening:
every block is built and floor-tested (phase 4 wheel loop, phase 5 estimator, phase 6 approach profile, heading PD
and arrival brake, phase 7 waypoint handling: batches of up to 16 points or poses, a completion report, a max speed
and precise arrival, in open and draft PRs); the phase 7 cut-over is postponed.
In the morning team demo the outer loop (goto, shapes, heading-safe moves) still ran on the host PC over
WHEEL_VELOCITY; the onboard steering replaced it that afternoon.
During phase 4, the direct PyDotBot command is the only setpoint source. During normal
waypoint operation in phases 6-7, the onboard approach profile and heading PD become the
source instead. Both paths deliberately meet at the same wheel-speed interface, which
keeps the inner loop independently testable and preserves direct low-level access. The
inner PI runs at 100 Hz; the outer navigation loop runs at 10 Hz.
The nesting removes responsibilities from the outer loop rather than entangling them.
Navigation corrects pose error and never learns motor asymmetry, battery voltage or PWM.
The wheel loops correct speed error and never know about position, heading or waypoints.
There is one normal motor writer: the wheel PI layer. MOVE_RAW is the explicit
diagnostic bypass.
The simpler alternative is for the 10 Hz navigation loop to write PWM directly.
It can correct heading after a lighthouse fix exposes the drift, and may be adequate for
matched motors and low-precision motion. The cascade instead uses wheel-specific feedback
every 10 ms to reject motor and load differences before they become pose error. It also
lets encoder odometry propagate the estimated pose while an absolute fix is late or
missing, so the outer loop does not have to steer from a frozen lighthouse position.
Benefit of the encoder cascade
Cost or remaining limitation
Motor mismatch, battery variation, friction and small load changes are corrected
at 100 Hz. Equal wheel-speed requests are therefore much more likely to produce
straight motion than equal PWM values.
The firmware gains two controller states plus PI gains, saturation handling,
anti-windup and timing that must be tested and maintained.
At an expected 10 Hz lighthouse cadence, one or two missed fixes means
roughly 100–200 ms. Encoder deltas continue the EKF prediction, and the robot
should remain close to the requested line or arc until absolute fixes resume.
Encoders observe wheel rotation, not ground motion. Wheel slip, a binding caster,
wrong geometry or encoder faults can still make the predicted pose wrong. Lighthouse
fixes remain necessary to bound that drift.
The outer loop sees a more repeatable mapping from requested wheel speed to robot
motion, so its gains do not also have to absorb per-robot motor strength or changing
battery voltage.
The inner loop must be stable and materially faster than the outer loop or the two
can interact badly. 100 Hz against 10 Hz is a sampling ratio, not a
bandwidth ratio: it says how often each loop looks, not how fast either
responds. What a cascade actually needs is for the inner loop to settle well
inside the outer loop's period. The only figure in hand is not from a DotBot: it comes
from the cascade simulator on the control course page, whose Kp and
Ki were invented to make a three-second plot legible rather than tuned
against this drivetrain. With those numbers the wheel loop takes roughly 0.48 s to
reach 90% of a step while the outer loop issues a new setpoint every 0.1 s, so it
would be re-commanded about five times before arriving, which is backwards. That
describes the demo, not the firmware, so it is a gap in the plan's reasoning rather
than proof the design fails - and phase 4 now measures the real step response instead
of asserting the separation.
The wheel loop can be commanded and measured independently of navigation, while
MOVE_RAW preserves direct PWM access for diagnosis.
For a robot that already tracks well enough under raw PWM, this is extra
complexity with little visible benefit. The plan accepts that cost for repeatability
across robots and short localization gaps.
Stops are source-specific. Raw and direct-velocity operation use the 500 ms radio
command deadman. Waypoint operation is intentionally persistent after one batch, so its
safety stop is loss of accepted position fixes rather than radio silence. Arrival brake and
an explicit stop override either source.
3.5 The NSC ABI ask
Two changes to swarmit_localization_get_position(), both already argued for
in the position-latch design and both wanted here for a second reason.
Change
Why the latch design wants it
Why this plan wants it
Return a monotonic fix sequence
Freshness becomes exact instead of inferred from two bit-identical reads, which
misreads a genuinely stationary robot as stale.
The estimator must not run an update twice on the same measurement, which would
shrink the covariance without new information.
Return a timestamp of the solve - withdrawn
Not required by that design.
Withdrawn on review. The solve executes synchronously inside the app's own
swarmit_keep_alive() call, so a secure-side timestamp is just the call
time, which the app already knows. The measurement's real age is sweep-capture time,
which the app can stamp itself in the SPIM4 ISR it already forwards. No ABI change,
and the one cabled-reflash phase gets smaller.
Delete the secure-side gate
The sandbox sits behind a second copy of the latch: the secure
localization_get_position() carries its own 500 mm gate against its
own anchor (localization.c:10,86-103), so an app-only fix cannot restore
a displaced bot.
Outlier rejection belongs where the covariance is, not behind an ABI. See 3.7.
This is a swarmit change: bootloader source, a regenerated cmse_implib.a,
and a cabled reflash of every bench bot. It is the one phase that cannot be delivered over
the air, which is why it sits early rather than late.
Two consequences the first draft missed
Add an NSC entry, do not change one. Altering
swarmit_localization_get_position's signature breaks every sandbox app that
calls it, and a regenerated cmse_implib.a moves veneer addresses, forcing a
rebuild of all of them - dotbot, dotbot-simple,
move, spin, motors, rgbled, timer. A new
entry beside the old one leaves untouched apps compiling unmodified. The rebuild is
named in the phase deliverable either way.
The status path is a second consumer, and the estimator never covers it. The
network core copies ipc_shared_data.current_position straight into its
STATUS frame (network_core/Source/main.c:308), which is what the swarmit
dashboard and the experiment tooling read. Phase 5's innovation gate lives in the app and
filters only the app's own estimate, so deleting the secure gate leaves that path
bounds-checked and nothing more - permanently, not just between phases. Decide it here:
either accept bounds-only filtering on status, or have the app write its filtered pose
back to shared data for status reporting, in which case that shared-data addition must
ride this phase's single cabled reflash.
3.6 The estimator, and the lever arm
State is [x, y, theta] at the wheel-axle midpoint, where the
differential-drive kinematics already live. Predict runs on the scheduler tick from encoder
deltas. Update runs when a new fix sequence arrives.
The measurement is position only, two rows. There is no derived-heading
measurement, so compute_angle() leaves the estimation path entirely and the
50 mm displacement threshold disappears with it. The lighthouse photodiode sits
53.500 mm forward of the axle, exactly on the centreline, so the measurement
function carries that lever arm.
Reference
Coordinate, mm
What
M1
(56.250, 124.500)
left N20 gearmotor
M2
(93.750, 124.500), rot 180°
right N20 gearmotor
axle line
y = 124.500
both motor origins share it
axle midpoint
x = 75.000
the EKF state origin
D17
(75.000, 71.000)
BPW34S photodiode
J14
(60.000, 54.500)
front bumper, so front is -y
Figure 2. Four panels: where the photodiode sits on the board, what a spin does to the
difference between heading and measured motion, where the robot is actually observed to
pivot, and the heading error the offset produces. Every label is real text, so the figure
is searchable and selectable. The board panel is a kicad-cli pcb render --side top
annotated by mapping board millimetres onto image pixels, a least-squares fit over six
Edge.Cuts edges checked against four mounting holes before it was trusted.
The canonical copy is docs-hardware/dotbot-v3-robot-geometry.svg; this is an
inline duplicate of that file, kept identical to it.
Extracted from DotBot_V3-Main-bd1.3a.kicad_pcb, not scaled off a
photograph. Two things make the axle line trustworthy rather than an assumption about where
a footprint's origin sits: M2 is rotated 180 degrees about its own origin and
both origins share a y, so the shaft axis must be the footprint's local
y = 0 or the two shafts would sit at different heights and the robot could not
drive straight; and J14 is the front bumper
(gpio-map: P0.02 to /front-bumper-io3 to J14.4) on the same side
as the sensor, which fixes the sign as forward rather than aft. Figure and method:
docs-hardware/dotbot-v3-robot-geometry.svg.
The convention is fixed by _ekf_predict()
(control_loop.c:215-216): dx = -d*sin(dir),
dy = +d*cos(dir), so the forward unit vector is
(-sin, +cos), not the textbook (cos, sin). The measurement model
follows from that and not from the usual form:
h(x) = [ x - r*sin(theta + phi), y + r*cos(theta + phi) ]
H = [[1, 0, -r*cos(theta + phi)],
[0, 1, -r*sin(theta + phi)]]
phi measured clockwise from body-forward; phi = 0 on the centreline.
An earlier draft carried the textbook form, which in this convention puts the sensor 90
degrees off, to the robot's side. Recorded here because a sign error of that kind is caught
only by the spin check at the end of phase 5, long after it is introduced.
The same convention explains the sign in the odometry heading step, which this plan
writes throughout in the code's own form:
The minus is a convention adapter, not physics. The DotBot works in screen
coordinates: y points down, heading 0 faces +y, clockwise is positive. In that frame a
faster right wheel turns the robot anticlockwise, which is negative, so the minus corrects
the textbook expression, which assumes y up and anticlockwise positive. Where a kinematics
expression below writes L it means the same number:
L = DB_TRACK = 78 mm, L being maths shorthand.
The lever arm is why heading is observable at all
Stated precisely, because the first draft overstated it. Heading is already
observable from odometry plus position-only fixes whenever the robot translates - that is
the motion Jacobian's third column (control_loop.c:220-223), and it is the
ordinary GPS-plus-odometry construction, true even with the sensor at the centre of
rotation. What the lever arm adds is observability where translation is near zero:
turning on the spot, and the slow terminal approach - which is exactly where the
arrival error lives. Per fix it contributes roughly
sigma_pos / r, about 5 degrees at 5 mm and 53.5 mm, converging over a
rotation. Deriving heading by differencing successive fixes instead makes the estimate
carry atan(r*omega/v) of error - around 30 degrees during a slow terminal
approach, and 90 degrees turning on the spot - and that error is a function of the
controller's own commanded turn rate, which is a feedback path from actuation into
sensing. Modelling the offset converts the largest error source into the mechanism that
makes heading observable. It also means no special case is needed for turning on the
spot: encoders tell predict the body rotated, the lever arm tells update where the sensor
should therefore be, and spin, straight-line travel and everything between are the same
equations.
r = 53.5 and phi = 0 are mechanical constants and belong in
the shared geometry header phase 3 creates, beside wheel diameter, gear ratio, counts per
revolution and track.
The track constant is settled: 78 mm, everywhere
drv/geometry.h:33 defines DB_TRACK (78.0f) for v3, and both
consumers read it rather than carrying their own copy: control_loop.c:201 for
the odometry heading step and move.c:52 for the turn-angle-to-distance
conversion. There is no hardcoded 90 anywhere in the v3 path, and EKF_L, the
old private duplicate of the constant, no longer exists in the tree at all. On the Python
side dotbot_simulator.py:36 carries L = 78, and the ctypes
geometry test pins Python against the compiled C value, so the two models cannot drift
apart again.
Kept as the record of how it was settled rather than as a live question: the tyres
measure about 17.5 mm wide with their outer faces flush to the 94.0 mm board,
which puts the wheel centres about 76.5 mm apart; the simulator already used
78 independently; and the caliper reading agreed with both and ruled out 90 outright. The
gap mattered because odometry heading divides by the track, so a value nearer 76 than 90
would have had the filter under-rotating by roughly a sixth.
The one remaining 90 is correct, not stale.drv/geometry.h:67 keeps
DB_TRACK (90.0f) in the #else branch, which is v1 and v2. Those
are different boards and none of their dimensions has ever been measured, so they keep the
value the drivers always carried. It is not a leftover to be "fixed" to 78.
The lever arm assumes a free caster
The robot rides on a front ball caster on
the centreline at about (75.2, 60.0), 64.5 mm ahead of the axle and only
11 mm ahead of the photodiode, carrying real load since the two 120 F
supercapacitors are mounted underneath forward of the axle. A freely rolling ball adds no
kinematic constraint, so the pivot stays on the axle line and r is
53.5 mm. If the caster binds, the pivot migrates forward and the effective lever arm
shrinks toward -11 mm, changing sign. Floor surface and caster condition vary
between runs and between robots, which makes this a candidate explanation for the
run-to-run scatter no gain retune reaches - and an argument for treating r as
something to validate on the bench rather than a constant to trust. 3.13 turns that
argument into a specific measurement.
Reject a measurement when the Mahalanobis distance exceeds a threshold:
y = z - h(x) innovation
S = H P H' + R innovation covariance
reject when y' S^-1 y > gate
This structurally cannot latch
Every rejected measurement is also a skipped update, so P keeps growing
through the predict step, so S grows, so the gate widens by itself. A
persistently rejected measurement is eventually accepted. Displacement gating against a
self-referential anchor latches; innovation gating does not.
But the widening is slow, so it is not the recovery mechanism. With
Q scaled to slip, inflating S enough to admit a 500 mm
innovation takes minutes. The declared reset does the real recovery, which makes the reset
timeout a number to choose deliberately rather than a backstop. Two failure modes to
design against: a genuine outlier arriving first after the timeout would reseed the filter
onto the outlier and then gate every true fix, so require N consistent fixes to reseed;
and throughout the rejected window the controller keeps driving on a diverged estimate, so
pair "no accepted fix for T" with a motor stop, which is what the old deadman did before
it was disabled in AUTO.
The gate still needs a floor and a ceiling: a covariance that grows without bound
eventually accepts anything, so pair it with the existing declared-reset idiom (PX4's
resetHorizontalPositionToGnss, ArduPilot's posResetNE) - after a
timeout with no accepted fix, reseed the filter from the next bounds-valid measurement
rather than converging onto it.
3.8 What is deliberately not carried over
The 500 mm displacement gate, in both copies.
The 50 mm heading threshold and the anchor it references.
compute_angle() in the estimation path.
Three independent RTC channels for three periods.
The 5 * multiplier on the bare app's fix period, which contradicts its
own constant's name.
Motor writes scattered across the radio callback.
Each of these is removed because a layer below it makes it unnecessary, not because it
was wrong to have written.
3.9 The waypoint contract, and what is wrong with it
Batching waypoints is the right shape and puts the DotBot in the better half of the
field: most surveyed platforms send per-step commands or have no fleet path at all, and the
one that does better sends nothing at all in steady state. Current downlink is roughly 1-5
packets per second per robot against a comparable platform's 30, so airtime is not what
limits precision today. Two details are also genuinely well done: sixteen waypoints buffered
on the robot means the loop keeps running through a comms gap, and the advance test is a
disjunction of "inside the threshold radius" or "projected past the end of the
segment" (control_loop.c:385-399), which avoids the orbiting failure a bare
radius test produces when a waypoint cannot quite be reached.
What is weak is the contract, not the batching. A waypoint list says "go near
these points, in order" and carries no time, no speed and no failure vocabulary.
Gap
What the field does
Cost here
No speed field. DB_MAX_PWM is a compile-time constant per board.
Speed is a runtime parameter everywhere else.
Named as the number one firmware wishlist item from the 2026-06-11 swarm session:
"too fast" currently requires a reflash. Cheapest fix on this list.
One threshold for the whole batch.
Nav2 - the ROS 2 navigation stack - and Create 3 - iRobot's research robot,
built on the Roomba i3 - both separate intermediate tolerance from terminal
tolerance.
Cannot say "pass loosely through these, arrive precisely at the last one", which
is the normal shape of a path with a meaningful endpoint.
Completion is one all_done bit. No "unreachable", "stuck", "gave up".
Nav2 carries seven distinct named timeouts; the surveyed anti-pattern is exactly
one watchdog covering every stall.
A host cannot distinguish a slow robot from a stuck one. The same session logged
7 arrivals out of 47 in a 45 s window with no way to say why.
Geometric contract, no time in it.
One platform sends a goal plus a duration and generates the trajectory
onboard, so a fleet in motion sends zero recurring packets. Another reserves
space rather than tracking time.
The host can only poll and hope. This is the deep one, and also the one most
likely to be over-engineering for a wheeled robot at 10 Hz.
Unicast per robot.
Broadcast with a group mask selecting arbitrary subsets from one packet,
idempotent and unacknowledged.
Not limiting today. Future-proofing for the thousand-robot target.
How this interacts with the command freeze
The freeze in 3.3 protects the rebuild, not the protocol forever. A max speed is
therefore a new command that sets a runtime speed limit, not a new field spliced
into the waypoint payload - same rule as the velocity setpoint, and it keeps the change
out of PyDotBot's existing waypoint path. Terminal-versus-intermediate thresholds and a
completion enum are protocol changes that touch three repos and want their own decision;
phase 7 is where they get raised, with that phase's head-to-head arrival numbers as the evidence.
3.12 gives the shape they should take: parameters carried on a move, not modes built into
the controller.
3.10 Motor authority: the usable PWM range
Bench measurement, taken with projects/bsp drv / 01drv_motors, sweeping
40 to 100 PWM in steps of 5 on carpet. At 40 the robot is energised and audibly
tries to move but does not; at 45 it drives straight. The testbed is deployed in a
carpeted office, so carpet is the design case. An earlier coarser reading put the
carpet minimum at 55 with 60 the slowest usable speed; the finer sweep supersedes it, and
the 55 may well have been the spin figure rather than the drive figure.
There is not one breakaway number, there are two
At 45 PWM the robot drives straight but will not spin. A pivot has to scrub
both tyres sideways and drag the caster round, which costs more than rolling forward, so
the spin threshold sits above the drive threshold. The spin figure has not been
measured - only that it is above 45.
That is not a detail. Aim-then-drive (3.11) opens every manoeuvre with a spin, so the
aim phase is governed by the higher number while the drive phase is governed by the
lower. The approach profile's velocity floor is therefore not a single constant, and the
feedforward term in phase 4 needs the spin value wherever the commanded wheel speeds are
opposite in sign. Measuring it is the same sweep run again while commanding a pivot.
Set that against DB_MAX_PWM, which is 60 on v3
(control_loop.c:12). Twenty units of authority sit between
breakaway and the ceiling, and a turn is a differential that needs headroom on
both sides of the base speed, so any real turn command pushes one wheel below
breakaway and stops it dead. The ceiling is also self-imposed rather than physical:
db_motors_set_speed() takes percentages in [-100, 100]
(drv/motors.h:35-43) and the MOVE_RAW path already uses that full
range. 60 is therefore not a viable ceiling, and the decision is three tiers.
Tier
Value
What it is for
floor
40 to drive
Below 40 nothing happens at all; 45 drives straight. Nothing may command between zero and the floor and expect motion, and it is the feedforward constant phase 4 uses. The floor for a spin is higher and unmeasured.
normal ceiling
around 75
The autonomous ceiling. Leaves roughly 30 units of turn differential above the floor (20 against the superseded 55 reading), which is what a pivot needs on both wheels.
opt-in maximum
100
The hardware limit, reached only when something asks for it explicitly. Not the default for autonomous driving.
The names are a proposal, not a decision.DB_PWM_BREAKAWAY,
DB_MAX_PWM and DB_MAX_PWM_BOOST read consistently with the
constants already there, but keeping the middle tier called DB_MAX_PWM while
changing what it means is the kind of quiet redefinition that catches a reader out. Settle
the naming in the phase that lands the constants.
One consequence to carry forward: today's heading PD is scaled by DB_MAX_PWM
(control_loop.c:456), so its gains are expressed in units of the ceiling.
Changing the ceiling invalidates that tuning outright, and phase 6 has to retune from
measurement rather than inherit numbers.
Three measurements are owed before the tiers become constants: counts per tick at the
breakaway PWM on carpet, which is the v_min velocity floor 3.12
leaves unspecified; breakaway per wheel and per direction, since left and right will
differ and the size of that gap is what sizes the work the integrator has to do; and whether
sustained 100 PWM is safe for these motors at all.
Correction, 2026-09-23 17:00: the 75 ceiling is dropped for the wheel loop
Decided by the developer on 2026-09-23: full duty, 100, is the wheel loop's normal ceiling, not an opt-in tier. The tier table above stays as it was written; this note supersedes its middle row for the inner loop. The reason is measured, not argued: on the untethered bench the 75 ceiling was the binding constraint on phase 4's check (c). With it, no tuning got a step from rest to 300 mm/s to 90 per cent in under 165 ms (the plant's time constant is about 180 ms, so the ceiling sets the acceleration); at 100 with no slew limit the same step takes 55 ms. Two of the three measurements this section owed now exist: the breakaway is 37 to 45 duty on this carpet (the developer's own reading is about 40), and below about 32 duty a turning wheel is not driven at all and only coasts, which is a dead zone the loop now brakes through. Still not measured: whether sustained 100 is safe; the bench saw only transients at full duty (tens of milliseconds per step), on two robots, with no reset or brownout. The turn-headroom argument for 75 belongs to the outer loop and is revisited in phase 6; DB_MAX_PWM in control_loop.c is untouched.
3.11 Aim, then drive
The required behaviour: a stopped robot receives a waypoint 35 degrees off its current
heading. It should not drive forward and arc onto the line. It should turn nearly in
place until it is aimed, then drive, and only then apply continuous heading correction while
moving.
Today the robot arcs. Work it through control_loop.c:443-458 with the
v3 constants (DB_MAX_PWM 60, DB_ANGULAR_SPEED_GAIN_P 1.0,
DB_REDUCE_SPEED_ANGLE 25, DB_REDUCE_SPEED_FACTOR 0.75). At 35
degrees the heading error exceeds 25, so speed_reduction_factor drops to 0.75
and the base forward term becomes 45. The turn amount, once the D term has settled, is
(35/180) x 1.0 x 60 = 11.7 (the first update after the waypoint arrives adds
a one-off 3.5 from DB_ANGULAR_SPEED_GAIN_D 0.3). That gives pwm_left 56.7 and
pwm_right 33.3, truncated to 56 and 33. Both wheels drive forward. That is an
arc, and no gain choice inside this expression produces a pivot, because once the 0.75 has
been applied the base speed term does not depend on the heading error at all.
The plan's own target still arcs. Phase 6 as first written maps distance to
forward speed and specifies "a non-zero velocity floor in place of the single binary 0.75
multiplier". A velocity floor means forward speed never reaches zero, which is exactly what
a pivot needs it to do. The distance-only profile also drops the heading-error-triggered
slowdown the current firmware does have, so on this one requirement the plan as written was
a step backwards from the code it replaces. Recorded rather than quietly corrected: the
floor looked like a detail and is not.
It needs no new controller
The mixing is v_left = v + (omega x L)/2 and
v_right = v - (omega x L)/2, with L = DB_TRACK = 78 mm and omega positive clockwise, so a positive omega drives the left wheel faster, exactly as control_loop.c:200 reads the encoders (ddir = -(d_right - d_left)/L). A
pivot turn is just v = 0, which yields equal and opposite wheel speeds. No new
mode, no second code path, no separate controller - the same two numbers the steering layer
already computes. The velocity floor is the only thing preventing it, which makes that
floor a far more consequential choice than the plan first treated it as.
Three things phase 6 has to decide, none of which follow from the kinematics:
Decision
Why it is not free
Hysteresis on the aim threshold. Enter aim above roughly 20 degrees, leave it below roughly 8.
A single threshold makes the robot chatter between aiming and driving at the boundary. Two thresholds with a gap between them is the standard fix and costs one state bit.
A minimum useful spin rate.
Slow spinning is where the inner loop is weakest. About 5 counts per tick at 50 mm/s is a 20% measurement, and below the breakaway PWM of 3.10 the wheel does not move at all, so aiming too gently is aiming not at all.
Which waypoints get it. Aim first at the first waypoint and at the final one; arc through the intermediates.
Pivoting at every intermediate point turns a smooth path into a stop-start crawl. This is the same intermediate-versus-terminal split 3.9 already flags, and 3.12 is where it becomes a parameter rather than a special case.
3.12 The approach profile is a parameter block, not a set of modes
The temptation is to name scenarios - "normal", "docking", "precise" - and branch on them.
The alternative that does not accumulate modes is one parameterised profile plus sequencing:
a scenario becomes a choice of numbers and an order of moves, not a code path.
Parameter
What it sets
v_max
Cruise speed for the segment.
v_min
The velocity floor: the slowest speed that still produces motion. Set by the breakaway measurement 3.10 owes, not chosen.
k
Ramp-down rate - how sharply speed falls as the target approaches.
arrival_radius
How close counts as arrived.
final_heading
Which way the robot must end up facing, or none for an ordinary waypoint.
aim_threshold
The heading error above which 3.11's aim-then-drive engages, with its hysteresis pair.
final_heading is the row that matters. An ordinary waypoint does not care
which way the robot ends up facing; a charging dock absolutely does. No speed profile can
express that however finely it is tuned, which is why it has to be a parameter of the target
rather than a property of the controller.
Docking is three ordinary moves, not a new controller
Drive to a staging point about 250 mm out along the dock axis with the normal
profile; turn in place to align with that axis, which is 3.11's aim-then-drive with no
drive phase; then creep in along the axis with a slow profile and a tight
arrival_radius. Every step is an ordinary parameterised move. This is the
layered-access principle from PHILOSOPHY.md applied to motion: a high-level
dotbot dock sits over three parameterised moves, and both are first-class
surfaces rather than one being an escape hatch from the other.
The precision limit, and the decision taken on it.EKF_R_POS is
25 mm², which implies a 5 mm position sigma - and that number was never
measured. It is phase 2 debt, and phase 5's first deliverable is what settles it. Docking to
plus or minus 5 mm on lighthouse alone is therefore a one-sigma proposition, which is
another way of saying it misses often. The decision is to solve this mechanically: a
funnel, a V-guide or similar, converting residual positional error into a correct final
position as the robot pushes in. Mechanical compliance rather than tighter control, accepted
deliberately rather than as a fallback.
This block also subsumes the intermediate-versus-terminal threshold gap 3.9 raises. Loose
intermediate tolerance and a tight terminal one is two parameter sets in a sequence, not a
controller special case - though how those parameters reach the robot is still the protocol
decision phase 7 owns.
What arrival_radius means once there is a swarm. The intuition that an
intermediate threshold can be loose because only the final position matters holds for one
robot alone on the floor. It stops holding as soon as robots share the space, because a loose
threshold does not only cost accuracy at the point - it changes the shape of the path
actually flown.
Precisely: the threshold controls when the robot advances to the next waypoint, not
how far it drifts off the line between them. Drift off the line is the heading controller's
business, and a loose threshold does not widen it. What a loose threshold does is let the
robot begin turning toward waypoint N+1 before it has reached N, so it cuts the
corner. The path flown is a rounded version of the commanded polyline, and the rounding
grows with the threshold.
For a swarm that reframes the parameter. arrival_radius is a corridor
width, not an accuracy figure. What collision avoidance has to reason about is the region
the robot may actually occupy, and the threshold widens that region at every corner. Two
robots given crossing polylines that clear each other on paper can still meet if both are
rounding their corners by the same slack.
Open question, and it is a swarm decision rather than a control one
Tight thresholds everywhere, accepting the slowdown and the extra settling at
every intermediate point, in exchange for a flown path that stays close to the commanded
polyline. Or loose thresholds, keeping the speed, with the swarm layer planning
against the swept corridor each robot may occupy rather than against the polyline it
was sent. Both are defensible and the plan does not pick here. The thumb on the scale:
at swarm scale predictability usually beats optimality, because a path the planner can
bound is worth more than a path that is individually faster.
One thing the current firmware already gets right and any replacement must keep: the
advance test is a disjunction - inside the radius or projected past the end of
the segment (control_loop.c:385-399). The second clause is what stops a robot
orbiting a point it cannot quite reach, and it means tightening the radius does not risk
a robot never advancing.
3.13 Where the robot actually pivots
A v3 was photographed spinning in place at 100 PWM on carpet, once in each direction,
with an exposure long enough that the motion blur draws the arcs. The rotation centre does
not appear to be the middle of the axle.
Left turn, 100 PWM
Right turn, 100 PWM
Figure 3. Long exposure, 100 PWM, on carpet, one panel per turn direction. The blur arcs
are the evidence: they are concentric about whatever point the robot is actually turning
around. Both panels were rotated and cropped into the same body frame - wheels at the
bottom, the lighthouse end at the top - and matched in scale so the two directions can be
read side by side. That alignment was done by hand, so the figure is illustrative and
not a measurement.
The photographs are qualitative evidence. An attempt to extract the pivot location
from them by photogrammetry failed, so what they support is a reading by eye off the aligned
panels - good enough to say which way the offset goes and roughly how large it is, not good
enough to be the number a constant is set from. The physics below is what makes the reading
mean something, and the circle fit at the end is what would replace it.
For a differential drive with both wheels rolling without slip, the
instantaneous centre of rotation is forced to lie on the axle line: each wheel can
only move perpendicular to its own axle, so the centre has to sit where both constraints
meet, which is that line. Its position along the line is set purely by the wheel speed ratio
- equal and opposite speeds put it at the midpoint, and it slides toward whichever wheel is
slower. The direction of any offset is therefore a diagnostic, and it splits into two cases
that call for opposite responses.
Offset direction
What it means
What fixes it
Along the axle, side to side
Unequal wheel speeds: motor mismatch, or uneven traction between the two sides.
Phase 4's per-wheel PI pair. This is precisely the error it exists to remove.
Off the axle, forward toward the caster
Slip, scrub or a binding caster. The no-slip assumption is violated, so the centre is no longer obliged to sit on the axle line at all.
Nothing in a wheel-speed loop. It is also direct evidence that ddir = -(d_right - d_left) / DB_TRACK (control_loop.c:201) is lying, because that equation assumes no slip.
Read off the figure: the offset is forward, toward the photodiode. The centre of
the blur arcs sits roughly 10 to 15 mm ahead of the axle midpoint, in the
direction of the lighthouse sensor, and the two panels do not agree with each other: about
15 mm turning left and 10 mm or less turning right. This is an
eyeball reading off a hand-aligned figure and not the circle fit, which is still owed.
Treat every number derived from it below as an order of magnitude rather than a value.
It puts the robot in the second row of that table: off the axle, forward toward the
caster. An off-axle centre of rotation means a wheel is scrubbing rather than rolling
cleanly, so ddir = -(d_right - d_left) / DB_TRACK
(control_loop.c:201) is not telling the truth during a spin - and that is the
row no wheel-speed loop fixes. Phase 4's per-wheel PI pair removes the side-to-side case;
this is not the side-to-side case.
Not the sign flip 3.6 feared, but the lever arm does shrink
3.6 notes that DB_LH2_LEVER_ARM 53.5 assumes a freely rolling caster, and
that a binding caster migrates the pivot forward until the effective lever arm reaches
-11 mm and changes sign - which would make the EKF correct heading in the
wrong direction during a spin, the one manoeuvre where the lever arm is load-bearing for
heading observability. That is not what the photographs show. The sign flip needs
the pivot to travel the full 64.5 mm to the caster. At 10 to 15 mm the arm keeps
its sign and only shortens: to 43.5 mm at the 10 mm end and
38.5 mm at the 15 mm end, which is 19% and 28% below the coded 53.5.
What that does to phase 5, concretely. The measurement model places the photodiode
by swinging the lever arm about the pivot, so an arm 10 to 15 mm too long predicts the
photodiode 10 to 15 mm from where it actually is while the robot spins.
EKF_R_POS is 25 mm², a 5 mm position sigma, so that is two to
three sigma of systematic error, and 3.7's innovation gate could start rejecting
perfectly valid fixes precisely during the aim phase 3.11 introduces. That is a specific,
checkable failure mode rather than a general worry: it would show as a burst of rejections
correlated with turning in place, and it is worth instrumenting for on the first spin run.
Two mitigations, named without choosing between them. Carry r as a
measured constant from the circle fit instead of the geometric 53.5, which removes the
bias at its source but assumes the pivot is stable for a given robot. Or inflate
R during spins, which keeps the gate from firing without claiming to know
where the pivot is. The circle fit is what settles which is needed, and whether either
is.
The direction dependence wants a cause. 15 mm one way and 10 mm the other
cannot be pure geometry, which would be symmetric between turn directions. Carpet nap is one
candidate - carpet fibres lie in a direction, so the friction a scrubbing wheel meets differs
with the sense of rotation - and motor asymmetry is another. Both are guesses and neither has
been tested; the both-directions circle fit is what would separate them.
The measurement to take instead of photogrammetry. Spin in place and log the
lighthouse fixes. If the robot rotates about a point offset from the photodiode, the
photodiode traces a circle. Fit it: the centre is the pivot in room coordinates and
the radius is the effective lever arm, which tests the 53.5 mm claim directly.
Run both directions and compare - the same offset in the body frame points at geometry or at
the caster, a direction-dependent one points at motor asymmetry. It needs no new firmware,
since dotbot-next already reports raw fixes and the fix sequence, and it doubles
as the phase 5 spin check the plan already owes. Spin slowly enough that the 10 Hz fix
rate gives plenty of points around the circle.
The circle fit is not the only way to get this number. An overhead camera and a
fiducial on the top face would measure the pivot directly, in both directions, without
trusting either the photographs or the estimator whose lever arm is in question. That idea,
and the LED scheme that lets external video be correlated with the firmware's own event log,
is written up in A camera as the second witness. It is
an idea, not a plan: nothing here depends on it.
The developer's own reading of the figure is "not perfect, but could be good enough", and
that is the disposition the plan carries: not a blocker, not tuned now, but a named risk with
a measurement owed against it. It is recorded here so the spin check is designed to answer
it, rather than run first and re-run afterwards.
04Phases
Each layer testable with only the layers beneath it
The bench scripts live in bench/; the raw bench data they read, including the CSV files the phase logs below name, is kept outside the repository.
Phase 1The minimal instrument app~2 dDone
New app beside the existing sandbox one, not replacing it. Keepalive, raw position
poll, encoder read, advertisement in the existing format, the four existing commands, one
scheduler tick. No estimator, no steering, no waypoints. Before writing a line, settle the
tick ownership question from 02 and record the answer here.
Harvest first. Enumerate the non-obvious fixes in today's app and decide each
deliberately rather than rediscovering it at the bench: volatile on ISR-set
flags, draining encoder counts when a new waypoint batch arrives, the
> 100000 invalid-coordinate sentinel and the (0,0) no-fix case, and the
deadman semantics including why it is disabled in AUTO.
Deliverable + check
A flashable sandbox app plus the harvest list committed beside it. Check: flash one bot
over the air, confirm it stays joined for 10 minutes (keepalive works), that
advertisements parse unchanged in PyDotBot, and that MOVE_RAW drives both
wheels. Then confirm swarmit_keep_alive() is called at the
design rate and the SPIM4 interrupt is forwarded, observed as shared-data position
updates at that rate. Record fix rate, its jitter, and position noise with the bot
stationary - all three are observable before phase 2 opens the boundary, unlike the
outlier distribution.
Log
So far. The app was built as dotbot-next (first named dotbot-bench, renamed because it is the successor, not a side instrument) on one 10 ms RTC0 tick, with the position poll and swarmit_keep_alive() adjacent at every 10th tick, since the keepalive itself runs the solve, and adverts at every 50th. The harvest list sits beside it as its README; two of its changes are fixes: the command deadman is unconditional, and the timeout uses a masked difference across the 512 s RTC wrap. The phase closed on 2026-08-28 with the app running on a bot; the fix rate, its jitter and resting noise were not taken here, moved to phase 5, and were measured there on 2026-09-21.
Earlier log, 2026-08-27 to 2026-08-28 (6 entries)
- phase created; not started.
- first build landed as
apps-sandbox/dotbot-bench (DotBot-firmware
0d80729, branch control-fw, not pushed).
Registered in apps-sandbox/applications.emProject; the sandbox
Makefile discovers apps by directory listing so no Makefile change was needed.
Builds clean for sandbox-dotbot-v3, zero warnings, 6544-byte
.bin; make check-format silent. No DotBot-libs change:
phase 1 is firmware-repo-only, which was not obvious in advance.
- tick ownership decided rather than deferred:
one 10 ms RTC0 channel, with position at every 10th tick, keepalive and
command timeout at every 20th, advertisement at every 50th. That leaves two RTC0
channels free for the layers above and never touches RTC1. The callback only
increments a counter; the main loop drops any backlog rather than replaying it and
telemeters the worst backlog seen, so tick jitter is data rather than a silent
defect.
- review found a defect in the first build and a
wrong premise in section 02. swarmit_keep_alive() performs the solve and
republishes shared data, so calling it at 200 ms while polling position at 100 ms read
the same solve twice; the two are now adjacent in _position_poll() and the
separate keepalive divider is gone. Renamed dotbot-bench to
dotbot-next: it is the successor, not a side instrument, and naming it for
phase 1's role would have been wrong from phase 2 on. Rebuilt clean.
- the harvest list is
apps-sandbox/dotbot-bench/README.md, split into behaviour carried over
deliberately (four items) and behaviour deliberately changed (four items). Two of the
latter are fixes rather than choices: the command deadman is unconditional here,
where the shipping app skips it in AUTO and so leaves an autonomously driving robot
with no deadman at all; and the timeout arithmetic uses a masked difference, since
the 24-bit RTC counter wraps every 512 s and a plain comparison is false for the
whole pass after a wrap.
- closed. The app runs on a bot and its code
deliverables are met. Two of the named checks were never recorded, though: fix rate
with its jitter, and position noise at rest. Rather than leave the phase open on data
nobody is going to collect on its own, both move into phase 5, which is where the
resting sigma is consumed as the measurement noise R. If they are never taken, phase 5
picks R from a guess and says so.
Phase 2Open the NSC boundary, then characterise what comes through it~3 dDone
The swarmit half, per 3.5: fix sequence, solve timestamp, and delete the secure-side
gate. Sits immediately after phase 1 because it is the only phase needing a cabled
reflash, so everything after it iterates over the air.
Why characterisation cannot precede this phase
An earlier draft made "characterise the raw fix" its own phase before this one. That
is not executable. swarmit_localization_get_position() returns
ipc_shared_data.current_position
(cmse_implib.c:91-96), which the secure side rewrites only when its own
localization_get_position() accepts a fix - and that function
return falses without publishing when displacement from its own anchor
exceeds the threshold (localization.c:91-99). The outliers are exactly
what is filtered, so they are exactly what a sandbox app cannot see until this gate is
gone. Phase 1 can measure fix rate, jitter and noise at rest - a stationary bot has
near-zero displacement and is never gated - but not the outlier distribution.
So characterisation lands here, on the now-unfiltered stream, and its output is
load-bearing twice over: it sets the innovation-gate threshold in phase 5, and it answers
whether the gate being deleted was ever protecting against anything real.
Deliverable + check
A swarmit PR carrying the bootloader change and a regenerated
cmse_implib.a, a DotBot-firmware PR rebuilding every sandbox app
against the new implib (veneer addresses move even for apps that call nothing new), and
a recorded fix distribution committed as a sibling of this plan. Checks: (a) confirm the fix sequence
increments exactly once per published solve, logged against the 10 Hz tick;
(b) park a bot at a surveyed point for 5 minutes and report the standard deviation of
reported position, then repeat while driving a straight line - the resting figure is
the sigma every later error budget uses; (c) count and size the outliers now crossing
that previously did not; (d) displace a bot by more than 500 mm while it is blind
and confirm position tracking resumes without a power cycle, which is impossible
today.
Log
So far. The characterisation phase was folded in here, since the secure gate hid the outliers it was meant to measure. The code added swarmit_localization_get_fix() with a fix sequence counter kept in secure RAM (no ipc_shared_data_t change), deleted the 500 mm displacement gate so the coordinate bounds check is the only filter, and fixed the STATUS path as bounds-only for good, so the dashboard now sees outliers. It shipped as swarmit#161 and DotBot-firmware#422, later carried into the LH2 wave (swarmit#165, DotBot-firmware#424, merged 2026-09-23); the characterisation half moved to phase 5. The 2026-09-21 note that the bench bot runs the Debug 0.9.0-21-g39a5e77 bootloader and net core is superseded: since 2026-09-23 it runs swarmit main's (phase 4 log).
Earlier log, 2026-08-27 to 2026-09-21 (9 entries)
- phase created; not started.
- absorbed the separate characterisation phase,
which was ordered before this one and could not have run: the secure gate filters the
outliers it was meant to measure. Eight phases become seven; estimate 2 d -> 3 d.
- code half done and committed, unpushed. swarmit
f1b3914 + cfbea97, DotBot-firmware fcbb5fa +
caa3d02. New entry uint32_t
swarmit_localization_get_fix(position_2d_t *) beside the old one, which keeps
its signature - so the six untouched sandbox apps are byte-identical to
origin/develop in source and only needed relinking. The displacement gate,
the previous_position anchor and _distance() are gone from
localization.c; the coordinate bounds check survives as the only filter.
48 builds (8 apps x 3 targets x 2 configs) clean, zero warnings,
check-format clean. Ceiling is "it compiles" - nothing ran on hardware.
- two decisions worth keeping. The sequence counter
is a static in secure RAM rather than a new ipc_shared_data_t field,
because adding a member would shift the packed layout and drag in the network core's
duplicate ipc.h plus a net-core reflash, for a value only the app reads.
And _localization_data_available is now cleared before the solve
rather than left set: without that, a keepalive with no new sweep republished the
previous solve, which would have advanced the sequence on a re-read and defeated the
entire point of having one.
- the implib regenerated byte-identical to the
committed blob before any change was made, which proves the build config matches the
one the committed blob came from rather than assuming it. Veneer count 12 -> 13 and
every pre-existing veneer moved, which is why all apps needed rebuilding even
unmodified.
- status path decided: bounds-only, permanently.
The network core copies ipc_shared_data.current_position straight into its
STATUS frame and nothing else filters it, so the dashboard and experiment tooling will
now see outliers the 500 mm gate used to hide. Phase 5's innovation gate lives in the
app and will never cover this path. Recorded in the body of f1b3914 so a
reader of that repo alone meets it.
- open for the bench, beyond the characterisation
this phase already owed: whether clearing the availability flag on consumption starves
the position rate when sweeps arrive slower than the 10 Hz keepalive. Shared data keeps
its last value so STATUS is unaffected, but the observed fix rate may read lower than
the old code implied. That is the honest number rather than a regression, and someone
should confirm it is what they see.
- closed on its code half: swarmit#161 and
DotBot-firmware#422 carry the fix sequence, the deleted gate and the rebuilt implib,
and the developer confirmed the apps run on a bot. The characterisation half was not
done and its sibling file does not exist, so three numbers the design names are still
open: the fix sequence audited against the tick, the resting standard deviation, and
the size and rate of the outliers now crossing the boundary. Those move to phase 5,
where the first two set R and the third sets the innovation gate. Recorded here rather
than quietly dropped, because phase 5 choosing a gate threshold by guess is a
different plan from phase 5 choosing one from a distribution.
- Where this phase's code now lives: swarmit#161 and DotBot-firmware#422 are closed, carried into the LH2 calibration Phase 3 PRs (swarmit#165, DotBot-firmware#424), whose one cabled flash also regenerates the import library (15 entries, with swarmit_get_uplink_budget). The bench bot runs that Debug bootloader and net core (0.9.0-21-g39a5e77). Phase 4 builds on those branches.
Phase 3Encoder sampling and the scale factor~2 dDone
Encoder sampling on the scheduler tick, with non-destructive reads so telemetry and the
estimator can both consume the same counts. This phase existed because the coded
counts-per-revolution and an earlier bench inference disagreed by roughly a factor of 24.
That was the planning-time uncertainty, not the current state: the v3 measurement settled
the value at 28 counts per motor revolution, hence 1400 counts per wheel
revolution through the 50:1 gearbox.
Deliverable + check
A shared geometry header owning wheel diameter, gear ratio, counts per revolution,
track and the sensor lever arm. The v3 values are now 44 mm wheel diameter,
78 mm track and 28 motor-shaft CPR, or 1400 counts per wheel turn. Two checks prove
different things.
Bench: the completed hand-turn measurement established 1400 counts per wheel
turn; a future driven 1000 mm run should read about 10 128 counts and remains
the cheap check for count loss at speed.
Consistency: the simulator does not read C headers, it hardcodes the constants in
Python (dotbot_simulator.py:38-41, comment "must match C-side"), so export
the geometry through the compiled control-loop library as a ctypes call and assert
Python-against-C equality in a PyDotBot test. An earlier draft asked a bench robot and a
kinematic simulator to agree "within one count", which cannot fail informatively.
Log
So far. The v3 numbers were measured, not inferred: wheel diameter 44 mm, track 78 mm (the log holds both a 77 mm caliper reading carried as 78 and a direct 78 mm statement), and 1400 counts per wheel revolution, 28 per motor revolution, so 0.098735 mm per count and 10 128 counts per metre. They live in DotBot-libs drv/geometry.h with a 53.5 mm lever arm, exported through the control_loop library and asserted by a PyDotBot test. The first stated effect (distances at 43 per cent, a 2.33x over-read) was corrected on 2026-09-02 to 47 per cent and 2.12x, and the "roughly 20x" QDEC margin was withdrawn: the 128 µs sample period caps a wheel at 7812 counts/s, about 3906 with the debounce filter on, a risk handed to phase 4. Still open: DotBot-libs#27 proposes 30 counts per motor revolution with a 40 mm wheel (11 937 counts per metre, 18 per cent apart), which one driven 1 m run settles, and the lever arm holds only while the caster rolls freely, which phase 5's spin check measures.
Earlier log, 2026-08-27 to 2026-09-04 (14 entries)
- phase created; not started.
- the three open numbers are settled, all three by
bench measurement rather than inference. Wheel diameter 44 mm and track
77 mm by caliper; the track is carried as 78 so the C and Python
models agree exactly, and 77 also confirms the ~76.5 mm the board drawings
implied, ruling out 90 outright. Encoder scale by pushing a v3 through one wheel turn
with 01bsp_qdec: 1400 counts per wheel revolution over two runs
(1399/1401 and 1408/1392, both averaging 1400.0), so 28 counts per motor revolution
over the 50:1 reduction. The old ~14 300 figure is superseded - it corresponds to
about ten wheel revolutions, not one. Net effect: every odometric distance drops to
43% of what the firmware computed, so the estimator had been over-reading travel by
2.33x.
- the header exists as drv/geometry.h,
board-guarded, with both drivers reading from it; v1 and v2 keep their old values
because only a v3 was measured. It sits under drv/ rather than in
bsp/conf/ with the other board configuration because
control_loop.c also compiles on the host for the simulator, with only
drv/ on the include path, and board_config.h would drag in
gpio.h and the nRF headers.
- three deliverables still open, and they are the
plumbing rather than the measurements. (a) Reads are still single-consumer:
dotbot-next accumulates on the tick but the advertisement zeroes the
accumulator (apps-sandbox/dotbot-next/main.c:302-304), so an estimator
added later would see nothing. (b) The header does not yet carry the sensor
lever arm. (c) The consistency check is not built: the simulator constant was
mirrored by hand, which is exactly the duplication the ctypes-and-test check exists to
catch. The driven 1000 mm run is also still worth doing - the hand pushes were
slow, so they cannot show sample-rate loss, and at 28 CPR the QDEC's default
128 us SAMPLEPER leaves roughly 20x margin at full speed. Expect
10 128 counts per metre.
- the three open items are closed, leaving only the
driven run. (a)dotbot-next drains the destructive hardware read
into totals that are never cleared, and each consumer takes a delta against its own
cursor, so telemetry no longer takes the counts an estimator will need; totals are
unsigned so the wrap at 2^32 subtracts correctly. (b) The header carries
DB_LH2_LEVER_ARM 53.5 mm and DB_LH2_LEVER_ANGLE 0, with
the free-caster assumption written beside them. (c)control_loop_get_geometry() exports all seven constants through the
compiled library, and a PyDotBot test asserts the five the simulator duplicates. The
test was checked both ways: flipping the Python constant fails it, and it skips
cleanly when the library is absent or predates the getter, so the two repos can land
in either order. Wired into the existing control_loop CI job, which
already builds the library.
- closed. The driven 1000 mm run was declined
as unnecessary: two independent hand pushes agreed to 1.14% and their means landed on
1400.0, which is a catalogue-plausible 7 PPR decoded x4, and the nearest alternatives
are 15% away. What stays unproven is counts at speed - a hand push cannot show
sample-rate loss, and the QDEC runs at its 128 us reset default with roughly 20x
margin. Accepted as a residual risk rather than an open task. It is cheap to detect
later: driven odometry reading consistently short of 10 128 counts per metre is
the signature.
- re-verified the recent CPR correction against the
actual branch. DotBot-libs geometry-constants commit
dfef333 sets DB_ENCODER_CPR to 28 for v3, and
00a8d96 records the bench provenance. The local
origin/develop ref remains at 0257812, so the fix is real but
still lives in DotBot-libs#26 rather than develop. The phase description
now treats the factor-of-24 discrepancy as historical motivation, not current state.
- new open item against one of this phase's own deliverables.
DB_LH2_LEVER_ARM 53.5 mm sits in the geometry header as a mechanical
constant, but 3.13 makes the case that it is only constant while the caster rolls
freely: a spin whose centre sits off the axle line makes it wrong, possibly wrong in
sign. The constant stays in the header, and phase 5's spin check is now what measures
it rather than assuming it. Phase stays done; this is a validation item, not
unfinished work.
- track provenance, recorded rather than resolved.
The 2026-08-28 entry above records the caliper as reading 77 mm, carried
as 78 so the C and Python models agree exactly; the developer now states the
measurement as 78 mm directly. The value in use is 78 either way and the
two statements differ by 1.3%, so nothing downstream moves - but 78 should not be
described as a rounding of 77 if it was measured as 78. Both statements stand; this
log does not pick between them.
- the encoder scale is contested, and the
driven check this phase declined is what settles it. DotBot-libs#27, opened
2026-08-28 by another contributor, raises ENCODER_CPR to 30
against the 28 measured here, by the same procedure (mark the wheel, turn it once by
hand, read 01bsp_qdec) over 10 trials on several robots rather than 2 on
one. That
PR also leaves WHEEL_DIAMETER at 40, so the two do not differ by one
constant: they imply 10 128 against 11 937 counts per metre, 18%
apart. 28 is 7 pulses per revolution decoded x4, a standard N20 pole count, where 30
needs 7.5 - an argument from typical parts, not evidence. The developer has chosen to
proceed on the values measured here for now and to reconcile afterwards, so nothing
in this plan moves. Recorded because the driven 1000 mm run was closed as
unnecessary on 2026-08-28 on the strength of two agreeing hand pushes, and an
independent disagreement is exactly the evidence that reopens it: the two candidates
are 1809 counts apart over a metre, which a metre stick separates trivially.
- the geometry figure in 3.6 was rebuilt as a
hand-authored SVG with real <text> labels, replacing matplotlib
output in which every character was a glyph path and nothing was selectable or
editable. No generator script had ever been committed, so it was authored fresh
rather than re-run. Two stale labels went with it: the red callout claiming the
firmware used 90.0 mm for the track now states the settled
DB_TRACK (78.0f), and the speculative -12 mm caster pivot is
replaced by the measured 10 to 15 mm band from 3.13, labelled as a by-eye
reading off hand-aligned photographs. A fourth panel was added so the pivot question
and the spin geometry no longer share one. The standalone at
docs-hardware/dotbot-v3-robot-geometry.svg is canonical and the copy
here is inlined from it byte for byte; the matplotlib .png twin was
deleted rather than regenerated, since nothing could regenerate it and a second copy
is what let the two disagree in the first place.
- Cross-check correction to the 18:10 entry of 2026-08-28: the 43 per cent / 2.33x figure is the CPR ratio alone (12/28) and ignores the wheel going from 40 to 44 mm. Old scale: pi x 40 mm / (12 x 50) = 0.20944 mm per count. New scale: pi x 44 mm / (28 x 50) = 0.098735 mm per count. Ratio 0.098735 / 0.20944 = 0.471, so every odometric distance drops to 47 per cent and the old firmware over-read by 2.12x. The conclusion stands; only the arithmetic changes.
- Cross-check correction to the "roughly 20x margin" claim in the same two entries: no derivation supports it, and the hardware sets a ceiling below it. The QDEC registers at most one count per sample period (a two-step move inside one period is accumulated in ACCDBL, not ACC); the driver never writes SAMPLEPER (bsp/nrf/qdec.c), so the reset value of 128 µs applies; and the nRF5340 SVD enumerates 128 µs as the shortest option, so it cannot be shortened. That caps each wheel at 1 / 128 µs = 7812 counts per second. At the measured 800 mm/s top speed the v3 needs 800 mm/s / 0.098735 mm per count = 8102 counts per second, which is over the cap: at full PWM the encoders lose counts. At the 75 PWM autonomous ceiling, taking the course's linear model between the 40 floor and 800 mm/s at 100 (13.3 mm/s per unit), speed is about 467 mm/s, 4727 counts per second, a 1.65x margin. This is a phase 4 risk rather than a phase 3 one: the wheel-velocity loop under-reads exactly when it is fastest. Two mitigations, neither chosen here: read ACCDBL and credit two counts per double transition in the direction of travel, or keep the opt-in 100 tier out of any closed loop.
- Addendum to the 7812 counts/s ceiling above: it assumes the debounce filter is off, and the driver has it on, which lowers the guaranteed figure to about 3906 counts/s. Detail and the fix are in the phase 4 structure proposal, since that is where they are acted on.
Phase 4Inner wheel-velocity loop~3 dDone
One PI controller per wheel, run on every 10 ms scheduler tick
(100 Hz). The command and later navigation layers express speed physically; each PI works in mm/s, the only unit change being the encoder measurement (counts to mm/s, once, with DB_MM_PER_COUNT inside the step), and writes only its wheel's PWM. It is independent of pose,
so it is testable with no estimator or waypoint controller in the path.
The elapsed time dt comes from the scheduler counter:
Using elapsed ticks matters because the main loop deliberately drops a late scheduler
backlog. If one update is skipped, dt becomes 20 ms and the accumulated
encoder counts are divided by 20 ms; the controller does not pretend two 10 ms
updates happened.
PI is the minimal fit for a wheel-speed plant. P alone needs a permanent speed error to
produce the non-zero PWM that overcomes friction and load; I removes that steady-state
error. A D term would differentiate an encoder-rate signal that is already obtained by
differencing quantised counts, amplifying noise for little benefit, while motor inertia
already damps the speed response. Start with PI; add D only if measured response shows a
problem PI cannot tune out. Anti-windup prevents an impossible speed request from storing a large
integral, and a slew-rate limit bounds PWM change per tick.
Deadband feedforward. Stiction is a nonlinearity, not an offset, so the integrator cannot
absorb it cleanly. Commanded from rest, the measured speed reads 0, the error stays at
full, and the integral has to climb all the way from 0 to the breakaway PWM before
anything happens - at which point the wheel breaks free and lurches. Adding the breakaway
value as a feedforward term means the PI trims around the operating point instead of
discovering it:
u = sign(setpoint) * U_BREAKAWAY + Kp*err + Ki*integral
Two details belong in the spec rather than in the implementer's head: the term is
signed, following the setpoint, and it is zero when the setpoint is zero, or
the robot creeps when it has been told to stop. U_BREAKAWAY is the floor tier
from 3.10, per wheel and per direction once those are measured.
The contrast with the surface numbers is the strongest evidence for the cascade so far.
The steady-state difference between surfaces - carpet needs roughly 10 PWM more
than flat for the same result - is a constant offset, and absorbing a constant offset is
exactly what an integrator does: per wheel, with no surface profile to select and no
operator input. Today's PD writes PWM directly and has no mechanism by which it could
notice that carpet exists.
Precedence must be stated in code, not left emergent: the arrival brake and the
timeout stop outrank the PI, and MOVE_RAW bypasses it entirely.
Structure proposal, 2026-09-04 - where the wheel loop lives, pending approval before any code
Decision proposed: a new hardware-free DotBot-libs driver, drv/wheel_control/,
not a section of control_loop.c, not a wrapper over drv/pid, and not
app-local code. Reasons, against each alternative:
Not in control_loop.c. That file is the outer loop (waypoints,
heading PD, the EKF behind a flag) and it is the layer being rebuilt. The cascade in 3.4
exists so the two loops meet at one setpoint interface; putting both in one file re-couples
what the design separates, and grows the one file that already carries everything.
Not db_pid. It is a fixed-sample-time PID (integral clamped to the
output limits, derivative on measurement, drv/pid/pid.c:36-60) with no
dt argument, no feedforward and no slew limit. The spec above needs
dt from elapsed ticks, a signed deadband feedforward and a slew limit; a wrapper
supplying those would be most of a module anyway. db_pid stays untouched for its
existing users.
Not in the app. The bare apps/dotbot and the simulator want the same
controller, and a hardware-free driver is the one shape that compiles on the host, which is
what buys the first behavioural C test in these repos (see the test plan below).
The layout follows the existing pattern exactly (drv/move/move.c +
drv/move.h, registered as 00drv_move):
Per-wheel PI with deadband feedforward, anti-windup, slew; the mm/s to counts/s boundary conversion; the body-twist to wheel-setpoint mixer. No hardware calls: encoder deltas in, PWM out.
DotBot-libs
drv/motors.h, drv/motors/motors.c, every caller
changed, step 0
db_motors_set_speed becomes db_motors_set_pwm(int8_t, int8_t): the argument is written straight in as the PWM compare and was never a speed, and every layer above already names it pwm_*. db_motors_coast() joins db_motors_brake() so a stop says which kind it is; the docstring says duty at 10 kHz. About 40 call sites in 12 files across DotBot-libs and DotBot-firmware, one mechanical commit each, riding the submodule bump the firmware branch already waits for.
DotBot-libs
projects/01drv_wheel_control/
new
Bench project in the 01bsp_qdec / 01drv_pid mould: a fixed setpoint per wheel as a define, the 10 ms loop, printf of setpoint, measured and PWM every 100 ms. Cabled, no radio, no PyDotBot, and where checks (a) and (c) get their numbers before anything goes over the air. 01drv_pid is its v1-only ancestor (the rpm driver) and stays untouched.
DotBot-libs
drv/drv.emProject
changed
A 00drv_wheel_control project beside 00drv_pid, no dependencies beyond geometry.h.
DotBot-libs
bsp/nrf/qdec_default.c, bsp/qdec.h
changed, prerequisite
Disable the debounce filter; read ACCDBL alongside ACC. Why below - this is not optional.
DotBot-libs
drv/protocol.h
changed
DB_PROTOCOL_CMD_WHEEL_VELOCITY = 15 and protocol_wheel_velocity_command_t { int16_t left_mm_s; int16_t right_mm_s; }, per 3.3.
Build wheel_control.c into the existing host library; ctypes tests against a modelled plant.
PyDotBot
dotbot/protocol.py, models.py, server.py, controller.py, rest.py, dotbot_simulator.py + their tests
changed
The same six files MOVE_RAW lives in today: payload, model as two validated ints in mm/s, route .../wheel_velocity, send path, client method, simulator acceptance.
The module's surface, as it would read in wheel_control.h. Public names take the
db_ prefix like every driver except control_loop:
typedef struct {
float kp; // PWM per (mm/s) of error
float ki; // PWM per mm of accumulated error
float u_breakaway; // PWM; signed by the setpoint, zero at zero setpoint (the 3.10 floor tier)
float pwm_max; // saturation, the autonomous ceiling from 3.10
float pwm_slew_per_tick; // largest PWM change one 10 ms tick may make
} db_wheel_control_conf_t;
typedef struct {
float setpoint; // mm/s, straight off the wire
float integral; // mm, clamped by anti-windup
float pwm; // last output, so the slew limit has something to limit against
float measured; // mm/s at the last step, exposed for telemetry
} db_wheel_control_t; // one per wheel; the app holds two
void db_wheel_control_init(db_wheel_control_t *w, const db_wheel_control_conf_t *conf);
void db_wheel_control_set_setpoint(db_wheel_control_t *w, float mm_per_s);
void db_wheel_control_reset(db_wheel_control_t *w); // integral and pwm to zero; called on stop and on brake
int8_t db_wheel_control_step(db_wheel_control_t *w, int32_t delta_counts, uint32_t elapsed_ticks);
// No setpoint conversion: mm/s on the wire is mm/s here. The one unit change in the whole
// module is the encoder measurement inside step(), counts to mm/s with DB_MM_PER_COUNT.
// The (v, omega) seam the behaviour-library sibling asks for: named, with its sign convention.
typedef struct {
float v_mm_s; // body forward speed; positive forward
float omega_deg_s; // turn rate in degrees per second, like heading everywhere else; positive clockwise (y down, heading 0 = +y)
} db_body_twist_t;
void db_wheel_control_from_twist(const db_body_twist_t *t, float *left_mm_s, float *right_mm_s);
// w = omega_deg_s x pi / 180 (radians live only inside this function)
// v_left = v + w x L / 2, v_right = v - w x L / 2, L = DB_TRACK (clockwise = left wheel faster, as ddir assumes)
The step, in symbols and in words, so the arithmetic is checkable before it is code:
dt_s = elapsed_ticks x 0.010 seconds since the last step; 0.010 normally, 0.020 after one dropped tick
measured = delta_counts x DB_MM_PER_COUNT / dt_s mm per second the wheel actually turned
error = setpoint - measured how far short (or over) it is, in mm per second
integral += error x dt_s accumulated shortfall, in mm; clamped so saturation cannot store more
ff = sign(setpoint) x u_breakaway the PWM that gets the wheel moving at all, 0 when told to stop
pwm = ff + kp x error + ki x integral
pwm = clamp(pwm, -pwm_max, +pwm_max), then moved no more than pwm_slew_per_tick from the last value
Read aloud: the PWM sent is the breakaway push, plus a weight times the speed error right
now, plus a weight times the speed error that has piled up. Then it is capped, and it is not
allowed to jump.
Wiring in dotbot-next, on every 10 ms tick, before the slower activities:
// in _service_tick(), every tick
_encoders_accumulate(); // unchanged: drain the QDECs into the totals
_encoders_delta(&_wheel_encoders, &dl, &dr); // this consumer's own cursor, as the advertisement has
if (_dotbot_vars.drive_mode == DRIVE_VELOCITY) {
_set_motors(db_wheel_control_step(&_wheel_left, dl, elapsed_ticks),
db_wheel_control_step(&_wheel_right, dr, elapsed_ticks));
}
Precedence is a small enum in dotbot_vars_t rather than a set of flags, so it can be
read in one place: DRIVE_IDLE, DRIVE_RAW (MOVE_RAW writes PWM
directly and the PI is disengaged), DRIVE_VELOCITY (the PI is the only writer),
DRIVE_BRAKE (latched by arrival or by the timeout; resets both integrators). A
WHEEL_VELOCITY command sets two setpoints and the mode; MOVE_RAW or the
timeout switch it away and reset. That is the "stated in code" rule from the description above.
Prerequisite the proposal turned up: the encoder path drops counts at speed, twice over
The cross-check of 2026-09-02 found the QDEC can register at most one count per 128 µs
sample (7812 per second per wheel) against the 8102 per second that 800 mm/s needs. Reading
the driver for this proposal found it is worse than that: bsp/nrf/qdec_default.c:67
enables the debounce filter (DBFEN), and the nRF5340 datasheet (section 7.24.3)
says a filtered input is guaranteed to pass only when it holds steady for more than twice the
sample period, and is always suppressed when shorter than one period. Each quadrature count is one
such steady state. With units:
guaranteed: state > 256 us -> fewer than 3906 counts/s -> slower than 386 mm/s (PWM below about 69)
suppressed: state < 128 us -> more than 7812 counts/s -> faster than 771 mm/s (near full PWM the encoder reads almost nothing)
in between: not guaranteed either way - the 75 tier sits here at about 467 mm/s, 4727 counts/s, 212 us
Two driver changes fix it, both small, both in DotBot-libs on the same branch: turn the filter
off (it exists for mechanical contacts; a hall or optical encoder gives a clean edge, and the filter
also adds one sample period of delay to every reading), and read ACCDBL. The datasheet
counts a two-step move inside one sample as a "double transition" that is accumulated in
ACCDBL and not in ACC; the driver today issues
RDCLRACC and never looks. Switching to READCLRACC snapshots and clears
both in one task, and a new db_qdec_read_and_clear_dbl(qdec, &acc, &dbl) returns
both. The doubles carry no direction, but the single transitions in the same window do, and a wheel
cannot reverse at the speed where doubles occur (it has to pass through zero, where every count
is a clean single), so the app credits acc + 2 x dbl x sign(acc): the direction of
the counted steps, never the setpoint's, which would be wrong for a wheel pushed the other way
or just after a setpoint flip. The ceiling doubles to about 15600 counts per second, comfortably
above full speed. The 1400-count bench measurement was a hand
push and never exercised any of this, which is why phase 3 could not see it.
Tests, in the order they can run. Host first, because it needs no bench: add
wheel_control.c to utils/control_loop/CMakeLists.txt (CI already builds
that library and runs a ctypes test against it), then a test_wheel_control.py that
drives the C step function against a first-order motor model in Python: zero setpoint gives zero
PWM and no creep; a step reaches 90 % and settles with no sustained oscillation; a saturating
request leaves no windup once released; the slew limit holds; a two-tick dt divides the
delta correctly; the feedforward sign follows the setpoint. The plant there is a model with a
guessed time constant, not the robot, so those tests prove the logic and nothing about tuning;
checks (a) to (c) in the deliverable stay the hardware evidence. Gains start as placeholders
derived from the course bench model (13.3 mm/s per PWM unit above the 40 floor, so a first kp of the order of 1/13.3 PWM per mm/s) and are replaced by the step-response measurement in the open items;
they are written as guesses in the code until then.
Order of work, each one reviewable commit: 0. the motors rename, marking drv/move.h@deprecated in its doxygen (pointing at the phase 7 replacement) and fixing its distance docstring from centimetres to the millimetres the code already uses; 1. the qdec driver change; 2. the module and its host tests; 3. the bench project, and checks (a) and (c) on it; 4. protocol and app wiring; 5. the PyDotBot mirror.
Decisions this leaves to the developer, none blocking the module itself:
Name: wheel_control (parallel to control_loop) or
wheel_speed. The proposal uses the first.
Whether the twist mixer lives in wheel_control.h (proposed: the inner loop owns
its own input interface) or in geometry.h beside DB_TRACK.
Measurement filtering. One count per 10 ms tick is 9.87 mm/s, so at 100 mm/s a
single count of jitter is 10 % of the reading. The spec above runs the PI on the raw per-tick
rate; a one-pole IIR on measured would quiet it at the cost of lag inside the fast
loop. Proposed: start raw, add the filter only if the bench shows PWM chatter, and decide after
the step response is measured.
The rx mailbox from the architecture survey is recommended before this lands but not
required by it: a setpoint written from the IPC interrupt mid-step gives one tick with mismatched
left and right setpoints, which is harmless, and the mailbox removes it anyway.
Deliverable + check
Two velocity controllers plus the new command from 3.3, including its matching PyDotBot payload, server route and client method (that PyDotBot half is deferred while the playground work owns that repo; the firmware half landed 2026-09-04). Check (a): command a fixed wheel speed, log
commanded against measured for 10 s, expect steady-state error under 5% with no
sustained oscillation, and log tick jitter. Check (b): 2 m straight on three robots,
6 runs each, driven through the closed-loop wheel-velocity command with waypoint and
heading control disabled. Otherwise the outer loop would already correct motor
asymmetry and the check could read null while the PI worked perfectly.
Expect between-robot lateral drift spread to shrink. Check (c), the step response, in
plain steps: jump one wheel's speed setpoint from 0 to a fixed speed in a single tick -
that jump is what "step" means here; record the measured speed every 10 ms; then
find the time until it first reaches 90% of the commanded value. 90% and not 100% because
the response approaches its target asymptotically and never exactly arrives, so a
percentage is the only well-defined finish line. That time has to sit well under the
outer loop's 100 ms period, or the cascade's separation is a sampling ratio and not
a bandwidth one - see 3.4.
Log
So far. The inner loop is a per-wheel PI in mm/s at 100 Hz (mm/s on the wire and at the REST model; mixer v_left = v + omega L/2 after a sign fix), fed by a breakaway kick while the wheel is stalled and a running feedforward line once it turns, with the integral confined to an error zone. It lives in the hardware-free DotBot-libs drv/wheel_control with host tests (41 checks), behind DB_PROTOCOL_CMD_WHEEL_VELOCITY and PyDotBot's PUT .../wheel_velocity; the 2026-09-04 commits were lost and the whole stack was rebuilt from the spec on 2026-09-21, with the qdec debounce filter off and double transitions credited. On one tethered v3 on 2026-09-21, kp 0.5 and ki 5 held 100 mm/s within 2.6 per cent and 200 within 5.3 per cent over holds of about 1 s, reaching 90 per cent in 80 to 220 ms, so check (c) is not met and the inner loop settles in one to two outer periods. Void: the 2026-09-04 figures are a free wheel off the floor, and every per-wheel figure from 2026-09-21 (the right wheel 35 per cent weaker, its 67 to 70 duty, the running lines, the left-right yaw, the spin threshold near 80) is drag from the charging and J-Link cables, so check (a) over 10 s, check (b), the spin threshold and per-wheel feedforward all wait for an untethered robot.
Earlier log, 2026-08-27 to 2026-09-22 (23 entries)
- phase created; not started.
- interface and timing settled before implementation:
the REST model and the wire both carry signed mm/s, the firmware keeps mm/s,
and each wheel PI runs at 100 Hz using elapsed scheduler ticks for dt.
The direct command exists to test and expose the inner loop; waypoint driving later
produces the same setpoints onboard. Phase remains not started.
- made the cascade tradeoff explicit before
implementation. Fast encoder feedback reduces motor-induced motion error and carries
the pose estimate across short lighthouse gaps; it adds controller state and tuning,
cannot detect ground slip, and still needs absolute fixes plus a prolonged-loss stop.
Phase remains not started.
- bench measurement of motor breakaway, taken with
projects/bsp drv / 01drv_motors. Flat surface: 45 PWM minimum to
turn well and to drive. Carpet: 55 bare minimum, 60 the best slowest
speed at which it moves. Attributed to the 50:1 gearbox and strongly
environment-dependent. The testbed is deployed in a carpeted office, so carpet is the
design case. Three follow-up measurements are owed and are listed in 3.10: counts per
tick at the breakaway PWM on carpet, which is the v_min floor 3.12
leaves unspecified; breakaway per wheel and per direction; and whether sustained 100
PWM is safe for these motors.
- the breakaway was re-measured finer, and it
is two numbers, not one. Sweeping 40 to 100 PWM in steps of 5 on carpet: at
40 the robot is energised and does not move, at 45 it drives straight, and at
45 it will not spin. The 2026-08-31 reading of 55 is superseded and may have
been the spin figure. Consequences: the usable authority at DB_MAX_PWM
60 is twenty units rather than five, so the tier argument stands but is less
dramatic than recorded above; the model zero moves to 40, giving
800/(100-40) = 13.3 mm/s per PWM unit; and the aim phase 3.11
opens with is governed by a spin threshold that nobody has measured, which
makes the approach profile's velocity floor two constants rather than one. That
measurement is the same sweep run again while commanding a pivot, and it is now the
cheapest open item this phase has.
- three spec changes land on this phase from that measurement.
The controller gains a signed deadband feedforward term so the integrator no longer
has to climb from zero to breakaway before the wheel moves. DB_MAX_PWM 60
is recorded as not viable against a 55 PWM carpet breakaway, and 3.10 carries the
three-tier replacement plus the note that today's PD gains are scaled by
DB_MAX_PWM and do not survive the change. And the claimed 10:1 loop
separation is a sampling ratio rather than a bandwidth ratio, so a step-response check
to 90% is added as check (c). Phase remains not started.
- Module structure proposed as a dropdown above, awaiting the developer's approval before any code: a hardware-free drv/wheel_control driver, the qdec debounce filter found enabled and the double-transition count ignored (which lowers the guaranteed count ceiling to about 3906 counts/s, 386 mm/s, and makes the driver change a prerequisite), and the host-side ctypes test plan. Chip to active for the design work; no code written.
- Proposal refined after review. The PI works in mm/s end to end: the wire value is the setpoint as is, and the one unit change is the encoder measurement inside the step, so db_wheel_control_counts_from_mm_s is gone and gains read as PWM per mm/s. Two additions: db_motors_set_speed becomes db_motors_set_pwm (with db_motors_coast) as step 0, and projects/01drv_wheel_control is the first hardware artefact. Section 3.3 and the phase description edited to match; noted on #19 as a durable-section change. Still no code.
- Units decided. The wheel command is mm/s at the REST model and on the wire, like every other PyDotBot surface (positions, waypoints, map size, calibration are all mm); no metres anywhere below the SDK. SI is an SDK-boundary decision, recorded in PHILOSOPHY.md and the SDK plan, so the earlier "PyDotBot accepts m/s" is gone from 3.3, the deliverable and the diagram. The twist turn rate is degrees per second at the interface, matching heading, with radians only inside the mixer.
- Decided: drv/move is retired at the phase 7 cut-over, replaced by an odometric goal on the wheel loop, and marked @deprecated in its header during step 0 rather than deleted now, since it is a HIL check target and nothing replaces it before phase 6. Phase 7 text records the reasons and the port of its two callers.
- Sign error caught while explaining the mixer: the written mixing (v_left = v - omega L/2) made a positive turn rate speed up the right wheel, which is counter-clockwise, while heading, the EKF and control_loop.c:200 all define positive as clockwise with the left wheel faster. Corrected here, in the 3.x prose and in the behaviour-library sibling: v_left = v + omega L/2, v_right = v - omega L/2. The three formulas came from one handover note and had never been checked against the odometry sign.
- Firmware half landed, on stacked wheel-control branches, commits only. DotBot-libs (off the merged develop): 5af07ac motors rename to db_motors_set_pwm plus db_motors_coast, move.h deprecated in prose, units rule in geometry.h; ffbe73d qdec debounce filter off and db_qdec_read_and_clear_dbl; 5416f9b the drv/wheel_control driver with the first host-side C test in these repos (make test, 21 checks, a host-tests CI job); c20f1be the 01drv_wheel_control bench project; 2e2fa06 the wire command; 1354619 a review fix. DotBot-firmware (off control-fw): 196f815 call-site rename, b93b029 the drive-mode enum and per-tick wheel step in dotbot-next, 66563cc submodule pin. Full CI build matrix green in both repos, format clean, docs clean under the strict sphinx flags. Four deviations from the dropdown, all sound: @deprecated became prose because breathe cannot resolve doxygen's deprecated-list anchor (this repo already chose that in 4a60fc1); the anti-windup bound is (pwm_max - u_breakaway)/ki, since the feedforward already spends 40 of the 75 range and the wider bound let the integrator store duty the output cannot deliver (on the test plant: 122 ticks to recover versus 212); the no-windup test asserts recovery is no slower than a fresh step rather than a tick budget no gain set could meet; -std=gnu11 for the host test because glibc hides M_PI under strict C11. One bug caught in review and fixed in 1354619: the bench project stepped on now == tick, which a dropped backlog can skip. Open: DRIVE_BRAKE is declared with no producer until phase 6 latches it; the host-tests job does not gate the release job; gains are placeholders with a modelled settling time near 1.4 s, to be replaced by check (c). Nothing pushed; the firmware branch pins a libs commit that exists only locally until the libs PR merges. Checks (a) to (c) remain the bench work owed before this phase closes.
- First bench run (the developer's, on a fully charged v3; load condition not recorded), raw log kept at bench/2026-09-04-wheel-loop-steps.csv. 200 mm/s from rest, then 400 at 5 s, placeholder gains. Check (a) passes at both setpoints: steady state 199.0 / 200.3 mm/s (left / right) at 200 and 398.9 / 398.9 at 400, i.e. within one encoder count (9.87 mm/s per count per tick; the 197/207 and 394/404 alternation is that quantum, not oscillation), held with different duty per wheel (26.9 vs 28.6, then 38.1 vs 39.1): the integrator absorbing the motor asymmetry that open-loop PWM cannot. Double transitions: zero throughout, as predicted below 770 mm/s. Check (c) is not met yet: from rest, 90 % at about 150 ms but with a 58 % overshoot (peak 315) that takes 1.5 s to settle; from 200 to 400, 90 % at 600 ms with no overshoot. Both transients are the same cause, read off the steady states: the duty a rolling wheel needs is a line, about 16.5 + 0.055 x speed PWM (intercept 15.7 left / 18.1 right, slope 0.056 / 0.052 PWM per mm/s, so a rolling gain near 18 mm/s per PWM unit), while the feedforward applies the static breakaway of 40 for as long as the setpoint is non-zero. At 200 mm/s that is 13 PWM too much, and the integrator has to accumulate 66 mm of negative error to cancel it, which is the overshoot and the 1.5 s. The 200 to 400 step is the mirror: the feedforward does not move, kp supplies 10 of the 11 PWM needed only while the error is large, and the integrator builds the rest at 0.2 PWM per mm. Proposed change, not yet made: split the feedforward into a breakaway kick applied only while the wheel is stalled and a speed-proportional running term (floor plus slope, both measured per wheel), so the PI trims a residual instead of fighting a constant. Two caveats before those numbers are trusted: the rolling line extrapolates to about 1.5 m/s at full duty against the 0.8 m/s measured on carpet, so either this run was unloaded or the plant is not linear to full duty, and the per-wheel intercepts differ by 2.4 PWM, so the feedforward wants per-wheel constants as 3.10 already says. Validation stays tests: this is a reported bench result, not one run by an agent.
- Correction to the entry above: that run was unloaded. The bot was tethered to the PC for the serial log, wheels off the floor. So: check (a) is passed for a free wheel only and still owed on carpet; the running line (16.5 + 0.055 x speed) is the free-wheel plant and a floor for a loaded one, which needs more duty for the same speed; and the extrapolation puzzle is gone (a free wheel simply spins faster per duty unit than 0.8 m/s on carpet implies). The feedforward split was implemented anyway, since the structure is right whatever the constants: DotBot-libs wheel-control gains u_run and k_run beside u_breakaway, the kick applies only while a step sees no counts (so a wheel stalled under load gets it again), the running line takes over on the first count, and the anti-windup headroom follows whichever feedforward is active. The host test plant now has stiction and the measured running line, and a new check demands that a step from rest peaks under 115 per cent and settles; the no-windup check compares the PI against a P-only run of the same scenario, which cannot wind up by definition, instead of against a fresh step. 25 checks pass. The bench project now steps through 200, 400, 600 and 800 mm/s for 5 s each and reports the feedforward per wheel, so one flash gives the whole line and, at 800, exercises the double-transition credit. dotbot-next carries the new constants and pins the new libs. Getting a loaded log is the next problem: a tethered bot cannot drive on carpet, so the run has to be recorded untethered, either through the debug telemetry frame over the radio or by logging to flash with drv/log_flash and reading it back with apps/log_dump, both of which already exist. Decide which before the next bench session.
- Bench project reshaped for an arena (9b3c214): each speed is driven out until 3 m or 5 s, braked for 1 s, driven back the distance just covered, braked again, then the next speed; at 200/400/600/800 that is legs of 1, 2, 3 and 3 m inside one lane, ending near the start, with every speed in both directions. The bench conf uses the full duty range so the 800 stage can be attempted. The CSV gains stage, phase and leg_mm columns and keeps printing through the pauses, so braking distance is in the log. Each leg starts from rest, so every leg is a step response.
- Picked up; the 2026-09-04 commits are gone.1354619, 66563cc and every wheel-control SHA above exist nowhere reachable: not in the local repos, not on fork, not on origin, and no local worktree. Rebuilt from this phase's written spec on new wheel-control branches off lh2-phase3, which already carries phases 1 to 3 and the 15-entry import library. DotBot-libs: 2f3eeb9 motors rename plus db_motors_coast, 2b490ffdrv/move deprecated in prose with its distance in millimetres, 052d3c6 the units rule in geometry.h, 6aac304 qdec debounce off and db_qdec_read_and_clear_dbl, b4ee7f9drv/wheel_control with make test and a host-tests CI job, 6726430DB_PROTOCOL_CMD_WHEEL_VELOCITY = 15. DotBot-firmware: 92f31c3 bump plus call-site rename, b6239c3dotbot-next drive modes and the per-tick step. PyDotBot: acc0763 payload 0x0F, PUT .../wheel_velocity, model and client method, with tests. Deviations from the dropdown: db_motors_set_pwm keeps int16_t arguments, since narrowing to int8_t at about 40 call sites would wrap an out-of-range duty into reverse instead of clamping it; no DRIVE_BRAKE, which had no producer before phase 6; the architecture survey's rx mailbox landed with it (commands are applied on the next tick, so the main loop is the only motor writer); the host-tests job now gates the release job; the REST fields are left_mm_s / right_mm_s, validated to ±800. projects/01drv_wheel_control was not rebuilt: flashing a bare project onto the bench bot wipes its sandbox host, and dotbot-next built with DB_BENCH_TRACE records every 10 ms step (setpoints, credited counts, duty, elapsed ticks, mode; 1000 steps) into RAM, which is the same loop measured where it ships, on the floor. The simulator's acceptance of the new command is not done.
- Bench, open loop (run by the agent on 811EFD28FACDE21A, v3, 2.95 V, USB-tethered and charging, office floor in the dev-corner area; data bench/2026-09-21-open-loop-duty-sweep.csv). MOVE_RAW duty held 0.45 s per level, alternating direction: nothing moves at 34 or 40, both wheels roll at 44, so breakaway is 42 to 44 on this floor. Rolling speed over each hold's second half, left / right: 72 / 49 mm/s at 44, 131 / 91 at 50, 168 / 119 at 55, 207 / 147 at 59, 260 / 190 at 65 forward, and 10 to 20% less backward. That is a running line near 36 + 0.11 x speed (left) and 37 + 0.15 x speed (right): the loaded plant needs about twice the free-wheel line of the 17:47 entry, and the right wheel is about 35% weaker than the left at equal duty. At the 75 ceiling that leaves roughly 300 / 250 mm/s of reach.
- Bench, closed loop, same bot and floor, commands through a second headless controller, trace read back with bench/wheel_trace_run.py and scored with bench/wheel_trace_metrics.py. Two controller changes came out of it, both in the host test with a mutation check: the integral only accumulates inside an error zone (87e0070), because a wheel from rest turns in sparse single counts for about 100 ms and the integral charged over that start was a +58% overshoot at 100 mm/s; and the kick is max(u_breakaway, running line) plus a ramp while the wheel stays stalled (6e48dc8), because a fixed kick of 45 left both wheels stalled for 0.6 s in one run while 44 had started them in the sweep. With the measured feedforward (u_run 36, k_run 0.13, breakaway 44) the PI needed stiffer gains than the modelled plant suggested: at kp 0.1 / ki 0.5 the loop gain is below one and the right wheel sat 7% slow; at kp 0.5, ki 5, slew 40 per tick (committed in b6239c3): 100 mm/s steady within ±2.6% (second half of a 1 s hold, both directions), 90% in 80 to 130 ms; 200 mm/s within 5.3%, 90% in 120 to 220 ms. No dropped ticks in any trace. The duty each wheel settles at differs widely (left 23, right 67 at 100 mm/s): the body couples the wheels, so the weaker side is carried partly by the stronger one, which is exactly the asymmetry an equal-duty open loop turns into yaw.
- Where the checks stand. (a) steady-state error under 5%: met at 100 and 200 mm/s on a loaded wheel, over holds of about 1 s rather than 10 s, which a tethered bot cannot drive. (b) 2 m straight on three robots: not run; one bot, tethered. (c) 90% well inside the 100 ms outer period: not met. 80 to 130 ms at 100 mm/s and 120 to 220 ms at 200, limited by the robot's inertia and, at 200, by authority (the right wheel settles at 67 to 70 of 75). So the separation 3.4 worries about is real: the inner loop settles in one to two outer periods, not a fraction of one, and phase 6 has to be tuned knowing it. Camera cross-check on the 1.4 s leg at 100 mm/s (23:31:43): wheel odometry 148.5 mm, lighthouse 138 mm, and the camera shows the same excursion and return (net 5.6 mm camera, 3 mm lighthouse, 2 mm odometry). The left wheel ran 19 mm further than the right over that leg, almost all of it in the start transient, about 14 degrees of odometric yaw: independent wheel loops with different start dynamics still turn the robot, and only the outer loop sees that. Phase stays active; its remaining evidence is an untethered run.
- Bench method finding, recorded because it contradicts dotbot-hil-validate section 4.5: nrfjprog --memrd on the application core watchdog-resets a running sandbox app (twice, crashed (watchdog0) within seconds of one read), and nrfjprog --readregs halts it outright. JLinkExemem32 / savebin read RAM without disturbing it, so that is how the trace is read.
- Spins cannot be measured on this bench. Closed loop at ±60 mm/s the right wheel stayed stalled at the 75 ceiling; open loop (bench/2026-09-21-open-loop-spin-sweep.csv) nothing turns at 60 or 70 duty and the encoders first move at 80, so the spin threshold on this floor reads about 80 against 42 to 44 to drive, above the 75 autonomous ceiling. But the camera shows the body turned at most about 35 degrees during a 0.6 s hold at 89 duty that the encoders read as 300 mm/s per wheel (heading -147 to -111 and back to -160): the wheels were slipping against the USB tether. So the spin threshold here is a tethered figure, and the circle fits of the fixes (radii 5 to 36 mm against the 53.5 mm lever arm) measure the tether, not the pivot. Both wait for an untethered robot. Also checked: the dotbot app built on this branch (motors rename, qdec change) runs over the air, drives under MOVE_RAW and reports positions; the bot is left running it.
- Closing the session's code: the mailbox copy is now ordered against its flag with __DMB() on both sides (f35083a, found in review, not on the bench). The committed dotbot-next without DB_BENCH_TRACE was flashed over the air and driven at 100 mm/s out and back: 97 to 107 counts per 100 ms advert and a 71 mm lighthouse excursion that returns. The CI matrix was run locally: DotBot-libs 6 targets x Debug and Release, DotBot-firmware 12 bare and 3 sandbox targets in Release, all clean; make test 41 checks; the doc build was not run (no doxygen on this machine). The bench bot is back on the lh2-phase3dotbot app it ran before (761eeaf). Still owed for this phase: check (a) over 10 s and check (c) on an untethered robot, check (b) on three robots, the spin threshold, and per-wheel feedforward constants once an untethered sweep exists.
- correction from the developer: during these runs the bot was plugged into charging power and the USB-C J-Link cable, both on its right side. The right wheel's apparent weakness (about 35% less, 67-70 duty at 200 mm/s) and the left-right yaw are cable drag, not the motor, so the per-wheel feedforward numbers above are not valid and must be re-measured untethered along with the spin threshold.
- Rebased the three wheel-control branches onto origin/main after the LH2 wave merged; still local and unpushed, old tips kept as wheel-control-pre-rebase. DotBot-libs 8 commits, clean, now 9d9fa5e. PyDotBot 1 commit, clean, now 78c8691. DotBot-firmware: the two submodule bumps re-pointed at the rebased libs commits (e798b5b, then 9d9fa5e), since the firmware needs drv/wheel_control and the motor rename; two textual conflicts in dotbot-next against main's comment trim and its _due() helper, resolved keeping both, so the wheel step, the rx mailbox and the pacing now sit beside _tick_timeout and _due(). The uplink budget veneer no longer exists, so two port commits (598e975dotbot-next, 2dd21a5dotbot) pace adverts on swarmit_get_min_tx_interval_us(): period = interval x 100 / share, share still 50%, clamped to 100-1000 ms, 500 ms while not joined, the same rate the budget formula gave for one uplink cell per slotframe. The intermediate commits before the ports do not link against the new import library. Checks: make test 41 passed; the PyDotBot utils/control_loop library built from the rebased libs and test_control_loop_geometry.py 6 passed; DotBot-libs dotbot-v3 Release (38 projects), DotBot-firmware sandbox-dotbot-v3 Release (all 9 apps, both pacing apps rebuilt against the merged cmse_implib.a and resolving the veneer at 0xff68) and dotbot-v3 Release (3 apps), 0 warnings; PyDotBot 778 passed, 5 failed, all known environmental (4 test_cli_helpers reading this machine's config, the simulator test on a port already in use). Trial merge with pose-geometry (PyDotBot#297) in a scratch clone: no conflicts, disjoint hunks in controller.py, models.py, protocol.py, server.py; 833 passed with the same 5, geometry test 12 passed. Not run: the DB_BENCH_TRACE build, any flash. The bench bot still runs the 761eeaf image.
- Correction to the 14:18 entry above and the 23:58 entry of 2026-09-21: the bench bot no longer runs the 761eeaf image. After a recovery on 2026-09-23 and the developer's end-to-end run, it runs the merged main images: bootloader and net core from swarmit main, and the committed dotbot app. The live region's reflash condition is marked met.
- PyDotBot base moved, decided with the developer: wheel-control rebased from origin/main onto the local pose-geometry branch (89a2c4b, PyDotBot#297), now 0867209, still local. Reason: dotbot-next always advertises -1000 for "no heading", and only that branch's controller reads it as no heading; it also carries the geometry record and body pose the host side builds on. Clean; PyDotBot tests 834 passed, the same 5 environmental failures. DotBot-libs and DotBot-firmware stay on main. Rebase again locally when #297 takes its review fixes.
- The untethered measurement path is the radio telemetry frame, reworked for it (DotBot-firmware 2088c3b). The old frame repeated the advert's position and one encoder delta per advert, so at 200 ms per frame it could not resolve a 100 ms rise, 10 ms ripple, or half the 10 Hz fixes. It now carries every 10 ms step since the previous frame (credited counts, duty, setpoints in 10 mm/s units), every new fix (tick, sequence, raw x and y), the encoder totals since boot, drive mode and backlog; up to 24 steps and 4 fixes, 195 bytes against the 234 a mari frame leaves. On the tiny schedule the slotframe is 17 x 1780 µs = 30.3 ms, so adverts sit on the 100 ms floor and each advert plus telemetry pair goes every 200 ms, 20 steps and 2 fixes per frame. The host side is bench/wheel_telemetry.py: a MarilibCloud subscriber on the broker (the controller drops the type-13 frame) plus commands through a side controller running the PyDotBot worktree; metrics in bench/wheel_telemetry_metrics.py, duty_sweep_fit.py, spin_circle_fit.py, straight_compare.py, and goto.py to re-centre between runs. Across the session 94 of 1891 frames were lost (5%); a lost frame costs 200 ms of step resolution but no distance, since the totals ride every frame, and a resting 5 s listen delivered 25 of 25 frames with every step and every fix.
- Which robot is which, and batteries. The session brief had the two robots swapped. J-Link 771476353 is on 811EFD28FACDE21A: a non-halting JLinkExe mem32 of _telemetry_step_count, a symbol only the build then on 811EFD28 has, advanced 316 steps in 3.16 s, and the camera shows the cable on the robot at its position (1876, 741). So B4AB5A04DF9E2426 is the cableless robot and every untethered number below is from it; 811EFD28 was used once, for the double-transition read. Batteries at start: B4AB 2.87 V, 811EFD28 2.95 V (on charge); at the end: B4AB 2.41 V, 811EFD28 2.96 V. No robot neared 2.0 V.
- Open-loop duty sweep, untethered (B4AB, office carpet in dev-corner, MOVE_RAW equal duty both wheels, 0.6 s holds alternating direction; bench/2026-09-23-sweep-steps.csv, speeds over the last 0.3 s of each hold). Nothing turns at 29 or 33; at 37 both wheels roll forward (51 mm/s) but not backward; at 41 only one of four wheel-directions stays still; at 45 all roll. Breakaway is therefore 37 to 45 depending on where the wheel came to rest, and 44 stays a sound kick. Rolling speed forward, left / right: 143 / 144 at 45, 196 / 200 at 50, 254 / 254 at 55, 298 / 301 at 59, 361 / 374 at 65, 408 / 422 at 70, 447 / 461 at 74; backward 5 to 7 per cent slower. Fitted running lines (duty = u_run + k_run x mm/s, worst residual under 1 duty): left forward 31.7 + 0.092, left backward 31.8 + 0.097, right forward 32.2 + 0.088, right backward 32.2 + 0.093. The wheels agree within 4 per cent, so the 2026-09-21 right-wheel weakness was the tether, as corrected on 2026-09-22; the reach at the 75 ceiling is about 420 to 460 mm/s, not 250 to 300. The committed feedforward (36 + 0.13, from the tethered sweep) was 8 duty high at 100 mm/s and 16 high at 300, where it would saturate.
- Check (a), and a control defect it found. A 10 s straight hold does not fit in dev-corner, so each hold drives a circle with the outer wheel at v and the inner at v/2 (axle radius about 117 mm), once per side; metrics over the hold after its first second; ripple is the standard deviation of the 100 ms mean speed (one count per tick is 9.87 mm/s, so the 10 ms figure is quantisation). With the committed gains (kp 0.5, ki 5, feedforward 36 + 0.13): 100 mm/s held within 0.4 per cent, ripple 1.7 to 2.3; but at 200 and 300 the wheels read up to +5.4 per cent with ripple up to 15. The per-step telemetry shows why: bursts of 0.6 to 0.9 s every few seconds in which duty alternates 29 / 69 on consecutive ticks (the 40-per-tick slew limit) and counts alternate 16-18 / 25-30, on both wheels at once, a limit cycle at the step rate. The integral zone turns it into a bias: only the slow ticks (error +22) fall inside the 40 mm/s zone, so the integral ratchets up and the mean runs fast. It is not the double-transition credit: on 811EFD28 at 250 to 265 mm/s the double counters read over J-Link stayed at 0 (bench/2026-09-23-dbl811-cabled-steps.csv). Halving kp to 0.25 shrank the duty swing to 30 but not the count swing, and it still cycled (B1, old feedforward: up to +4.5 per cent, outer-wheel ripple 15 to 19; B2, new feedforward 32 + 0.093: up to +5.2 per cent, outer-wheel ripple 14 to 18). An amplitude-dependent gain, an intermittent onset and a one-tick response with the encoder on the motor side of a 50:1 gearbox point at gearbox backlash; that is a hypothesis, not measured. Fix, DotBot-libs 8d42e22: the error takes the mean of the last two measured speeds, which has no gain at the step rate and adds 5 ms of delay. B2 and C1 differ only by that change. C1 (kp 0.25, ki 5, feedforward 32 + 0.093, the two-step mean; committed as DotBot-firmware c043ae7 and 84fa914, whose telemetry build is byte-identical to the image measured) held, outer / inner wheel: 100 / 50 at 0.0 / -0.2 per cent and 0.0 / -0.1, ripple 2.2 to 3.0; 200 / 100 at +0.1 / 0.0 and +0.1 / +0.2, ripple 1.8 to 3.0; 300 / 150 at +0.0 / -0.0 and +0.1 / +0.1, ripple 1.6 to 2.7; outer-wheel overshoot 4 to 14 per cent, no sustained oscillation, tick backlog 0 in every run. Check (a) is met at 100, 200 and 300 mm/s over 10 s on both wheels, untethered. The host model plant (first-order lag) does not reproduce the robot's cycle, so the host check feeds a 30 / 18 count alternation directly and fails without the change (20 duty per step); the test fixture moved to the shipped kp and ki; 42 checks pass. Data: 2026-09-23-hold*-ff0 (committed gains), -B1, -B2, -C1.
- Check (c), untethered, C1 (straight legs driven out and back; 2026-09-23-steps{1,2,3}-C1-steps.csv). Time to 90 per cent on the 10 ms speed / on a trailing 50 ms mean, and the peak of the 100 ms mean: from rest to 100 mm/s 110 to 120 / 130 to 150 ms, peak +14 to +18 per cent; from rest to 200, 90 to 160 / 150 to 180 ms, +9 to +10 per cent; from rest to 300, 150 to 190 / 190 to 210 ms, +7 to +9 per cent; 100 to 200, 50 to 100 / 110 to 120 ms, +7 to +9 per cent. A step down from 300 to 100 settles in about 300 ms with a 10 to 25 per cent undershoot, the loop briefly driving slightly reversed duty to brake. Check (c) is not met: 90 per cent takes one to two outer periods, the same conclusion as the tethered 2026-09-21 run, now without the tether as an excuse. Phase 6 has to be tuned knowing the inner loop settles in 110 to 210 ms. One 300 mm/s backward leg read 15 per cent slow over its second half and is not explained.
- Spin and lever arm (C1, ±50 mm/s per wheel, about 73 deg/s, 10 s each way; 2026-09-23-spin-C1-*.csv, bench/spin_circle_fit.py, first second skipped). Untethered the robot spins closed-loop at duty 44 to 47, so the tethered spin threshold near 80 was drag. Circle fit of the raw fixes: clockwise 80 fixes, pivot (1386.7, 391.9), radius 52.0 mm, rms residual 1.5 mm, 589 deg swept; counter-clockwise 86 fixes, pivot (1382.3, 389.1), radius 51.3 mm, rms 1.5, 593 deg. The effective lever arm is therefore 51 to 52 mm against the coded 53.5, with no direction dependence, so the pivot sits within about 2 mm of the axle midpoint and the by-eye 38 to 43 mm of 2026-08-31 is not confirmed. The radius scales with any LH2 scale error (next entry), so read it as 52 ± 2 mm. Encoder travel against the swept angle gives an effective track of 84.9 to 85.5 mm with the coded 28 counts and 44 mm wheel, against 78 physical; slip can only raise that figure, which is consistent.
- Straight runs, encoder against LH2 (2026-09-23-straight{1,2}-C1-*.csv, bench/straight_compare.py, endpoints the median fix over each rest, encoder distance from the frame totals, odometric yaw under 1 deg per leg). Four legs at 150 mm/s: 742.5 and 722.4 mm near the y axis, 585.0 and 567.2 mm along x. Encoder over LH2 with 28 counts and 44 mm: 1.031, 1.032, 1.048, 1.073, that is 10 441 to 10 868 counts per LH2 metre against the coded 10 128, or 0.092 to 0.096 mm per count. DotBot-libs#27's 30 counts with a 40 mm wheel (0.0838 mm per count) gives 0.875 to 0.911. Uncertainty: LH2 is good to about 2 cm absolute at each end of a 0.57 to 0.74 m leg, 3 to 5 per cent per leg, and the two x legs disagree with each other by 18 mm of LH2 where the encoders differ by 4 mm. So this measures the product only, not counts and diameter apart; it sits nearer the coded 0.0987 than #27's 0.0838, and the closest simple combination is 30 counts with the 44 mm wheel (0.0922). The taped 1 m run by the developer is still the decider.
- Incidents and what was not covered. 1.7 s into one C1 300 mm/s hold, the circle's drift had carried B4AB into the parked cabled robot; both wheels stalled at duty 57 / 75 for 8 s, bounded by the ceiling, and the camera frame shows the two robots touching. That hold was discarded and re-run after backing off; after it every run started from a re-centred point more than 400 mm from 811EFD28. Separately the developer planned to move 811EFD28 out of the camera's view so the detector would lock onto B4AB; no number here comes from the camera, which was used only to see the cable and the collision. Check (b) needs three robots and was not run. Not measured: the per-wheel breakaway in a pivot, braking distance, and anything above 300 mm/s closed loop. End state: both robots at rest in dev-corner on the committed dotbot app from DotBot-firmware main, B4AB running at (1459, 464), 811EFD28 stopped at (1876, 733) as found. Code, local and unpushed: DotBot-libs 8d42e22; DotBot-firmware 2088c3b, c043ae7, 84fa914 (sandbox-dotbot-v3 Release solution and both bench variants, 0 warnings; libs dotbot-v3 Release, 0 warnings; clang-format clean).
- Second bench session, robots and interruptions. The developer swapped the J-Link cable before the session: 811EFD28FACDE21A became the cableless robot (2.96 V, charged) and B4AB went on the cable and on charge. Verified before driving: a non-halting JLinkExe mem32 of FICR INFO.DEVICEID read B4AB5A04 DF9E2426, through probe 778824888 (probe 771476353 was not on USB), and a warped camera frame showed the cable at B4AB's LH2 position (1849, 752) and a free robot at 811E's (1457, 332). Nothing was driven during the swap. Mid-session B4AB was taken out of the scene. At 811E's 2.06 V the developer swapped robots again: B4AB (2.95 V) became the free robot, verified by a camera frame with one cable-free robot at B4AB's LH2 position (1130, 194), and no robot probe on USB (only the gateway's). Nothing measured during either swap is kept. The battery rule was relaxed during the session (drive down to 1.5 V, hard stop 1.0 V); no run went below 2.06 V, so no result is flagged as low-voltage. Tooling: bench/step_metrics.py (per-step t90, overshoot, settling), bench/step_table.py, bench/dpc_run.py / bench/dpc_fit.py (rest-to-rest distance legs), and a camera helper that runs the PyDotBot RobotDetector on frames from the developer's controller stream.
- What limits check (c): the plant, not the loop. Fitting a first-order lag to each open-loop duty step of the 15:34 sweep gives tau 165 to 200 ms with 5 to 20 ms dead time, and a gain of about 10.75 mm/s per duty above 32, at every duty from 45 to 74. So with a 75 ceiling, a step from rest cannot reach 90 per cent of 200 in much under 105 ms, or of 300 under about 175 ms, whatever the gains; only 100 mm/s had room. Second finding: the 32 intercept of the running line is not friction but a dead zone. Between -32 and +32 duty a turning wheel is not driven and coasts at about 1.2 m/s² (the duty-0 tails of the sweep). C1's step from 300 to 100 commanded 41 - 0.25 x 200 = -9 duty and coasted, which is exactly its 150 to 170 ms. A ctypes simulator of the real wheel_control.c against this plant (dead zone, coasting, stiction, quantised counts) reproduced the bench rise times within about 20 ms and was used only to rank candidates before bench time.
- Candidate table (2026-09-23-tune-*-steps.csv). Each run is the step schedule 0, 100, 200, 300, 100, 0, 200, 0, then the same backward, 0.6 s per step, recentred at (1150, 200) facing +y. The z runs add four 0 to 300 legs. Figures are the time to 90 per cent of the step, as a median over both wheels and all runs: on the 10 ms speed (check (c)'s definition) / on a trailing 30 ms mean, which one lucky tick cannot trip. Overshoot is the median in per cent of the step, on a 50 ms mean. A setpoint pre-filter was not tried: check (c) measures the response to the commanded single-tick step, and a pre-filter can only slow that. Duty ceiling 75 and slew 40 unless named.
model-reference feedforward (internal plant model, PI tracks it), friction-braking model
811E
2.78-2.75
3
110/120
135/140
-
80/90
60/115
170/190
12
B5
kp 0.5, P term acts while stalled
811E
2.73-2.70
3
80/90
120/130
-
65/80
50/90
110/130
11
MD4
MB3 with dead-zone-aware braking, kp 0.4, tau_ref 30 ms
811E
2.68-2.64
3
95/110
120/135
-
75/90
70/110
55/70
9
MD5
same, kp 0.5, tau_ref 20 ms
811E
2.63-2.60
3
95/100
130/140
-
65/80
100/110
50/60
9
BD5
B5 plus dead-zone inversion (braking)
811E
2.58-2.46
4
55/85
120/125
165/185
60/80
80/90
50/70
11
BDz5
BD5, braking only beyond i_zone
811E
2.51-2.48
3
55/90
115/120
-
70/80
80/90
55/75
11
BD5x100
BD5 at a 100 ceiling, slew 40
811E
2.47-2.24
4
40/50
50/70
65/75
30/45
30/50
50/70
11
B5x100
B5 at 100
811E
2.22-2.18
3
35/55
55/65
70/85
35/50
30/50
90/120
10
MD5x100
MD5 at 100
811E
2.16-2.12
3
75/85
60/75
90/110
40/65
30/50
50/60
8
BD5x100s60
BD5x100, slew 60
811E
2.13-2.10
3
30/50
40/60
70/80
20/40
20/40
40/50
13
BD5x100s100
BD5x100, no slew limit
811E
2.09-2.06
3
20/35
40/50
50/60
25/40
20/40
30/50
10
BD5x100 (s40)
repeat on the fresh robot
B4AB
2.94-2.89
4
40/70
55/70
60/80
30/50
30/50
50/70
12
BD5x100s100
repeat on the fresh robot; inner-wheel duty chatters in circles
B4AB
2.89-2.86
4
20/40
40/50
50/65
30/40
20/40
30/50
13
BDz5x100s100
committed: BDz at 100, no slew limit
B4AB
2.82-2.78
4
20/40
40/50
55/60
30/40
30/30
30/50
11
- Chosen: BDz at full duty with no slew limit, committed. Its three parts, and why each works. (1) The P term acts while the wheel is stalled, on the whole setpoint, so a step from rest starts at the push the running wheel needs instead of waiting at the 44 kick for the first counts; the integral still stays out of the stall (0 to 100 went from 120 to 80 ms at the 75 ceiling). (2) Braking through the dead zone: on a turning wheel more than i_zone over its setpoint, a command that falls below u_run is moved past it, so the wheel brakes instead of coasting (300 to 100 went from 170 to 50 ms). The i_zone condition matters: without it (BD) the inner wheel of a circle, which the body partly carries, needed a drive inside the dead zone and flipped between about -32 and +32 duty on 30 per cent of ticks, up to 46 duty per step; with it the same 10 s holds show 0 to 9 steps of 10 duty or more out of about 880, with the same step numbers. (3) kp 0.5, ceiling 100, no slew limit (pwm_slew_per_tick 100): kp 0.5 no longer revives the step-rate limit cycle now that the error takes the two-step mean, and at a 100 ceiling the 40-per-tick slew limit was itself binding (0 to 100 mm/s took 40 against 20 ms). The model-reference designs (MB, MD) braked best but started slower from rest and carry three more gains and an internal model, so they were not kept. Committed image and benched image are byte-identical (md5 ce307121).
- Check (c) is met by the committed loop on B4AB, where 4 runs give 6 to 12 wheel-steps each. To 90 per cent on the 10 ms speed / on a 30 ms mean: from rest to 100 mm/s in 20 / 40 ms (range 20 to 60), to 200 in 40 / 50 ms (30 to 50), to 300 in 55 / 60 ms (40 to 60). 100 to 200 takes 30 / 40, 200 to 300 30 / 30, and the step down from 300 to 100 30 / 50 ms. Overshoot is 11 per cent median (6 to 24) on a 50 ms mean, and settling to within 10 per cent of the step takes 45 to 90 ms from rest and 90 ms on the step down; the step-up settling is noisier (up to 400 ms) because the overshoot's tail sits near the 10 per cent band. Against the outer loop's 100 ms period, that is well inside it at 100 and 200 mm/s and 40 per cent inside it at 300. So the cascade's separation is now a real bandwidth ratio for the speeds the outer loop will use, and phase 6 can treat the wheel loop as settling within one outer period. Check (a) still passes with the committed loop, 10 s circle holds on B4AB, outer / inner wheel: 99.9 / 50.0, 200.1 / 100.0 and 300.1 / 150.0 mm/s, error within 0.1 per cent, 100 ms ripple 1.2 to 2.1 mm/s, tick backlog 0 (2026-09-23-tune-h-z100-10s-B4AB-steps.csv). No run on either robot reset or browned out: every last-reset read was the OTA flash's soft-reset.
- Distance per encoder count (2026-09-23-dpc{X,Y}-{811E,B4AB}-*, bench/dpc_fit.py). Method: straight legs at 150 mm/s between full stops, the endpoint the mean of the raw LH2 fixes over the rest after its first 0.5 s (12 to 54 fixes), and the encoder totals from a telemetry frame inside the rest. Legs of 0.71 to 0.82 m (the most dev-corner allows with the tail clear of the top wall), 6 per lane, lanes along y at x = 1150 and along x at y = 500, on both robots: 24 legs. At rest LH2 reports whole millimetres and its scatter was 0.0 to 0.5 mm, so each endpoint is good to about 0.1 mm statistically; odometric yaw per leg was under 1.6 degrees, so the chord-to-arc correction is below 0.01 per cent. Results: 811E 0.09488 (12 legs, sd 0.00100), B4AB 0.09465 (12 legs, sd 0.00070), pooled 0.0948 mm per count on the LH2 scale. The spread is systematic, not noise: along +x both robots read 0.0932 to 0.0938 and along -x 0.0947 to 0.0952, with the y lane at 0.0949 to 0.0959. That is direction and lane dependent and the same on both robots, which points at the carpet pile rather than the robot. The camera, run through RobotDetector at both rests of 16 legs, reads distances 0.82 per cent longer than LH2 (sd 0.30), the same on both axes and both robots. So one of the two scales is off by about 0.8 per cent, and which one is not known. Result: 0.095 ± 0.001 mm per count (0.0948 on LH2's scale, about 0.0956 on the camera's, ±0.8 per cent across lanes and directions). It excludes the coded 0.0987 (28 counts, 44 mm; 4 per cent above), 30 counts with 44 mm (0.0922; 3 per cent below) and DotBot-libs#27's 0.0838. Distance alone does not discriminate 28 from 30 counts, since it measures only the product. Read as a count per revolution, 28 counts implies an effective rolling diameter of 42.3 mm against the 44 mm caliper figure (about 1.7 mm less, plausible tyre compression on carpet), while 30 counts needs 45.3 mm, more than the unloaded wheel. Together with the 1400-counts-per-turn push that geometry.h records, that favours 28 counts with a smaller effective diameter, so DotBot-libs#27 (30 counts, 40 mm) is not supported. Proposed and not made: keep DB_ENCODER_CPR at 28 and let odometry use a measured 0.095 mm per count (an effective DB_WHEEL_DIAMETER of 42.3, or a separate rolling-diameter constant beside the caliper one). That edit must land with the PyDotBot geometry record and its pin test, and #27 closed with this measurement. geometry.h and the PyDotBot record are unchanged. A direct count of encoder counts per hand-turned wheel revolution would settle 28 against 30 independently of any floor.
- The slow 300 mm/s backward leg does not reproduce. Across the 38 legs at ±300 in this session (811E, every candidate), the second half of every leg read 297 to 302 mm/s on both wheels, at 49 to 53 duty of 75, so the loop had authority to spare. The 15:34 leg was on B4AB late in its battery and near the parked cabled robot; an obstruction or drag there fits, but that is not established.
- Code and bases. DotBot-libs wheel-control: b9427bb (the P term while stalled) and 205ba16 (dead-zone braking beyond i_zone), each with a host check that fails without its change; the fixture's kp moves to the shipped 0.5, and its own 75 ceiling stays so the no-windup check keeps a setpoint out of the model plant's reach; make test 45 passed; clang-format clean. DotBot-firmware wheel-control: 7f4b818 bumps the submodule to 205ba16, and cbd2de2 sets kp 0.5, pwm_max 100, pwm_slew_per_tick 100; sandbox-dotbot-v3 Release solution 0 warnings. Both are pushed fast-forward to fork (libs 8d42e22..205ba16, firmware 84fa914..cbd2de2); neither origin/main moved (libs 9646cf8, firmware 6f417db). PyDotBot: #297 merged as b51067c, and wheel-control was rebased locally from 89a2c4b onto origin/mainb51067c, now 995e0ad, clean; tests 835 passed, the same 5 environmental failures. That branch still needs the developer's force-push to fork, which an agent does not run. End state: B4AB runs the committed dotbot app from DotBot-firmware main, at rest at (1202, 460) in dev-corner, 2.67 V. 811EFD28 carries the same app, stopped, 2.95 V, at (2142, 827), where the developer left it outside dev-corner. Every process this session started is stopped. One excursion: in the y-lane distance legs on B4AB the robot drifted 13 degrees and its photodiode reached x = 995, so the body was about 50 mm past dev-corner's left edge for a few seconds, clear of anything.
- Open-loop duty against wheel speed: where the robot stops (B4AB5A04DF9E2426, untethered, dev-corner carpet; bench/pwm_vs_wheel.py, pwm_vs_wheel_fit.py, pwm_vs_wheel_figs.py, cam_pose.py; data bench/2026-09-23-cmp-*). How "before" is commanded:MOVE_RAW carries one int8 per wheel, and the robot writes duty = int(100 x value / 127) straight to db_motors_set_pwm. The dotbot app on main and dotbot-next (DRIVE_RAW, wheel loop reset) do exactly the same. On the host, the joystick sends axis x 127 and the keyboard turns by scaling one wheel by 0.75. So one image serves every mode and carries telemetry for all of them: the DB_BENCH_TELEMETRY build of DotBot-firmware cbd2de2, md5 ce307121, byte-identical to the image tuned at 17:00. MOVE_RAW resolves whole duties, and near the dead zone one duty is about 11 mm/s. Four modes, interleaved within each repeat: wheel speed (WHEEL_VELOCITY); PWM, fresh line, per-wheel per-direction duty lines re-fitted at 17:28 and 2.33 V from the closed loop's own steady duties over 1.4 s legs at 100 to 300 mm/s both ways (left forward 29.3 + 0.070 x mm/s, right forward 31.6 + 0.066, left backward 32.6 + 0.066, right backward 32.0 + 0.069; 2026-09-23-cmp-fit-fit.json); PWM, earlier line, the per-wheel lines of the 15:34 sweep; PWM, naive, one line 32 + 0.093 x mm/s for the mean speed, turning by scaling duty in proportion, as the keyboard does. Intended poses come from the commanded wheel speeds, the nominal duration, a 78 mm track and the measured start pose. Method: each run starts from rest after a 100 or 150 mm closed-loop probe into the start point, and the chord of that probe gives the start heading. A 120 mm backward probe after the end rest gives the end heading. Positions are the mean of the raw fixes over 2.2 s of rest, converted to the axle midpoint with the 52 mm lever arm. Heading errors are unwrapped with the encoder yaw. LH2 at rest: across 183 rests (3432 fixes) it reports whole millimetres, the median per-axis scatter is 0 and none exceeds 0.5 mm, so a probe heading is good to about 0.3 to 0.6 degrees. The camera witness agrees within 1 to 3 degrees at some places, reads +6 ± 3.5 degrees on the straight lane and flips by 180 on refused poses, so no number here comes from it.
Mode
Moved
Battery V
End error mm mean / sd / worst
Along mm mean
Lateral mm mean / worst
Spread mm rms
Heading deg mean / sd / worst
Speed vs intended %
Straight 0.6 m at 150 mm/s
Wheel speed
5/5
1.96-2.24
14 / 2 / 17
−13
+4 / +9
5
+1.8 / 1.1 / +3.0
−4
Wheel speed, setpoints at 0.0948 mm/count
5/5
1.96-2.24
12 / 3 / 17
+11
+4 / +9
5
+1.8 / 1.1 / +3.0
+0.0
PWM, fresh line
2/5
1.91-2.20
90 / 3 / 92
−90
−6 / −8
3
+1.4 / 3.2 / +3.7
−12
PWM, earlier line
4/5
1.94-2.23
204 / 10 / 218
+168
+116 / +126
9
+19.4 / 2.4 / +22.8
+36
PWM, naive
5/5
1.91-2.19
217 / 16 / 230
+214
+35 / +58
21
+8.4 / 1.7 / +9.8
+41
Straight 0.45 m at 300 mm/s
Wheel speed
4/4
1.64-1.88
18 / 9 / 31
+16
0 / +8
12
+1.4 / 1.9 / +3.1
−4
Wheel speed, setpoints at 0.0948 mm/count
4/4
1.64-1.88
35 / 10 / 49
+34
0 / +8
12
+1.4 / 1.9 / +3.1
+0.1
PWM, fresh line
4/4
1.59-1.84
76 / 6 / 84
−76
−3 / −8
7
−0.6 / 3.1 / +3.9
−14
PWM, earlier line
4/4
1.61-1.86
102 / 6 / 107
+102
+5 / +14
8
+3.3 / 1.6 / +5.2
+22
PWM, naive
4/4
1.66-1.83
129 / 7 / 136
+126
+27 / +37
9
+6.8 / 0.9 / +8.0
+27
Arc 250 / 150 mm/s for 2.45 s (180 deg)
Wheel speed
4/4
1.28-1.57
77 / 3 / 81
+74
+20 / +21
3
−24.5 / 1.1 / −25.3
−4
Wheel speed, setpoints at 0.0948 mm/count
4/4
1.28-1.57
59 / 3 / 62
+55
+21 / +22
3
−17.3 / 1.1 / −18.1
−0.1
PWM, fresh line
3/4
1.22-1.52
425 / 11 / 432
+391
−167 / −178
12
−139.9 / 4.4 / −143.4
−5
PWM, earlier line
4/4, 4 cut
1.25-1.55
457 / 9 / 466
+448
+86 / +101
14
−99.0 / 1.3 / −100.0
+42
PWM, naive
4/4, 2 cut
1.31-1.51
130 / 21 / 149
−16
+77 / +102
105
−10.5 / 32.9 / −46.3
+44
Spin 180 deg at ±100 mm/s
Wheel speed
3/3
1.07-1.17
3 / 1 / 4
+1
−3 / −4
1
−11.8 / 0.6 / −12.4
−4
Wheel speed, setpoints at 0.0948 mm/count
3/3
1.07-1.17
3 / 1 / 4
+1
−3 / −4
1
−4.6 / 0.6 / −5.3
+0.3
PWM, earlier line
0/3
1.04-1.15
never moved: duty 41 / −42 is below breakaway from rest; heading error −177 deg
PWM, naive
0/3
1.07-1.15
never moved: duty 41 / −41 is below breakaway from rest; heading error −178 deg
The table covers the runs that moved: "Moved" counts runs that left the start, and "cut" counts runs stopped by the edge watchdog, whose errors are therefore lower bounds. Along is measured on the start heading, positive meaning too far; lateral is positive to the right of travel. Spread is the rms distance of the endpoints from their own mean. Speed is the mean over the commanded interval after 300 ms, from the robot's counts at 0.0948 mm per count. The "setpoints at 0.0948 mm/count" row converts the loop's setpoints, which are in the firmware's 0.0987 mm per count, before integrating, which separates the loop from the constant.
Figure 4. Endpoint error of the axle midpoint against the intended endpoint, one mark per run that moved, for the two straights and the arc. Each panel has its own scale. Circles (wheel speed) sit within 20 mm on both straights. The open-loop modes are tight groups far from the target: repeatable, and wrong by the model's error. Hover a mark for its run.Figure 5. Heading error at rest, every run including the stalled ones: the open-loop spins never turned, and one fresh-line arc never moved, so each sits near -180. Wheel speed is within 3 degrees on the straights but under-turns the arc by 25 and the spin by 12.Verdict per metric.Endpoint: wheel speed stops 14 mm off on 0.6 m at 150 and 18 mm off on 0.45 m at 300. The best open loop, a line fitted 40 minutes earlier, is 90 and 76 mm off when it moves at all; the earlier line and the naive duty are 100 to 230 mm off. That is 5 to 15 times better. In the arc wheel speed is 77 mm off against 130 to 460. Stalls: wheel speed never stalled, thanks to the stall push. Open loop did not start in 11 of 45 runs. Ten had a wheel at 41 duty or below: 3 of 5 fresh-line straights at 150 (40 / 41), 1 of 4 fresh-line arcs (47 / 41) and all 6 spins (41 / 42). The eleventh was 1 of 5 earlier-line straights at 46 / 45. Lateral drift: +4 mm mean (worst +9) with wheel speed on 0.6 m, against +116 for the earlier line and +35 naive; the fresh line is similar to wheel speed (-6) when it moves. Repeatability: wheel speed spreads 5, 12 and 3 mm; open loop spreads 3 to 21 mm on the straights. The improvement is accuracy and reliability, not repeatability within a session. Open loop repeats its own error, and that error moves as the battery falls. Heading: +1.8 ± 1.1 degrees per 0.6 m with wheel speed, against +8 to +19 for the older open-loop lines; the fresh line is +1.4 ± 3.2. Speed tracking: the loop holds its setpoint to 0.0 to 0.3 per cent in its own units, while open loop runs at -14 to +44 per cent of the intended speed. Where wheel speed does not help: turning. The arc turns 155 degrees for 180 and the spin 168. With the constant corrected that is still -17 in the arc and -5 in the spin, which is scrub and slip, an effective track of about 85 to 87 mm in the arc. The +1.8 degrees per 0.6 m on straights with equal counts on both wheels is also not the loop's to fix. Both need the phase 5 estimator, which carries a heading from LH2. What drives the remaining wheel-speed error: (1) the mm-per-count constant: setpoints are in 0.0987 mm per count against the measured 0.0948, so the robot runs 4 per cent slow, -24 mm over 0.6 m. This lane's LH2 travel per count reads 0.0949 and 0.0947 (sd 0.0002 to 0.0004), so the corrected row is on the right scale. (2) A stop is a coast: a zero setpoint returns duty 0 (wheel_control.c, the setpoint == 0 branch), so the robot runs on 12 mm (190 ms) after the setpoint drops at 150 and 41 mm (320 ms) at 300. That run-on is the +11 and +34 mm left in the corrected rows, and braking to zero would remove most of it. Start latency is 10 to 20 ms in every mode. (3) Turning slip, above. (4) The carpet: 0.0948 is itself the mean of lane- and direction-dependent values (±0.8 per cent, 17:00 entry). What drives the open-loop error: a stale model first. The 15:34 line, measured at 2.87 V, ran 36 per cent fast at 150 two hours later. The line fitted at 17:28 and 2.33 V ran 12 to 14 per cent slow once the battery reached 1.6 to 2.2 V, within the hour. After that come breakaway from rest, the 32-duty dead zone, which makes a proportional turn (naive) far too tight, and one duty being 11 mm/s. Batteries (B4AB, per run in the table): 2.24 to 1.91 V on s150, 1.88 to 1.59 on s300, 1.57 to 1.22 on the arc and 1.17 to 1.04 on the spin; the pack fell about 16 mV per run cycle. The arc and spin rows are below 1.5 V and flagged as less reliable, although the wheel-speed spread there is 1 to 3 mm. Deviations from the brief: the 300 mm/s straight is 0.45 m (1.5 s), because the older open-loop lines overshoot by a third and would have reached the arena wall at y = 0. The spin ran 3 repeats without the fresh mode, and the stop was set at 1.05 V to keep margin for the final flash. Two starts in lanes that let the open-loop drift reach the dev-corner edge were stopped by the watchdog, and one batch was killed without its telemetry; all three are discarded, and the watchdog now looks 0.4 s ahead. One naive run at 150 stopped with its photodiode at y = 21, which may have touched the top wall. Videos, one per run, not committed: a scratch folder (61 clips, from scripts/record-camera.py on the developer's controller). End state: B4AB runs the committed dotbot app from DotBot-firmware main (6f417db, md5 08e489bd), at rest at (1379, 448) in dev-corner at 1.01 V. 811EFD28 was not touched: stopped, 2.95 V, at (2142, 827). The side controller and every process this session started are stopped.
- A stop now brakes (fix for driver (2) of the 18:11 entry). The motor driver already had db_motors_brake() (DotBot-libs 4d2447a, on main and on this branch): full duty on both inputs of each DRV8833 bridge, the both-inputs-high brake state, held until the next db_motors_set_pwm(), but for both motors at once. DotBot-libs wheel-control: 5ee614b adds db_motors_set_pwm_brake(l, r, l_brake, r_brake), which brakes each motor on its own (the two old calls now go through it); 45efa83 gives the wheel loop a brake flag, set while the setpoint is zero and the wheel still turns (fewer than STALL_TICKS = 4 steps without a count), so the motor is shorted until the wheel stands and then coasts, and a stopped wheel that is pushed brakes again. The integral and the kick are already cleared at zero, and the stall counter carries over, so the next start gets the kick. The dead-zone rule is unchanged: it only acts at a non-zero setpoint and drives against the motion rather than shorting. Host test test_stop_brakes_then_releases (a stop from 150 against the model plant with a shorted-motor lag): brakes on the first step with integral and kick zero, releases with the plant at 0, stays released, re-brakes when pushed, drives on a new setpoint; it fails 3 checks with the flag forced off, and make test gives 51 passed. DotBot-firmware wheel-control: 5c2dfcb bump, 9fbd8a2dotbot-next passes each wheel's flag to the driver; the loop now also steps in DRIVE_IDLE, so a deadman timeout or a control-mode stop brakes both wheels at once and the loop releases each when it stands; the timeout fires only when not already idle; the bench telemetry and trace report a braked motor as duty -128. All 9 sandbox apps build for sandbox-dotbot-v3 Release with 0 warnings, as do the DB_BENCH_TELEMETRY (md5 4e72f193) and DB_BENCH_TRACE builds. Bench, partial: B4AB is exhausted and not joined, and sits at (1379, 448) in the old lane. 811EFD28FACDE21A has no J-Link on this host (the only probe, 1050060972, is the gateway's, serving mari-edge on ttyACM2), but the camera shows a cable trailing from it: it drives straight, but its spins do not turn it (a 170 degree spin moved it 24 mm and 4 degrees), so the 4 x 2 trajectory runs were not made and nothing here is untethered. From the stops it did make on the telemetry build, measured the way the 18:11 figures are (counts from the first zero-setpoint step until the wheels stand, 0.0948 mm per count): from 150 mm/s, 4.6 to 5.8 mm over 80 to 130 ms (4 stops), against 11.0 to 13.2 mm over 170 to 230 ms on B4AB at 18:11; from 300, 12.2 and 12.5 mm over 130 to 160 ms (2 stops), against 39.9 to 42.8 mm over 310 to 350 ms. The brake shows as -128 on both wheels and releases 4 steps after the counts stop. Caveats: a different robot, tethered, which if anything shortens a stop; endpoint error is not measured. The straight-line endpoint check on an untethered robot is still to do. 811E was left at rest at (1692, 727) running the dotbot app from DotBot-firmware main 6f417db (md5 08e489bd), tethered as found, about 450 mm west of where it started. Scratch and scripts in a scratch folder (lane.py, runon.py); no videos, since no trajectory run started.
- The target, stated by the developer: seen from the higher-level (outer) loop, the robot behaves close to a unicycle, with very sharp turns including turning in place. What this phase already supplies, from this log: independent speed control per wheel, including opposite directions; a spin in place that stays within about 3 mm of its spot (18:11, spin rows); push from rest (the stall push); dead-zone braking; and, since 18:51, braking to zero. What remains is phase 5 and 6 work: a kinematics layer from (v, ω) to wheel speeds using an effective track calibrated on the floor, and heading feedback from the estimator.
- The turn-angle shortfall is not this loop's job (developer). The loop holds each wheel within 0.3 per cent of its setpoint, yet with the distance constant corrected the 18:11 arcs turn about 17 degrees short and the spins about 5, which implies an effective track of about 85 to 87 mm against the 78 mm geometric one, from tyre scrub and slip on the carpet (the 15:34 spin fit gave 84.9 to 85.5). No inner-loop change follows: the track goes into the (v, ω) conversion after a calibration step, and the residual to the estimator (phase 5 log).
- Distance per count, measured by hand: 1430 counts per wheel revolution and a 43 mm wheel (811EFD28FACDE21A, motors coasting, telemetry build of DotBot-firmware cbd2de2; bench/count_by_hand.py; data bench/2026-09-23-count-by-hand-{wheel,push}-811E.csv). Method. Wheel mode: the robot held off the floor and one wheel turned by hand through 5 revolutions against a mark, 4 trials per wheel, the count read from the credited encoder totals in the radio telemetry. Push mode: the robot pushed by hand along a measured straight. The wheel diameter was taken by caliper, unloaded: 43 mm, against the 44 in the code.
Trial
Wheel
Counts / 5 revs
Counts / rev
1
right
7149
1429.8
2
right
7159
1431.8
3
right
7147
1429.4
4
right
7143
1428.6
5
left
7141
1428.2
6
left
7159
1431.8
7
left
7157
1431.4
8
left
7141
1428.2
mean 1429.9, sd 1.6 (standard error 0.55), range 1428.2 to 1431.8; right 1429.9 ± 1.4, left 1429.9 ± 2.0
Trial
Left
Right
mm / count at 1000.7 mm
1
10062
10017
0.0997
2
10084
10087
0.0992
3
10299
10334
0.0970
4
9193
9189
0.1089
5
10210
10173
0.0982
6
9982
9856
0.1009
7
10153
10194
0.0984
8
10035
9969
0.1000
mean of the wheel means 9990 ± 346 counts, 0.1002 mm/count; without trial 4, 10104 ± 133, 0.0990 mm/count
The push distance is assumed to be 1000.7 mm. The tool recorded 10007 mm, which would mean about 1 mm per count, ten times anything else measured; a misplaced decimal point is the only reading that fits. The push trials are not used for the constant. At the wheel-mode scale 1000.7 mm is 10592 counts; the push read 4.6 per cent fewer (without trial 4), with a spread of 1.3 per cent against the wheel mode's 0.1, and trial 4 is 13 per cent short. Pushing a coasting robot back-drives a stiff 50:1 gearbox through the tyres, so the wheels slip on the carpet and turn less than the distance covered; that loses counts, never adds them, and it varies from push to push, which is the pattern here. The same effect makes the earlier 01bsp_qdec push (1400 per "about 140 mm") a low reading rather than a measurement of the encoder.
Result.1430 counts per wheel revolution, both wheels, which rules out DotBot-libs#27's 30 counts per motor revolution (1500) by 45 standard deviations and is 2.1 per cent above the nominal 28 × 50 = 1400. With the 43 mm wheel: π × 43 / 1430 = 0.0945 mm per count, against 0.0948 ± 0.001 from the 24 LH2 rest-to-rest legs (17:00 entry), a 0.3 per cent difference inside that measurement's own uncertainty. No tyre-compression or effective-diameter term is needed. The coded 0.0987 read every distance 4.5 per cent long.
The 2 per cent is open. The developer measured the gearbox at 50:1 with the motor out of the robot, so the extra counts sit on the encoder side: 1430 / 50 = 28.6 counts per motor revolution, and no encoder gives a fractional count per turn. Candidates, most likely first. (1) Double transitions credited as two counts. The loop's total is ACC + 2 × ACCDBL, signed by ACC (db_wheel_control_counts), and the QDEC runs with its debounce filter off at the 128 µs default sample period. At hand speed, about 140 counts per second, the two channels' edges are milliseconds apart, so a genuine double transition is not possible; any ACCDBL during these trials is noise, and each one adds 2. Fifteen spurious doubles per wheel revolution, 0.3 per motor revolution, would account for all of it. The telemetry frame carries only the credited totals (double_total_* is counted in dotbot-next but not sent), so these trials cannot show it. (2) The encoder is not 7 pulses per revolution. Nothing in docs-hardware names the encoder beyond the BOM's N20 footprint, so 7 is inferred, not read from a datasheet; but no integer pulse count gives 28.6, so this cannot explain it alone. (3) Over-turning by hand: 8 trials within ±2 counts and two wheels agreeing to 0.1 count make a consistent 2 per cent over-turn implausible. The LH2 floor measurement agrees with 1430, and it counts the same way, so whatever the cause it is present when driving too, and the constant has to carry the measured value either way. What settles it, both harmless: send double_total_left/right in the telemetry frame and repeat 5 hand-turned revolutions (about 75 doubles per wheel means the credit explains it; near zero rules it out), or repeat the trials with DBFEN on, which is safe at hand speed (1400 would point at spurious edges). Neither was run.
Code. The nominal and the measured value are kept apart: DotBot-libs drv/geometry.h keeps DB_ENCODER_CPR 28 and DB_GEAR_RATIO 50, sets DB_WHEEL_DIAMETER to 43 and adds DB_COUNTS_PER_WHEEL_REV 1430 for v3 (nominal CPR × ratio for v1 and v2), and DB_MM_PER_COUNT and drv/move now divide by it; make test 51 passed. PyDotBot's geometry record gains counts_per_wheel_rev, mm_per_count derives from it, and the 43 mm wheel moves the tyre-corner reach from 89.33 to 88.91 mm, which three tests pinned; test_control_loop_geometry.py passes against the library built from this header, and the suite is 847 passed, 5 failed (the known four in test_cli_helpers plus test_controller_dotbot_simulator, which fails the same way without this change). In dotbot-next the wheel loop's speed now reads 0.957 of what it did, so the fitted line duty = 32 + 0.093 × mm/s becomes 32 + 0.097 × mm/s; k_run, kp (0.5 to 0.52) and ki (5.0 to 5.2) are divided and i_zone (40 to 38) multiplied by that ratio, a unit change that leaves the loop identical in counts and duty. Breakaway and u_run are duty and do not move. All nine sandbox apps build for sandbox-dotbot-v3 Release with no warnings; nothing was flashed from this build. Commits on wheel-control, pushed to fork: DotBot-libs 45efa83..445275c, DotBot-firmware 9fbd8a2..263d1c4 (submodule bump a55939e, gains 263d1c4), PyDotBot 995e0ad..a2df021. PyDotBot CI builds the pin test against DotBot-libs main, so it fails until the header reaches main. DotBot-libs#27 was closed with the evidence (comment).
Robots restored. Both carry the committed dotbot app from DotBot-firmware main6f417db (digest e55b0e36, 53/53 chunks each over the air): 811EFD28FACDE21A running in dev-corner at 2.46 V, B4AB5A04DF9E2426 stopped in the bootloader at 2.95 V. Neither was driven.
- The 2 per cent is explained: the gearbox is about 51:1, not 50:1. The developer recounted the gearbox by hand, motor removed, wheel turns against motor turns, and found about 51; 52 was considered and rejected, since 28 × 52 = 1456 is far outside the data. 28 × 51 = 1428 is within 0.14 per cent of the measured 1430, and hand turning biases slightly high because turns tend to overshoot the mark. The encoder is 28 counts per motor revolution as assumed, so the double-transition candidate of the 19:48 entry is moot and nothing needs to run to settle it. This supersedes that entry's "the 2 per cent is open" and its statement that the ratio was measured at 50.
Code. The separate measured constant is gone again: DotBot-libs drv/geometry.h sets DB_GEAR_RATIO 51 for v3 (v1 and v2 keep 50, now inside the board branch), drops DB_COUNTS_PER_WHEEL_REV, and DB_MM_PER_COUNT and drv/move derive from DB_ENCODER_CPR × DB_GEAR_RATIO for every board; make test 51 passed. PyDotBot sets gear_ratio 51 and drops counts_per_wheel_rev; the mm_per_count pin moves to π × 43 / 1428 = 0.094599, and no reach pin moves because the wheel is unchanged. test_control_loop_geometry.py and test_robots.py pass (51) against the library built from this header, the suite is 847 passed, 5 failed (the known four in test_cli_helpers and test_controller_dotbot_simulator), and pre-commit is clean on the changed files (isort flags three files from the earlier wheel velocity commit, left alone). Distance per count moves 0.09447 to 0.09460 mm, +0.14 per cent, so the dotbot-next gains are not retuned. All nine sandbox apps build for sandbox-dotbot-v3 Release; nothing was flashed or driven. Commits on wheel-control, pushed fast-forward to fork: DotBot-libs 9d3f8b8, DotBot-firmware 5970d4a (submodule bump), PyDotBot c55c31a. Follow-up on DotBot-libs#27.
- Effective track, untethered brake, speed limits and a shortened check (b) (B4AB5A04DF9E2426 and 811EFD28FACDE21A, untethered, dev-corner carpet, LH2 calibration 50bab903 pushed over the air at 20:12; both robots flashed over the air with the DB_BENCH_TELEMETRY build of DotBot-firmware 5970d4a, digest 7ad339be; tools bench/track_cal.py, track_fit.py, track_figs.py, brake_runon.py, sat_metrics.py, slow_metrics.py, cam_log.py, cam_vs_lh2.py, on pwm_vs_wheel.Bench; data bench/2026-09-23-trk-*). No firmware logic or gain was changed.
Method. Every manoeuvre starts and ends at rest and is bracketed by closed-loop straight probes of 100 mm; each probe's chord between the mean LH2 fixes of its two rests gives the heading, at the end of the probe before and at the start of the probe after (chord minus half its encoder yaw), and probes chain so one probe closes a manoeuvre and opens the next. The rotation is unwrapped against the encoder yaw. The effective track is (dL − dR) over the rotation, with dL and dR the wheel distances from the frame totals between the two rests at 0.0946 mm per count; the same figure from the commanded speeds times durations is kept beside it and agrees within about 2 mm up to 300 mm/s. Spins are one commanded turn at 50 to 600 mm/s per wheel, both directions; arcs are full circles of 100 to 250 mm axle radius at 100 and 200 mm/s, driven as two half circles, each closed by a backward probe, both directions, laid out on the geometric 78 mm; 229 samples in all. A heading error of 1 degree moves a spin's track by 0.2 mm and a half circle's by 0.5 mm.
Spin, mm/s per wheel
B4AB mm mean ± sd (n)
811E mm mean ± sd (n)
Pooled mm
Dir + / − mm
Deg per turn asked
Battery V
50
80.4 ± 0.4 (6)
79.9 ± 0.2 (10)
80.1
80.0 / 80.2
366
1.5-2.8
100
81.5 ± 0.3 (8)
80.7 ± 0.3 (10)
81.0
81.1 / 81.0
363
1.5-2.8
120
-
81.2 ± 0.1 (4)
81.2
81.1 / 81.2
366
1.8-2.0
200
83.5 ± 0.4 (6)
82.7 ± 0.5 (10)
83.0
83.0 / 83.0
361
1.5-2.8
300
87.1 ± 0.5 (6)
86.5 ± 0.5 (10)
86.7
86.8 / 86.7
346
1.5-2.8
400
-
94.2 ± 1.2 (4)
94.2
95.0 / 93.3
312
2.8-2.9
500
-
101.8 ± 0.7 (4)
101.8
101.9 / 101.8
291
2.8-2.9
600
-
106.5 ± 1.6 (4)
106.5
106.2 / 106.9
255
2.8-2.9
Arc, radius mm / axle mm/s
B4AB mm mean ± sd (n)
811E mm mean ± sd (n)
Pooled mm
Battery V
20 / 41
-
81.5 ± 0.6 (8)
81.5
2.0-2.1
39 / 60 (pivot)
-
82.1 ± 1.1 (8)
82.1
1.9-2.1
60 / 73
-
83.0 ± 0.6 (8)
83.0
1.9-2.1
100 / 86
-
84.1 ± 1.1 (8)
84.1
1.9-2.1
100 / 100
84.6 ± 1.4 (4)
83.8 ± 0.8 (12)
84.0
1.5-2.7
100 / 200
86.1 ± 1.7 (4)
85.5 ± 1.0 (12)
85.7
1.4-2.7
150 / 100
84.5 ± 1.0 (4)
84.5 ± 1.2 (4)
84.5
2.5-2.7
150 / 200
86.2 ± 1.5 (4)
85.4 ± 1.6 (4)
85.8
2.4-2.6
200 / 100
84.4 ± 1.1 (4)
84.8 ± 1.6 (12)
84.7
1.4-2.6
200 / 200
85.2 ± 1.2 (4)
85.6 ± 1.8 (12)
85.5
1.3-2.6
250 / 100
84.7 ± 1.3 (4)
84.8 ± 1.9 (4)
84.7
2.3-2.5
250 / 200
85.0 ± 1.9 (4)
85.6 ± 1.9 (4)
85.3
2.2-2.5
Figure 6. Effective track against speed, one mark per manoeuvre: spins at the wheel speed, arcs at the axle-midpoint speed, both robots, offset sideways so they do not overlap. The two robots agree within 1 mm at every speed. The spin track grows from 80 at 50 mm/s to 87 at 300 and then fast; arcs sit near 85. Hover a mark for its run.Arc against spin, separated. The 4 mm between arcs (about 85) and slow spins (about 81) is not the start and the stop: a spin of two turns gives the same track as one turn at every speed tried (100: 80.8 against 81.0; 300: 85.6 against 86.7; 500: 100.6 against 101.8; 4 each), so the shortfall accumulates during the rotation. It grows smoothly with the turn radius at a similar outer-wheel speed of 120 to 139 mm/s (Figure 7): 81.2 in place, 81.5 at 20 mm, 82.1 pivoting on a stopped wheel at 39, 83.0 at 60, 84.1 at 100, then 84.4 to 84.7 out to 250. There is no step where the inner wheel stops or reverses, so the direction a wheel rolls is not the cause. Speed raises it in both: arcs at 200 read 1.2 mm above arcs at 100. And the floor: a half circle that sweeps its heading through +x reads 86.0 (sd 1.2, n 52) and one through −x 83.9 (sd 0.8, n 52), identical on both robots, while full circles average 85.0 on each, so that part belongs to the carpet (or an LH2 skew), not to the robot. What remains unexplained is why a larger radius costs more rotation per unit of wheel difference; caster and tyre scrub are candidates this data cannot tell apart.
Figure 7. Effective track against the turn radius near 100 mm/s: spins at 100 and 120 mm/s per wheel at radius 0, arcs at 41 to 100 mm/s at their radius, both robots. It rises from about 81 in place to about 85 by 100 to 150 mm and stays there, with no step at the pivot (39 mm).Recommendation for the (v, ω) layer. One constant is not enough for open-loop turns better than about 4 per cent. The developer's decision takes the worst part away: turn in place only below a trusted spin limit, and drive fast only once aligned. From the spin table that limit is 200 mm/s per wheel (about 275 deg/s), where the spin track is 80.1 to 83.0, sd at most 0.6, direction under 0.2; use 82 mm there (±2 per cent), or 81 below 120 mm/s (±1 per cent). For curves of 100 mm radius or more use 85 (±2 per cent, mostly the carpet); between a pivot and 100 mm interpolate. Above 300 mm/s per wheel a spin on this carpet loses 13 to 30 per cent of its rotation (400 to 600), confirmed by the camera to within ±15 degrees, so it must not be used for turning. The residual is for the estimator's heading feedback. The 85 to 87 expected from the 18:11 comparison came from arcs, and holds for them.
Brake to zero, untethered. From the step-down to a zero setpoint until both wheels stand, counts at 0.0946 mm; legs of 300 mm alternating forward and back.
From mm/s
Untethered run-on mm mean ± sd (n), robot
Time to stand ms
Tethered, 18:51 mm
100
3.4 ± 0.2 (7) B4AB; 3.4 ± 0.2 (6) 811E
100
-
150
6.0 ± 0.3 (4) 811E; 6.0 (1) B4AB
115-130
4.6-5.8 (4)
200
8.7 ± 0.3 (6) B4AB
130
-
300
15.1 ± 1.7 (6) B4AB; 14.5 ± 0.4 (2) 811E
165
12.2, 12.5
400
19.4 ± 0.6 (6) 811E
165
-
500
25.6 ± 0.8 (5) 811E
175
-
600
31.9 ± 1.6 (6) 811E
185
-
700
37.0 ± 2.8 (2) 811E
210
-
Figure 8. Run-on after the zero setpoint against the speed before it, per stop: untethered B4AB (100 to 300 mm/s) and 811E (100 to 700), and the tethered stops of 18:51 (the two ends of the 150 mm/s range, and both 300 mm/s stops). Untethered runs 15 to 20 per cent longer than tethered, and grows about linearly, 0.05 s times the speed.Top speed and saturation (811E at 2.9 V, 300 mm straight legs, sat_metrics.py). The loop holds 600 with a few steps at the ceiling and 700 with a third of them there; 750 and 800 saturate and do not reach the setpoint within the leg. The encoder may add a limit of its own there: QDEC's default 128 µs sample period allows about 7800 transitions a second, and 700 mm/s is 7400 counts a second; forward 700 mm/s legs read 2 per cent longer on LH2 than on the encoders where 300 mm/s legs read 2 to 3 per cent shorter. That hints at dropped counts and is not settled.
Setpoint mm/s
Measured L / R mm/s after 150 ms
Steps at the ceiling L / R
Mean duty L / R
±300
300.7 / 300.5, −303.1 / −303.5
0 / 0
53 / 52
±400
402 to 406
0 / 0
59 to 62
±500
504 to 511
0 / 0
66 to 72
±600
603 to 608
0.03-0.06
76 to 83
±700
696 / 697, −689 / −690
0.28-0.41
90 to 94
±750
651 / 716, −622 / −699
0.64-0.92
75 to 98
±800
685 / 725, −602 / −615
0.91-1.00
82 to 100
High-speed spins (811E, 2.8 to 2.9 V): 400, 500 and 600 mm/s per wheel give 94.2, 101.8 and 106.5 mm, and one commanded turn becomes 312, 291 and 255 degrees; the loop holds the wheels (592 to 605 at 600, 11 to 44 per cent of steps at the ceiling), so this is slip on the floor, not the loop.
Slowest speed held (811E at 1.1 to 1.3 V, straights of 100 mm and spins of 90 degrees; LH2 agrees with the encoder speeds within 1 mm/s): 20 mm/s and above within 1 per cent on straights; 15 is 3 to 4 per cent slow; 10 is 12 per cent slow, with 33 to 49 per cent of steps carrying no count (1.06 counts a step at 10 mm/s, so this is partly quantisation and partly the wheel stopping); 5 mm/s runs at 2.5 to 3 mm/s in pulses. The spins' larger errors include the start of a short manoeuvre. The spin at 10 and 5 was not reached: the battery hit the 1.0 V stop.
Setpoint mm/s
Straight, achieved L / R mm/s
Error per cent
Steps with no count L / R
Spin 90 deg, error per cent
40
40.1 / 40.3
+0.4
0 / 0
−2 to −3
30
30.1 / 30.3
+0.2 to +0.9
0.01 / 0.01
−3 to −4
20
19.8 / 20.1
−0.1 to −0.9
0.03-0.06 / 0.01
−5 to −6
15
14.2 / 14.7
−3 to −4
0.19-0.24 / 0.13-0.15
−10
10
8.3 / 9.2
−12 to −13
0.43-0.49 / 0.33-0.35
not run
5
2.5 / 3.1
−41 to −47
0.77-0.80 / 0.71-0.73
not run
Check (b), shortened and partial. Dev-corner limits a straight to about 0.8 m, so these are not the plan's 2 m and not three robots. Each run: a goto to (1330, 330) facing 45 degrees, the length cut to what fits the box on the heading the goto reached, then equal wheel speeds, the endpoint the mean fix at rest, the lateral error across the start heading. At 150 mm/s: B4AB 6 runs of 0.64 to 0.80 m, lateral +4.0 mm (sd 6.7, −3 to +16), heading change −0.2 (sd 0.8) degrees, 2.3 V; 811E 6 runs of 0.62 to 0.72 m, +3.8 mm (sd 10.2, −12.5 to +14), +0.1 (sd 1.7) degrees, 2.7 V; along the line both overrun by 6 to 8 mm, the brake run-on at 150. At 400 mm/s, 811E 4 runs of 0.52 to 0.60 m: −11.1 mm (sd 1.9), −1.9 degrees. With two robots the between-robot spread the check asks for cannot be stated.
Battery. Speed tracking did not degrade with voltage: at 100 mm/s the measured speed stayed at 100.2 to 100.7 mm/s and the duty at 38 to 40 in every block from 2.95 V down to 1.0 V, and the 300 mm/s spins read 300 to 301 at duty 64 to 65 from 2.8 to 1.5 V. So the motor supply does not follow the battery reading over this range. The track did not move either: arcs at 100 mm/s give 84.5 above 2.2 V and 84.4 below 1.8 V. Top speed, the high-speed spins and the brake were measured at 2.8 to 2.9 V only, and the slow-speed floor at 1.1 to 1.3 V only. Each sample carries its voltage in the run files.
Robots and rotations. 20:13 both flashed and started; B4AB drove spins, arcs, brake and straights from 2.84 to 2.23 V. At 20:48 main paused the run and the developer took B4AB off the floor and placed 811E in dev-corner (B4AB came back stopped at (2244, 760), outside the box, 2.24 V). 811E then drove from 2.96 to 0.97 V. At 21:48 it was parked slowly (80 mm/s hops, extended box) at (956, 481), just west of dev-corner, 1.29 m from B4AB, and stopped. The planned rotation back to B4AB did not happen: stopped in its bootloader B4AB had drained from 2.24 to 1.24 V in an hour, so resting did not preserve its charge, and at 1.1 to 1.2 V it was not worth driving. Both robots were left stopped: 811E at 0.78 V at (956, 481), B4AB at 1.15 V at (2244, 761). The camera saw the room lights go off at about 20:54 (the last bright frame is 20:53); LH2 was unaffected, and no camera was logged after that.
Incidents. Six attempts at the straights on B4AB stopped at the box watchdog before the block ran: three gotos, which aimed with the old 85 mm spin track so large aiming turns overshot by about 10 degrees, one straight leg that left on the goto's off-aim heading, and two initial probes toward the nearest edge. Each stopped inside dev-corner (the closest fix was 25 mm from the top wall line), and track_cal.py now aims with 80.5 and shortens the leg to what fits. The pause at 20:48 was read only after the running straights block finished, 3 to 4 minutes late, because it ran as one blocking command; every block after that ran in the background.
- Results slide: old open-loop PWM against the new wheel-speed loop, one page summarising the 18:11 to 22:10 entries above, for sharing (source 2026-09-23-wheel-speed-vs-pwm.html, editable). Figure 9 shows it. The failed-start panel reads 11 of 45 open-loop runs against 0 of 16 wheel-speed runs, as the 18:11 table counts them.
Figure 9. Old open-loop PWM against the new wheel-speed loop, summary slide: endpoint error, failed starts, speed hold, run-on after a stop, time to reach a new speed and distance per count. The speed-hold and step traces are illustrative, not data.
- Review fixes landed on the PR branches, after a code review of DotBot-libs#32, DotBot-firmware#425, PyDotBot#298 . Stall protection: duty 80 or more with no counts for 500 ms coasts the wheel and flags it stalled (PWM_STALLED = -127 in bench telemetry); a changed setpoint or a reset clears it, a repeat of the same setpoint does not. Mailbox: the newest command wins, with barriers on both sides; the deadman refreshes only on drive commands. Speed cap: 800 to 700 mm/s, for QDEC headroom; the REST bound is ±700. Advert period: cached per advert. Tests: the wheel suite also runs on the shipped gains, 150 checks (was 51). PyDotBot#298: the simulator implements WHEEL_VELOCITY (500 ms stop), and the history was rewound to drop a temporary revert. Correction: the 4.2 per cent odometry change does not reach the production dotbot apps' steering (control_loop.c:197 sits under an EKF flag no target sets); it does reach drv/move, control_loop_get_geometry() and PyDotBot's simulator. Commits: DotBot-libs wheel-control50a58fb, DotBot-firmware wheel-control62fabc5, PyDotBot wheel-control1a0c4e5, all three on fork. The live region's code refs and interface contract now point at these tips.
- Merged. DotBot-libs#32 (plain merge commit caa788b, 06:41 UTC), PyDotBot#298 (rebase merge 1ed5f7b, 06:54 UTC), DotBot-firmware#425 (plain merge commit ff3e4c8, 06:58 UTC, submodule re-bumped to caa788b before merging). The wheel loop is on main in all three repos; chip to done. Phase 5's DotBot-libs#33 and DotBot-firmware#426 were also marked ready for review, still stacked on the pre-merge phase 4 commits until they are rebased onto the new main.
- Correction to the 09:29 entry: DotBot-libs#33 does not need a rebase. #32 landed as a plain merge commit, which does not rewrite commits, so #33's commits (and #34 through #36 behind it) keep their ids and GitHub shows #33 mergeable and CI-green directly on main. The submodule-pointer conflict is real but is DotBot-firmware's alone: #426 (and #427 through #429 behind it) each pin a DotBot-libs submodule commit that the matching libs PR's merge moves past on main, so those branches need a local rebase to re-point the submodule at the new libs tip, then a developer force-push, before each merges. Merge order and merge convention below corrected to match.
Phase 5The estimator~4 dDone
Predict on the scheduler tick from encoder deltas, update on a new fix sequence,
position-only two-row measurement with the lever arm in H, innovation gating,
and a declared reset after a fix timeout. Heading comes out of the filter; nothing
differences positions to get it.
Two constants that must not be inherited: process noise Q is currently
added per predict call, so moving predict to a faster tick silently detunes it by the rate
ratio - scale it by dt, or better by distance travelled, since slip is per-metre rather
than per-second. And measurement noise on any heading channel is not constant, which is
the other reason the heading measurement row is being removed rather than retuned.
First, the three numbers phases 1 and 2 did not record
Park a bot at a surveyed point for five minutes and take the standard deviation of
reported position; log the fix sequence against the tick to confirm it increments once
per solve and to get the rate and its jitter; count and size the outliers now crossing
the boundary. The first sets EKF_R_POS, the third sets the innovation gate
threshold. Both are otherwise guesses, and a guessed gate is the one that either passes
every outlier or rejects real motion.
Deliverable + check
The estimator as a DotBot-libs change with a public predict entry point, consumed by the
new app. Check: instrument a counter and confirm predict executes more often than
update; drive a straight line and expect the standard deviation of reported heading to
fall against the shipping apps-sandbox/dotbot, which is the only arm in
existence with a heading estimate to compare against; then drive a spin in place and confirm reported
heading tracks the true rotation rather than the tangential motion of the sensor, which
is the case that is wrong today by 90 degrees. That spin check is now also the
lever-arm measurement 3.13 asks for: log the raw lighthouse fixes through the spin and
fit a circle to them, since the centre is the pivot in room coordinates and the radius
is the effective lever arm, which tests DB_LH2_LEVER_ARM 53.5 directly.
Run it in both directions - the same body-frame offset points at geometry or the caster,
a direction-dependent one points at motor asymmetry - and spin slowly enough that the
10 Hz fix rate puts plenty of points around the circle.
Log
So far. The spin check became a two-direction circle fit of the logged fixes, measuring the effective lever arm; a by-eye reading off long-exposure photographs puts the pivot 10 to 15 mm forward of the axle, an effective arm of about 38 to 43 mm against the coded 53.5, and the fit itself is still owed. At rest on 2026-09-21 the fix rate is exactly one new fix per 100 ms poll with no gaps, and resting noise is below the 1 mm reporting resolution, so EKF_R_POS has to come from moving fixes or quantisation plus calibration error. On 2026-09-23 the resting numbers were re-taken under the new calibration and the outlier distribution was measured from 47 237 moving fixes: no fix off by more than 50 mm, so the gate can be generous; see the log. The camera figures from that night, including a 52.9 mm lighthouse-to-camera offset, may come from dark frames and are unverified. On 2026-09-24 the estimator ran on both robots: it acquires heading after 40 to 44 mm of travel or about 60 degrees of spin, holds it within 2 degrees at rest over 50 manoeuvres with no fix rejected, recovers from hand moves, and now compensates a measured fix age of 2 ticks; see the 10:10 entry.
Earlier log, 2026-08-27 to 2026-09-22 (6 entries)
- phase created; not started.
- the spin check is refined into a circle fit of the logged
lighthouse fixes, run in both directions, so it measures the effective lever arm
instead of only confirming the sign of the heading response. Reasoning and the
two-case diagnostic are in 3.13. No new firmware is needed;
dotbot-next already reports raw fixes and the fix sequence. Phase remains
not started.
- the lever arm now has a number against it, read by eye off
the aligned long-exposure panels: the pivot sits 10 to 15 mm forward of the
axle midpoint, toward the photodiode, and is direction-dependent (about 15 mm
left, 10 mm or less right). Not the circle fit, which this phase still owes. Two
consequences for this phase. The effective lever arm is roughly 38 to 43 mm
against the coded 53.5, so it shortens without flipping sign - the failure 3.6 feared
needed the full 64.5 mm to the caster and did not happen. And the residual biases
the position measurement by 10 to 15 mm during a spin, which against the 5 mm
sigma implied by EKF_R_POS is two to three sigma, so the innovation
gate may start rejecting valid fixes during the aim phase. Instrument the spin run
for rejection bursts. Mitigations named in 3.13 and not chosen: a measured
r from the fit, or an inflated R while spinning. Phase remains
not started.
- a sibling idea page records an external camera rig as an
independent source for three of this phase's numbers: the pivot, the effective lever arm,
and a position sigma measured while the robot moves rather than while it is parked. See
A camera as the second witness. Nothing in this
phase depends on it, and the deliverables are unchanged.
- Two of the three numbers phases 1 and 2 passed here are measured, on 811EFD28FACDE21A at rest for 5 minutes (dotbot-next with a ring of every new fix in DB_BENCH_TRACE, DotBot-firmware c0a8cdc; data bench/2026-09-21-resting-fixes.csv, reader bench/fix_trace_metrics.py). Fix rate and jitter: 3000 fixes over 299.9 s, exactly one new sequence per 100 ms poll, every step of the sequence 1, interval sd 0: under the Phase 3 bootloader a stationary bot never starves a poll, which answers the question left open on 2026-08-28. Resting sigma: 0.00 mm in x and 0.04 mm in y, i.e. the solve does not leave one integer millimetre; resting noise is below the reporting resolution, so EKF_R_POS cannot come from it and should come from moving fixes or the quantisation (1/12 mm²) plus calibration error. Against the camera over the same window the lighthouse sits 52.9 mm away (lighthouse minus camera photodiode (-31.1, -42.8) mm), steady to a millimetre: larger than the usual 2 cm and recorded, not corrected. The outlier distribution, the third number, needs motion over the arena and is still owed.
- caveat from the developer: the lab lights are off from about 20:00 to 07:00, so every camera figure in the 2026-09-21 23:xx entries (the 52.9 mm lighthouse-to-camera offset and the 1.4 s leg's camera distance) may come from dark frames. Treat them as unverified and re-take them in daylight before drawing any conclusion from the offset.
- Added before the estimator work: calibrate the effective track (developer). Measure it the way distance per count was measured (phase 4, 17:00): spins and arcs against LH2 at rest, repeated, in both directions; then use it as the track in the (v, ω) to wheel-speed conversion instead of the geometric 78 mm. The 18:11 comparison implies about 85 to 87 mm. What calibration cannot remove stays with this phase and the outer loop's heading feedback: the dependence on carpet, speed and battery, and the +1.8 degrees per 0.6 m drift on straights with equal wheel counts.
- Phase 5 started: the three numbers, re-taken and completed (no estimator code; data bench/2026-09-23-trk-rest5-* and every bench/2026-09-23-trk-*-fixes.csv, reader bench/fix_outliers.py; LH2 calibration 50bab903, one station). At rest, 5 minutes, both robots parked with dotbot-next running (telemetry build): B4AB at (2244, 760), 244 mm outside dev-corner, 2996 fixes in 299.5 s, 10.00 Hz, every fix 10 ticks after the last, sequence steps all 1; sd 0.32 mm in x and 0.49 in y, the solve toggling between two integer millimetres on each axis. 811E at (956, 481), just west of dev-corner: 2990 fixes, one gap of 3 sequence numbers from a lost radio frame (the frame counters show no fix dropped on the robot), sd 0.45 and 0.14 mm. Both confirm the 2026-09-21 result (one fix per 100 ms, resting noise at the 1 mm resolution) under the new calibration and at a second place. Batteries were exhausted during it (B4AB 1.24 to 1.13 V, 811E 0.95 to 0.79 V) and it did not show in the fixes. Outliers, the third number, from the moving fixes of every phase 4 run today (47 237 fixes, dev-corner only): each fix against a quadratic through its three neighbours on each side, where the seven are consecutive. None fell outside the 0 to 10 m rectangle and none was off by more than 50 mm. On straights, arcs, brake legs and slow manoeuvres (30 268 fixes tested): median 0.5 mm, p99 4.4, p99.9 7.6, largest 17. On spins at 50 to 300 mm/s: p99 10.2, largest 16.6. At 400 to 800 mm/s: p99 19.3, largest 32.2, where the local fit cannot follow the photodiode around a fast spin, so these are upper bounds on the fix error rather than outliers. The 271 sequence gaps are lost telemetry frames, not missed solves. What this sets.EKF_R_POS: about 1 to 2 mm sigma while moving on straights and arcs (the p50 and p90), well above the resting 0.3 to 0.5, so the resting figure is not the one to use. The innovation gate: nothing here needs rejecting, and a gate below about 35 mm would have thrown out real fixes in the fast spins; a position gate near 40 mm (or a chi-square gate sized to that) passes everything seen today. The population the gate exists for, gross outliers near the arena edge or with two stations, did not occur in dev-corner and still has to be looked for there.
- The estimator, written and retuned to tonight's numbers (host-tested and built, not flashed; all commits local, nothing pushed). DotBot-libs estimator: c49f220 the effective track and the fitted lever arm, a8ee3ee the EKF with host tests, 05815e9 the twist mixer over the effective track, a40a8a0 the track rising with turn radius, 489c743 fix-age compensation and the floor constants. DotBot-firmware estimator: 08f9778 and 7e52c32 the submodule bumps, dd57c58dotbot-next running the estimator and advertising its heading. Design.drv/pose_estimator, pure C: state [x, y, theta] at the axle midpoint in the screen convention (forward (-sin, +cos), clockwise positive), degrees at the interface. Predict every 10 ms tick from encoder deltas with midpoint integration; update once per new fix sequence, two-row and position-only, h = axle + lever(theta) with the lever in H, over DB_LH2_LEVER_ARM_EFFECTIVE 51.5 mm (spin circle fit 52.0 clockwise, 51.3 counter-clockwise); the board's 53.5 stays in DB_LH2_LEVER_ARM because PyDotBot pins its photodiode against it. Process noise by distance, never by call rate: position per mm of axle travel, heading per mm travelled plus per mm of |d_right - d_left|, the turn term scaled up above a 250 mm/s wheel-speed difference. Life cycle SEEDING, TRACKING, LOST: no accepted fix for 1 s is LOST, predict carries on, a fix back inside the gate resumes with no reseed (occlusion), and a chain of 3 consistent fixes reseeds the whole pose (kidnap), which is 3.7's "N consistent fixes to reseed". dotbot-next predicts every tick on its own encoder cursor in any drive mode and advertises the filtered heading and photodiode while TRACKING, else -1000 and the last raw solve; its counters (predicts, accepted, rejected, seeds, last d2) are readable over the debugger for the predict-more-often-than-update check. Initial heading (DBK-142): passive acquisition on first motion, no start-up manoeuvre. A chain of fixes carries odometry in the body frame of its first fix, so zk - z0 = Rot(theta0)(b + Rot(dtheta) l - l): the two lengths must agree within 20 mm whatever theta0 is (the heading-free consistency test), and once the body-frame photodiode travel reaches 40 mm, theta0 is the angle between them. Because the lever arm is in it, the same rule acquires from a straight (40 mm) or from a spin in place (about 46 degrees). Not taken: carrying the last heading across a restart (needs swarmit shared-data work and is wrong once the robot is turned by hand), an active start-up spin (phase 6 may command one, and the passive path acquires from it), and new hardware (IMU, a second photodiode). Constants, from the floor. Track: 81 mm in place, rising linearly in |vleft + vright| / |vright - vleft| to 85 at 2.35, a 100 mm radius, and held there (db_track_effective_mm() in geometry.h), used by odometry per step and by the twist mixer, which solves the radius-track fixed point in three passes; against the phase 4 fit it is within 1 mm at 20 mm radius (81.8 against 81.5), the pivot (82.7 against 82.1) and 100 mm (85 against 84). Spin speed is not modelled. R_POS 9 to 4 mm² (2 mm sigma, the top of the moving 1 to 2). Gate: chi-square 2 dof raised from 13.8 (99.9 %) to 23.0 (99.999 %), because once R dropped to 4 the 13.8 gate locked out the fixes that would correct a 40 degree heading error (15 of 30 rejected in the host test); at 23.0 none are, and while tracking the gate is 14 to 18 mm per axis. The Q terms, the 1 s timeout and the seed constants (3 fixes, 20 mm, 40 mm) are unchanged. Fix age. A fix is 30 to 50 ms old on arrival (estimated, not measured), so 9 to 15 mm along-track at 300 mm/s and about 11 degrees of photodiode swing in a 200 mm/s spin. Treated as noise it is fatal at the measured R: in a scratch simulation at R 2.25 a plain 300 mm/s straight rejected 13 of 50 fixes and a 200 mm/s spin carried 12 degrees of heading error. So each fix is now moved forward by the photodiode travel odometry saw over the last DB_POSE_ESTIMATOR_FIX_AGE_TICKS (4) predicts before it is gated. With the real age anywhere from 30 to 50 ms, no fix is rejected in a 300 or 600 mm/s straight, a 200 mm/s spin, a 150 mm radius arc at 300 or a mixed sequence. The follow-up, if arrival accuracy needs it, is 3.5's: the app stamps sweep capture in the SPIM4 interrupt it already forwards. Where the data and the earlier assumptions disagree. The 15:34 spin-fit track of 84.9 to 85.5 mm used the old 0.0987 mm per count; on 0.0946 the same data give about 81.4 to 82.0, in line with tonight's spin fit. The lever arm is 51 to 52 mm, not the by-eye 38 to 43 of 3.13. At the 200 mm/s trusted spin limit the spin track is 83 against the 81 modelled, which in simulation shows as up to 4 degrees of heading error mid-spin that the fixes then remove; the contract's 82 is the compromise if that matters. The chi-square gate is still not the 40 mm the outlier data suggest: at 14 to 18 mm it passes every fix seen on straights, arcs and spins up to 300 mm/s (worst 17), but would reject the fast-spin tails (to 32 mm, upper bounds). Raising the threshold to about 150 would match 40 mm while tracking; that is the developer's call. For phase 6: until the estimator reports a heading (the advert carries -1000), the robot must drive 40 mm or spin about 46 degrees before its first aim; the outer loop should command that motion itself rather than aim on no heading. Checks:make test 53 passed (wheel control, 2 new twist checks) and 56 passed (estimator, 11 new: the effective track, and fix-age compensation against a simulated robot whose fixes lag by 4 ticks, including a check that the same fixes lag or are rejected with it off); dotbot-next, all 9 sandbox-dotbot-v3 Release apps and the 3 dotbot-v3 apps build on local SES 7.22 with no warnings. Scratch simulations in a scratch folder. Not yet on a robot.
- Kidnap rule on the estimator branches (DotBot-libs ebfa4fb, DotBot-firmware 341d027; draft PRs DotBot-libs#33 and DotBot-firmware#426). Three rejected fixes in a row that agree within 20 mm, with at most 2 mm of wheel travel, return the estimator to SEEDING: position follows the raw solve in about 0.3 s, and heading stays unknown (-1000) until motion re-acquires it. The drafts carry the phase 4 review fixes through merge commits. The chi-square gate stays at 23.0 (about 14 to 18 mm while tracking), the developer's decision: keep it tight, since spins are capped.
- TODO, not scheduled: lift detection (the developer's idea), listed in the live region's open items. A lifted, unloaded wheel needs much less duty for the same speed; in closed loop the PI hides the overspeed, so the signal is a wheel holding its setpoint at a duty far below the feedforward prediction (duty ≈ 32 + 0.097 × mm/s), that is a large negative integral, sustained. On detection: freeze odometry, since the wheels are not moving the robot, probably stop the motors, and re-acquire the pose when the robot is set down. It complements the kidnap rule, which covers moved while the wheels are still; this covers lifted while driving. Caveat: the threshold must allow for floor, battery and motor variation, so it could be calibrated per robot or learned online.
- Phase 5 floor test: the estimator on two robots, the phase 4 review fixes on hardware, and the fix age measured and changed from 4 to 2 ticks (811EFD28FACDE21A, green LED, and B4AB5A04DF9E2426, blue LED; untethered in dev-corner, one robot per half, 811E in y 40 to 460 and B4AB in y 540 to 960, each with its own box abort; LH2 calibration 50bab903, already on both; DB_BENCH_TELEMETRY builds of DotBot-firmware estimator341d027, digest dcf5fa54, then 21b7368, digest 0e787614, both over the air; batteries 2.9 V down to 1.8 V, recharged once at about 09:15; tools bench/est_run.py (blocks), est_tel.py and safe.py (advert capture, heading-safe first moves), replay.py with replay_wrap.c (the estimator replayed on the host), analyze.py, lead.py and kidnap_metrics.py, on bench/pwm_vs_wheel.Bench and bench/track_cal.py; no raw data committed). No gain or estimator constant was changed during the test; the one change, the fix age, was approved by the developer and made at the end.
Method. Heading truth is the LH2 at-rest probe of track_cal.py: a 100 mm closed-loop straight between two rests, bracketing every manoeuvre. Position truth is the fix trajectory, plus the encoder distance for timing along straights. The advert carries the estimator's heading (-1000 until acquired) and photodiode position every 200 ms. Rejection counts are not telemetered, so they come from replaying the same C file (pose_estimator.c, built for the host) on the recorded per-tick encoder counts and fixes. Lost telemetry frames are filled from the frame totals, spread over the missing ticks. The replay matches the advertised heading within 1 degree on every block that starts from a fresh app start, and the advertised position within 0.4 mm (mean) only when it is replayed with the fix age the robot was built with. That confirms, from the other side, that the reflash took.
Acquisition (DBK-142). From a straight at 50 mm/s: 8 of 8 acquired after 40 to 44 mm of travel (the design says 40), error at that moment −2.3 to +2.5 degrees; while tracking at rest afterwards, the heading is within 0.5 degree of the probe and the filtered position within 0.4 mm of the mean fix. From a spin in place at 100 mm/s per wheel: after 46 and 57 degrees, −2.4 and −1.1 degrees. From one full turn at 200 mm/s per wheel, the developer's proposal for the start-up acquisition: heading appears after 56 to 73 degrees (0.22 to 0.28 s), −4.3 to +0.1 degrees at that point, and at rest after the full turn −1.3 to +0.2 degrees (6 turns, both robots), with the robot back where it started. Recommended phase 6 start-up: one full spin in place at the trusted spin speed. Back-and-forth (a full turn clockwise, 1 s, a full turn counter-clockwise), measured as supporting data from a fresh start each time: −1.7 to +0.2 degrees (4 runs) against −1.5 to +1.3 for a single turn (5 runs), mean absolute 1.1 against 0.9, so it does not beat one turn. The photodiode ends 3 to 14 mm from where it started after one turn and 3 to 8 mm after two. The camera (the developer's controller, read-only) resolves each turn at 2.7 Hz, 3 to 4 frames per turn: its rate of 262 to 300 deg/s per frame pair is within about 7 per cent of the 280 the wheel speeds predict. That is too coarse to show unevenness within a turn, and nothing uneven shows. Camera headings at rest agree with the LH2 probe within −1.1 to +2.8 degrees (6 samples).
Tracking while driving, Figure 11, from fresh starts, 2.9 to 2.0 V: 24 spins at 100, 150 and 200 mm/s per wheel, 22 straights at 150 and 300, 4 half-circle arcs of 120 mm radius at 150; 11 392 fixes, none rejected, largest squared distance 12.3 against the gate of 23 (on a 300 mm/s straight with the old fix age). Heading at rest before and after each manoeuvre: mean absolute error 0.6, 1.2 and 1.6 degrees for spins at 100, 150 and 200 (worst 3.4), 1.0 and 1.3 for straights at 150 and 300 (worst 3.8), and 1.0 for arcs. Mid-spin, against the angle of each fix about the pre-spin axle, the error is at most 4 to 8 degrees, which includes the uncertainty of the fix age assumed for the comparison. Position against the fixes, shifted by their measured age: 2.0, 2.7 and 3.5 mm RMS in spins at 100, 150 and 200, 2.8 on straights at 150, about 6 at 300 (worst 14), and 3.0 on arcs. The one surprise: 811E yaws −7 to −9 degrees during every westward straight at 300 mm/s that its encoders do not see (under 1.3 degrees of encoder yaw; eastward it stays under 2, and B4AB shows none). The estimator carries 3 to 5 degrees of heading error through those straights, and 2 to 4 at the rest after them, until the next fixes correct it.
Fix age and lag, Figure 12. Along a straight, the encoder distance per tick is a clock-exact reference, so fitting the fixes to it with a time shift gives the fix age as the estimator sees it. It comes out at 1 to 4 ticks, about 2 on average: longer driving east (2.5 to 3.5 at 300 to 600 mm/s) than west (1 to 1.5), on both robots, and at 100 mm/s the fit is weak (3 to 5). The compensated 4 ticks therefore over-lead: before, at 300 mm/s the estimate ran 3.6 to 10.4 mm ahead of truth (mean 6.8, 14 runs), and at 600 about 5. After the developer approved 2 ticks (DotBot-libs 1ec1c63, firmware 21b7368; make test 65 and 154 checks pass, the fix-age test pinned to its own 4-tick lag so that leaving the age out still shows), reflashed over the air to both: at 300 mm/s from 4.6 mm ahead to 2.2 behind (mean 0.8 ahead, mean absolute 1.7, 16 runs), at 600 0.4 to 6.8 behind, at 100 1 to 2 behind. The spread that remains is the east-west difference in fix age, which one constant cannot remove. Against the raw fix read on the same tick, the estimate now leads by 21.3 to 22.6 ms at every speed, against 40.7 to 42.4 before: exactly the compensated age, plus about 0.2 of a tick. Encoder against LH2 distance on these straights is 0.97 to 0.99, so 0.0946 mm per count reads about 2 per cent long on this carpet, as it did on 2026-09-23.
Kidnap, Figure 10: 811E carried between A (1600, 250) and B (1300, 250) four times by the developer, set down facing east. The robot drove itself back to A between moves. LH2 keeps producing fixes through the carry, about 2 to 4 s from lift to set-down. On a carry slow enough that 3 rejected fixes stay within the 20 mm seed tolerance (moves 2 and 3, about 10 mm per fix), the kidnap rule fires 0.4 s after the first displaced fix. On a fast carry (move 4, 25 to 28 mm per fix) consecutive rejected fixes never agree, and the 1 s timeout (LOST) catches it after 1.3 s instead. Until then the advert keeps the old pose with a valid heading, so a hand move reads as a still robot for up to 1.3 s. Once either rule fires, the advert follows the raw fix for the rest of the carry, so at set-down the reported position is already right: the 0.3 s target is met at touchdown. The heading reads -1000 from then until the robot drives: re-acquired after 41 to 44 mm of self-driving at 50 mm/s, error at that moment −3.5 to −8.9 degrees, and 1 to 2 degrees at rest after. Move 1's telemetry was lost when the script was restarted; its advert showed the same sequence. B4AB was also moved once by hand, by mistake: it went to -1000 at its new spot, as designed.
Figure 10. The kidnap test as briefed to the developer: dev-corner from above, 811E's start pose A and drop point B, both facing east, the carries (moves 1 and 3 A to B, 2 B to A, and a fourth A to B) and the 10 cm self-drive that re-acquires the heading. The drop band drawn (x 1200 to 1720) was relaxed during the test to 1100 to 1800.Figure 11. Estimator heading minus the LH2 probe heading, with the robot at rest, per manoeuvre kind and speed (mm/s per wheel for spins, axle speed otherwise): the moment of acquisition on a 50 mm/s straight, the rest after one full turn, the rests before and after each spin, straight and arc, and the second set of single turns against CW + CCW turn pairs. Both robots. Everything sits within ±4 degrees; hover a mark for its run.Figure 12. How far the estimate runs ahead of the encoder-timed truth along a straight, in the constant-speed part, per run, with the fix age compensated at 4 ticks (before) and at 2 ticks (after). At 300 mm/s the lead falls from 3.6 to 10.4 mm to within about ±4 mm of zero. The remaining spread is the east-west difference in fix age.Phase 4 review fixes, on hardware (2.9 to 2.8 V, 811E and B4AB). Check (a): t90 20, 40 and 50 ms at 100, 200 and 300 mm/s, steady speeds 99.5 to 100.7, 200 to 202, 300.5 to 304.2 (the contract's 20/40/55 ms and 1 per cent hold). Brake run-on from 200: 7.9 to 9.1 mm over 100 to 150 ms (8 stops; contract 8.7); from 100, 2.9 to 3.6; from 300, 13.7 to 14.3. Straights at 700: 685 to 705 mm/s, 18 to 52 per cent of steps at the duty ceiling (6 legs of 340 mm). The 700 cap: an 800 mm/s command is refused by the controller with HTTP 422 (pydantic, ±700), so it never reaches the robot. The firmware clamp stays covered by the host tests only, since publishing to the broker around the controller was not authorised. Stall (B4AB held in the air, 100 mm/s streaming): in two tries the wheel was slowed but never stopped (at least 6 counts every 10 ms, duty at most 38), so nothing tripped, correctly. On the third, the right wheel was pinched to a stop: the loop drove it to duty 92, PWM_STALLED appeared exactly 500 ms after its last count, and the wheel stayed coasting after release for the rest of the 100 mm/s segment. It restarted at duty 100 within 20 ms of the setpoint changing to 120.
Incidents. Two box aborts on the first gotos (a spin swept the photodiode past x 1040), no contact; the lanes were moved inward. Then the wheel-check script's blind 100 mm first probe took 811E into the arena's top wall (last fix y 2) and B4AB across into the other half, after the spin test had left both facing north. Every script now takes its first heading from the estimator while it tracks, else from the developer's camera at rest (read-only, trusted only when its photodiode is within 40 mm of the LH2 fix), else refuses to move. A full turn in place re-acquires when neither is available. The kidnap script checks the camera again before any self-drive. A mix-up between robots set the convention of distinct LED colours per robot, named with the address.
Checks against the deliverable. Predict runs every 10 ms tick and update once per fix (10 Hz), visible in the replay counters. The spin check passes: in-place spins read 360 degrees of rotation to within 2 degrees at rest, and track the true angle of the fixes about the axle mid-spin. No heading comparison against apps-sandbox/dotbot was made; its heading comes from differencing positions and was not flashed. validated: hil stands for phase 5 on these runs. Still open for phase 5: rejections near the arena edge and with two stations (dev-corner and one station only here), the east-west fix-age asymmetry, and the unseen yaw on 811E's westward straights.
- Estimator code review and fixes: DotBot-libs#33 and DotBot-firmware#426 reviewed, no blocking bugs. Fixed: (1) a seeded pose carried the pose at fix capture rather than the present one, 6 mm behind at 300 mm/s and 5.6 degrees in a 200 mm/s spin; it now carries the pose forward over the fix-age window, the odometry ring stores (d, dθ, qθ) steps, and the first post-seed fix is compensated. (2) the covariance could go indefinite in float32 after a long rest (25 of 36,000 updates); it now uses the Joseph form, 0 of 36,000. Tests: 81 pose-estimator plus 154 wheel checks, the new tests fail on the old code. Commits: DotBot-libs c2d0a59, 63395a2, 48ad149; DotBot-firmware 2c5a6a2; CI green. Decided: the kidnap tolerance stays at 20 mm (widening barely helps the fast-carry case and raises reflection-cluster risk). Pending: a floor recheck of acquisition, since both fixes touch that path.
- Team demo on two robots, estimator build 21b7368 (811EFD28FACDE21A green, B4AB5A04DF9E2426 blue). The onboard wheel loop and estimator did the work; the outer loop (goto, face, shapes, heading-safe moves, full-spin heading acquisition) ran on the host over WHEEL_VELOCITY as a stand-in for phase 6. Results: 30 cm out-and-back returns within 8 to 20 mm; circles close once the arc command used the about 86 mm arc track (78 mm left them 37 degrees short); waypoints within 2 to 17 mm; a two-robot choreography; over-the-air app flash and restore; a 37 s timed experiment; no box aborts apart from one no-position stop from a 1.3 s radio gap (a rerun passed). Findings: 180 degree turns at 150 to 200 mm/s under-turn 11 to 15 degrees (spin slip at speed, arguing for a speed-dependent spin track in phase 6); flashing needs the Bootloader state first. Figure 1 now marks the implementation status (commit e680ac9).
- Dead reckoning after an occlusion, answered from the recorded phase 4 to 7 runs by replaying the estimator with its fixes cut: about 1 s of waypoint driving within the 10 mm arrival threshold (p90 13 mm), 2 to 3 times longer on straights and arcs, limited by turns over-reading their rotation; the 1 s LOST timeout holds for waypoint driving, and a timeout on position sigma is proposed. Report: reports/2026-09-25-dead-reckoning-drift.html (tools bench/drift_wrap.c, drift.py, drift_report.py).
- DotBot-libs#33 rebased onto main and force-pushed, 0d5c4af -> d2a88c5: 12 linear commits on caa788b, identical tree, mergeable.
- The whole stack rebased onto main and force-pushed to fork, each branch linear with its merge commits dropped and its tree unchanged; the DotBot-firmware dotbot-libs pointers were remapped to the rebased libs commits. DotBot-libs: #33 d2a88c5 (12 commits), #34 62d968d -> 9f01c64 (20), #35 41c4e2c -> ab0227d (26), #36 ce205ec -> b6027b3 (29). DotBot-firmware: #426 af4ced6 -> dc72610 (11, submodule d2a88c5), #427 2bd4903 -> fa92a4a (20, submodule 01fda26, one docs-only commit behind the libs steering tip, as before), #428 9622258 -> ddbf514 (25, ab0227d), #429 76efabe -> 7afb215 (33, b6027b3). All eight PRs mergeable; old tips kept as <branch>-pre-rebase-main. PR bodies updated for the new submodule shas; the diff sizes against main were already right.
- DotBot-libs#33 merged by the developer with a plain merge commit, DotBot-libs main now cd5f862, same tree as d2a88c5, which is its ancestor. So DotBot-firmware#426's submodule is already on libs main and it merges with no re-bump and no rebase; the same holds for #427 to #429 as their libs PRs land. DotBot-libs#34 now sits directly on main (8 commits, +1590 -1), #35 14 commits, #36 17. The PR bodies' merge chains, stacking lines and size tables are updated to match.
- DotBot-firmware#426 merged; phase 5 done. Correction to the 10:12 entry: as with #425, a firmware PR does get a final submodule bump before it merges. #426 got e91c8df "dotbot-libs: bump to the pose estimator merge on main", moving dotbot-libs from d2a88c5 to cd5f862 (identical tree), pushed fast-forward; all 32 checks green, then merged with a plain merge commit, DotBot-firmware main now 21eba1b. The estimator is on main in both repos, validated on the floor on 2026-09-24 (entry 10:10), so the chip goes to done. The next firmware PR, #427, now conflicts on the submodule line and is rebased onto main after DotBot-libs#34 merges; #428 and #429 likewise in turn. The wrong "no re-bump" sentence is removed from all ten PR bodies and the merge convention above; the nine remaining PRs are out of draft.
Phase 6Steering, approach shaping, brake~3 dDone
Includes single-target handling - accept a one-waypoint batch with a
threshold, run the arrival test, latch on arrival - because this phase's checks cannot run
without it. Multi-waypoint sequencing still waits for phase 7. An earlier draft left all
waypoint handling in phase 7 and then asked this phase to measure overshoot and confirm
the brake latches, neither of which is possible with no way to deliver a target: the same
ordering mistake the characterisation phase had.
The outer loop is not a waypoint PID. An approach profile maps distance to a forward
speed, while a heading PD controller produces a differential-speed correction. The
two are combined into left and right wheel-speed setpoints, then phase 4's PI loops turn
those setpoints into PWM. P points the robot toward the target; D damps the turn. There is
deliberately no outer integral: the inner PI already removes persistent drivetrain bias,
while integrating heading error during saturation or an obstructed turn would encourage
windup and overshoot.
The outer loop runs every 100 ms. Its heading derivative uses elapsed scheduler
ticks for dt, so its gain keeps the same meaning after a late update. Heading
error difference is wrapped to plus or minus 180 degrees, previous error survives
waypoint advances, and the correction is clamped as a differential wheel speed before it
is combined with the approach speed. Arrival actively latches a stop rather than writing
zero duty and coasting - which, as the callout below records, needed a driver function
that did not exist until this phase added it.
There was no brake in the motor driver, so this phase carried a prerequisite
The whole motor API is db_motors_init(void) and
db_motors_set_speed(int16_t l_speed, int16_t r_speed)
(drv/motors.h:30,43), and the second maps one signed value per motor onto
an IN1/IN2 PWM pair. At l_speed = 0 it takes the >= 0 branch
and writes both channels to zero (drv/motors/motors.c:57-60). The
DotBot's driver is a DRV8833 as drv/motors.h states it (the v3 BOM
fits a BDR6120H at U5/U6, which docs-hardware/DotBot_V3-firmware-cross-check.md
records as the same PWM interface), and on it both
inputs low is coast: the outputs go
high-impedance and the motor freewheels. Brake is both inputs high, which shorts
the windings so the motor resists being turned. A single signed value cannot express
"both high", so brake is unreachable by construction rather than merely unimplemented.
M_TOP is 100 (drv/motors/motors.c:21), full duty, which
holds both inputs high for the whole period. The one thing read rather than measured,
that full duty really presents a high input and is not inverted somewhere in the PWM
setup, was confirmed on a v3 on 2026-08-31 (DotBot-libs#28).
There are three levels of stop, and they compose in sequence: decelerate under
the loop, then latch the hardware brake.
Level
What it does
Available today
Coast
Cut power and let friction do it.
Yes - this is what happens now.
Active brake via the loop
Wheel setpoint 0, so the PI commands reverse PWM against the motion that is left.
Yes, and it needs no driver change.
Hardware brake
Short the windings so the motor resists being pushed.
The loop-based level needs two things beyond setting the setpoint to zero.
The integrator has to be reset on the stop transition. Coming down from cruise the
integral holds whatever was supplying the roughly 55 to 60 PWM the wheel needed, so
zeroing the setpoint leaves Ki * integral pushing forward while
Kp * err pushes back, and the wheel keeps rolling until it unwinds.
Anti-windup does not help: it prevents the integral growing, it does not unwind one that
is already there. And a PI regulating to zero twitches. Measured speed jitters by
one encoder count - 9.87 mm/s at 100 Hz - even with the robot at rest, so the
error and therefore the PWM jitter with it. That is why arrival has to latch rather
than keep regulating.
Sequencing. Implement db_motors_brake() and bench-test it
standalone with a bare app - call it, then try to push the robot by hand and see whether
it resists - before any control-loop work. The driver change and the decision of
when to call it are separable, and only the second involves the loop. Page 1.2 of the
control-loops course (docs/control-loops/02-the-hardware.html) already
records the consequence of not having it, so it is not restated here.
The approach profile is the parameter block of 3.12 - v_max,
v_min, ramp rate k, arrival_radius,
final_heading, aim_threshold - rather than a fixed curve with a
single speed-reduction multiplier. v_min is the non-zero velocity floor that
replaces today's binary 0.75, and it comes from the breakaway measurement 3.10 owes rather
than from a chosen number.
The phase also owns aim-then-drive (3.11). Above aim_threshold the
forward term is set to zero outright and the robot turns nearly in place until it is
aimed; below the exit threshold it drives with continuous heading correction. The floor
applies to the drive phase only - a floor that also applied while aiming is what would
make a pivot impossible, which is what the first draft of this phase specified. The three
open decisions are the hysteresis pair, the minimum useful spin rate, and which waypoints
get aimed at rather than arced through; 3.11 has the reasoning on each.
Deliverable + check
A steering layer with named approach constants, plus db_motors_brake() in
DotBot-libs. Check: 16 runs per gain set per start pose. Expect mean signed overshoot
and the run-to-run spread to fall together; a tune that improves the mean while widening
the spread has fitted one start pose. Separately, and first: a bare app that calls
db_motors_brake(), then push the robot by hand and feel it resist - if it
rolls freely the PWM polarity is inverted and nothing downstream can latch.
Log
So far. The steering layer outputs wheel-speed setpoints to phase 4's loops, never PWM, and adds no waypoint PID. Aim-then-drive is required, which the first draft's non-zero velocity floor made impossible; the approach profile is a parameter block plus sequencing rather than scenario modes, docking is three ordinary moves with the last millimetres left to a mechanical funnel, and arrival_radius is a corridor width, an open swarm decision. db_motors_brake() exists and was reported working on a v3 by the developer (DotBot-libs#28, a reported result, not hil); an off-axle pivot remains a risk that phase 5's spin check settles, and every overshoot check reads through the estimator until an external witness exists. On 2026-09-24 the single-target steering was built onboard and floor-tested on two robots: it stops at the threshold edge (5.0 to 7.2 mm for a 5 mm threshold), never passes a target, reaches near targets in reverse and recovers a heading lost while moving by driving on (Figure 14); the gain-set comparison the check asks for was not run. Merged 2026-09-25 (DotBot-libs#34, DotBot-firmware#427) and closed on the merge.
Earlier log, 2026-08-27 to 2026-09-01 (9 entries)
- phase created; not started.
- cascade made explicit: the approach profile and
heading PD output wheel-speed setpoints, never PWM; phase 4's per-wheel PI loops are
the actuator layer. No waypoint PID is introduced. Phase remains not started.
- aim-then-drive becomes an explicit requirement of this phase,
and the phase as first written forbade it. A non-zero velocity floor on a
distance-only profile means forward speed never reaches zero, which is exactly what a
pivot needs it to do; the distance-only profile also dropped the heading-error
slowdown the current firmware has, so on this requirement the plan was a step
backwards from the code it replaces. 3.11 carries the arithmetic showing today's
behaviour is an arc, and the point that a pivot is just v = 0 through the
existing mixing rather than a new controller. Recorded rather than silently
corrected.
- the approach profile becomes a parameter block plus sequencing
(3.12) rather than named scenario modes, which also subsumes the
intermediate-versus-terminal threshold gap 3.9 raises. Docking decomposes into three
ordinary moves - staging point, turn in place, slow creep - and the residual position
uncertainty at the end of it is accepted as a mechanical problem to be solved with a
funnel or V-guide, not as a control target.
- new risk carried against this phase from 3.13. If the robot's
pivot sits off the axle line, the steering layer is commanding a rotation the
kinematics do not produce and no wheel-speed loop recovers it. Not tuned or designed
around now; phase 5's spin check is what settles whether it is real. Phase remains not
started.
- arrival_radius gains a second reading that this
phase has to carry: in a swarm it is a corridor width, not an accuracy figure. A
loose threshold does not widen drift off the line, which the heading controller owns -
it lets the robot start turning toward the next waypoint before reaching the current
one, so the flown path is a rounded version of the polyline and the rounding grows with
the threshold. Collision avoidance therefore has to reason about the swept corridor
rather than the commanded line. Left open in 3.12 as a swarm decision rather than a
control one: tight thresholds everywhere and accept the slowdown, or loose thresholds
with the swarm planned against the corridor. Phase remains not started.
- this phase's brake requirement is not implementable
against the current driver, found by reading it rather than at the bench.
db_motors_set_speed(0, 0) puts the DRV8833 in coast, and the signed-value
API cannot express the both-inputs-high state that brakes
(drv/motors/motors.c:48-51). The phase now carries a DotBot-libs
deliverable, db_motors_brake(), bench-tested standalone before any loop
work depends on it, and the phase description records the three levels of stop plus
the integrator reset and the latch the loop-based level needs. Phase remains not
started.
- the brake is implemented and works on
hardware. db_motors_brake() writes full duty to both channels of each
bridge, which holds both DRV8833 inputs high; 01drv_motors alternates
brake and coast from the same entry speed so the two can be told apart by hand.
The developer flashed it on a v3 and reports it working well, which closes
the 14:52 entry's blocker and settles the one open question there, the PWM
polarity: full duty does present a high input, as read off
db_pwm_channels_set setting bit 15 on every sequence value. Note this
plan's validated: stays tests: the bench run was the
developer's, not one performed and observed from a session, and reporting someone
else's result is explicitly not hil. Shipped in DotBot-libs#28.
- this phase's overshoot and arrival checks are all read
through the estimator, so a tune that improves the reported number while making the true
one worse is currently undetectable. A sibling idea page proposes an external camera as
an independent witness, and an LED colour scheme that puts brake-latch and
waypoint-advance events into the video itself:
A camera as the second witness. Recorded as a
known gap in the checks; the deliverables are unchanged and nothing here waits on it.
- The target, stated by the developer: close to a unicycle as seen from the outer loop, with very sharp turns including turning in place. It lands here as a kinematics layer from (v, ω) to wheel speeds on the calibrated effective track (phase 5 log), closed on the estimator's heading; the wheel side is already in phase 4 (same time, phase 4 log).
- Phase 6 built and floor-tested: single-target steering onboard, on stacked steering branches (DotBot-libs 5724546, DotBot-firmware 2bd4903), draft PRs DotBot-libs#34 and DotBot-firmware#427 on top of #33 and #426. The chip moves to active, not done: the deliverable exists and has run on the floor, but its check, 16 runs per gain set per start pose with overshoot and spread compared across gain sets, was not run; one gain set was floor-tested, from mixed start poses.
Design as built.drv/steering is pure C: pose in (axle x, y, heading, and TRACKING, SEEDING or LOST from the estimator), left and right wheel setpoints in mm/s plus a brake flag out, mixed through db_wheel_control_from_twist(); no PWM, no outer integral, no velocity floor. States IDLE, NO_HEADING, ALIGN, DRIVE, FINAL_TURN, ARRIVED, HOLD, RECOVER, FAILED. The target is the photodiode position, the point the wire and the advert already carry; with a final heading the axle is steered to a lever (51.5 mm) behind the target and FINAL_TURN leaves the photodiode on it. Approach v = min(300, 4·|s|) mm/s, scaled down from 5 to 20 degrees of heading error; ALIGN enters at 20 and leaves at 8 (3.11's pair); heading PD Kp 5, Kd 0.05; turn capped at 200 mm/s per wheel from the mean, and never under 20 while turning in place. Lookahead 0.05 s, not the brief's full period: 0.1 over-led in simulation. Arrival uses the stop point, current point plus v·0.05 s, with the threshold floored at 5 mm. Within the lever plus 50 mm the heading error folds into ±90 degrees, so a small overshoot or a target just behind is reached in reverse. A target without a heading starts with one full turn at 200 mm/s per wheel, as phase 5 recommended. Timeouts 3, 3, 3 and 5 s (no heading, turn, progress, HOLD) end in FAILED with a reason. Two decisions the plan left open: a waypoint means the photodiode, not the axle; and v_min in 3.12 is dropped, since phase 4's kick holds 15 mm/s.
drv/steering state machine, as built
Thresholds and timeouts are the defaults in dotbot-next's steering config.
Figure 13. The steering states as drv/steering runs them. The arrival and progress tests run in ALIGN as well as DRIVE. A LOST pose brakes into HOLD from NO_HEADING, ALIGN, DRIVE, FINAL_TURN and RECOVER alike, and SEEDING in FINAL_TURN or ALIGN spins in NO_HEADING; RECOVER is taken only while moving, with recover set to drive on, and when its straight stays inside the bounds. HOLD's 5 s runs only while the pose stays LOST. A new target goes to NO_HEADING from IDLE, ARRIVED, FAILED, HOLD and RECOVER, to ALIGN from ALIGN and FINAL_TURN, and leaves DRIVE and NO_HEADING where they are with their timers reset; a stop goes to IDLE from anywhere. ARRIVED and FAILED hold until one of the two.In dotbot-next. The first waypoint of a batch is the target, steered once per 100 ms poll; waypoint mode is exempt from the radio deadman, so the host sends once; any direct command, CONTROL_MODE or an empty batch stops it; the advert says Auto while moving, and Manual with waypoint index 1 on arrival. ARRIVED, HOLD and FAILED hold the hardware brake every tick: the arrival latch of the three levels of stop. Bench-only, behind DB_BENCH_TELEMETRY: a second point sets a final heading, and thresholds 0xFFFF / 0xFFFE drop the pose to force a recovery.
Estimator fix found on the way (on the phase 5 branch, DotBot-libs 0d5c4af): a hard stop from 500 to 700 mm/s read as a kidnap, since the odometry misses the slip and the gate rejected the fixes. Process noise now grows with each change of wheel speed, a kidnap needs the wheels to have stood 0.5 s, and a nearer jump right after driving re-anchors the position and keeps the heading. The floor replay goes from 3 false kidnaps to 0.
Single-target misses against LH2 (mean raw fix at rest after ARRIVED; blue B4AB untethered, green 811E tethered on USB-C and on targets along its heading line only):
Robot
Threshold
Runs
Miss min / mean / max
blue
5 mm
27
5.0 / 5.8 / 6.8 mm
blue
10 mm
10
6.1 / 9.9 / 12.8 mm
green, tethered
5 mm
6
4.8 / 6.1 / 7.2 mm
green, tethered
10 mm
4
9.3 / 9.9 / 10.4 mm
Behaviour. The robot stops at the threshold edge, as designed, and never overshoots: signed overshoot was negative on every plain target. 0.3 to 1.8 s per move. Final heading within ±1.7 degrees of the LH2 probe, photodiode 6 to 9 mm off. NO_HEADING from a fresh start: one full turn, then ALIGN, DRIVE, ARRIVED in 2.8 s. A new target 0.8 s into a drive is taken with no stop. Near-axle targets 60 and 120 mm behind, on the heading line or 4 mm off it, are reached in reverse with no pivot; the first pass pivoted at 60 behind, which the near-axle commits fixed.
Recovery, drive on against spin (the developer's design input), Figure 14. SEEDING while moving now goes to RECOVER: straight on along the last heading at 120 mm/s for at most 60 mm, falling back to the spin at rest or near the bounds. Both modes recovered 3 of 3 and got the heading back after 0.37 to 0.43 s; loss to arrival is 1.5 s driving on against 3.0 s spinning. Drive-on is the default while moving.
Figure 14. Heading recovery while moving, drive on against spin: blue robot, the pose dropped by the bench trigger 0.7 s into a 1250 to 1750 mm drive at 300 mm/s, 3 runs per mode, 10 mm threshold. Both modes get the heading back in about 0.4 s; driving on arrives about 1.4 s sooner, because the spin finishes its full turn before aligning. The lighter ends of each bar are the spread over the three runs; the dot is the mean arrival.Why heading is lost while moving, every event found. 13 false kidnaps after hard stops (demo video and the phase 5 fast-stop captures), fixed in the estimator (0d5c4af); 1 outside the calibrated area (y > 1000), not a firmware fault; 1 TS4231 that never solved at start-up (DBK-147); and 0 spontaneous losses in about 4,700 adverts of steering runs on both robots. No gate or timeout was retuned.
Tests. DotBot-libs make test: wheel 154, estimator 106, steering 141, all passing. The steering test closes the loop through a lagging robot, a widening spin track, 2 per cent odometry over-count and the real estimator; 15 of 16 mutants killed, the survivor an approach slope of 10 instead of 4 that the prediction still keeps from overshooting. SES 7.22 builds of every sandbox app, 0 warnings.
Tooling, not firmware. The flapping state sequences seen in the first pass were the harness re-reading old frames; a box abort came from the phase 5 kit's open-loop goto, whose heading had drifted about 90 degrees; and a spin watchdog trip came from extrapolating the photodiode along a spin. All three are fixed in the harness. One waypoint downlink packet was lost and the robot stayed where it was: with no resend by design, the host has to confirm the move started, a note for phase 7.
- State machine drawn, Figure 13, traced from steering.c rather than from the PR body's sketch, which had drifted: a target from rest skips the spin when the pose already tracks, the arrival and progress tests also run in ALIGN, ALIGN and FINAL_TURN time out on the turn, LOST reaches HOLD from any moving state, HOLD goes to NO_HEADING on SEEDING, and RECOVER is taken only from a move, never from a turn in place. The same diagram, with config field names in place of numbers, is now above db_steering_state_t in DotBot-libs#34 (75e9033). Later figures renumbered, 13 and 14 becoming 14 and 15.
- Merged; phase 6 done. DotBot-libs#34 merged with a plain merge commit, 55cefbe (10:49), whose tree matches the branch tip 75e9033. DotBot-firmware#427, rebased onto main at 21eba1b, got a final dotbot-libs: bump to the steering merge on main (a9fb650, submodule to 55cefbe, pushed fast-forward) and merged with a plain merge commit, 9435f5f (10:56), after all 32 checks passed. The chip moves to done on the merge; the evidence is the 2026-09-24 floor test above, run by an agent on B4AB5A04DF9E2426 and 811EFD28FACDE21A, so validated: hil now covers this phase. The check's gain-set comparison (16 runs per gain set per start pose) was not run: one gain set was floor-tested. The stacked PRs were retargeted to the new mains: DotBot-libs#35 now shows only its own 6 commits, while DotBot-firmware#428 and #429 still carry #427's pre-rebase commits and conflict on the dotbot-libs line until they are rebased in turn.
Phase 7Waypoints, then cut over~2 dDone
Waypoint sequencing last: outermost layer, least subtle, and only meaningful once
everything beneath it is trustworthy. This is also where the contract gaps in 3.9 get
raised - a runtime speed limit as a new command, and a decision on terminal-versus-
intermediate thresholds and a completion enum, both argued from this phase's measured
arrival distribution rather than from taste. Then the decision this plan exists to earn - if the
new app beats the old one on the same bench metric from the same start poses, it
replaces the sandbox app and the old one is deleted in the same PR. Three apps is
not an acceptable end state given the maintenance cost.
The same cut-over retires drv/move. It is the pre-cascade way of moving: set
a PWM, spin until the encoders say the distance is done, stop. It blocks (so it cannot run
beside the tick scheduler without tripping the keep-alive), its "speed" is PWM (so
db_move_rotate(90, 45) cannot pivot on carpet), and move.c:84-98
carries a hand-tuned offset-and-correction fudge with a no-op multiply and an unsigned
negate. Its successor is an odometric goal on the wheel loop: drive at a speed until the
integrated encoder distance reaches the target, then brake - the parameterised goal
primitive with an odometry arrival test. In the PR that lands it, apps-sandbox/move
and projects/01drv_move are ported onto it and drv/move plus
00drv_move are deleted, so the HIL check keeps its target. Until then the driver
is marked deprecated in its header (phase 4, step 0) and nothing else is invested in it.
Figure 15 is the steering as it runs along a batch, traced from drv/steering/steering.c
on the waypoints branch (DotBot-libs#35 @ 62f1f14): Figure 13's single-target
machine plus passing points, poses mid-batch, the precise arrival and the completion the advertisement
reports.
drv/steering state machine along a batch, as built
Thresholds and timeouts are the defaults in dotbot-next's steering config.
Figure 15. The steering states along a batch of waypoints, every point an axle
position. An intermediate point without a heading is passed in ALIGN or DRIVE once the axle is within
the pass radius (the batch's, else 20 mm) or past the point along its leg; the approach keeps the
speed the next turn allows, full up to 5 and none from 20 degrees. A point with a heading is a pose,
reached by the last point's stop-point test; FINAL_TURN's per-tick poll brakes the turn once its run-on
would pass the heading, and the tolerance is the batch's or 3 degrees. The precise arrival applies
only at a last point without a heading and a threshold under 5 mm, and is entered from DRIVE only:
SETTLE brakes, skips 200 ms, then averages 4 raw fixes into an axle; NUDGE turns in place when that
axle is off the heading line by more than half the threshold, else creeps along it. SEEDING in ALIGN,
DRIVE, FINAL_TURN, SETTLE or NUDGE goes to RECOVER when moving (a creeping NUDGE counts), with
recover set to drive on and the straight inside the bounds, else to NO_HEADING; LOST
brakes into HOLD from every state that moves, SETTLE and NUDGE included, and HOLD and RECOVER resume in
ALIGN with the correction count kept. A new batch goes to NO_HEADING from IDLE, ARRIVED, FAILED, HOLD
and RECOVER, to ALIGN from ALIGN, FINAL_TURN, SETTLE and NUDGE, and leaves DRIVE and NO_HEADING where
they are with their timers reset. An empty batch, a direct command or CONTROL_MODE stops it
into IDLE, reported as ABORTED with that reason; the app ignores a resent batch whose id it already
has.
Deliverable + check
One sandbox app, not two. Check: a fixed arrival protocol run head to head, old
against new, 16 runs per arm per start pose, reporting mean error and spread for each.
The new app ships only if it wins on both.
Log
- phase created; not started.
- Started, on top of the phase 6 single target: sequencing the rest of a batch is next. No cut-over for now, per the developer: the old apps-sandbox/dotbot and drv/move stay beside dotbot-next, so the head-to-head check and the deletions above wait. Carried in from phase 6: a lost waypoint packet is silent, so the host (or a completion status in the advert, 3.9) has to confirm a move started.
- Waypoints built and floor-tested; the cut-over is postponed by the developer's decision, so the chip reads postponed: the half of this phase that exists is done, and the deliverable it is judged by (one sandbox app, the old one and drv/move deleted) waits. Draft PRs, stacked on phase 6: DotBot-libs#35 (waypoints @ ceede9b), DotBot-firmware#428 (@ cc1be42, submodule at the libs tip), PyDotBot#301 (@ 1282117, on #298), and the console gesture of plans/pose-waypoints/ as PyDotBot#302 (@ ade9029, on #301).
Design as built.Every waypoint is the axle midpoint, with or without a heading (the developer's decision mid-phase, replacing phase 6's photodiode target and its lever-offset final goal); the photodiode appears only in the estimator's measurement and the precise settle's fix averaging. A point with a heading is a pose: stop, turn in place, go on or latch ARRIVED. Intermediate points are passed within 20 mm (twice the moving estimate's 3 sigma; 5 made a curve pivot twice in simulation, 50 widened the corridor to 33 mm) or once past along the leg; the approach speed is min(v_max, k·along + v_exit) with v_exit from the turn angle, so a gentle bend keeps full speed and a corner of 20 degrees or more is a stop-and-pivot (3.12's predictability over optimality). Terminal: phase 6's run-on arrival, brake, latch. The final turn is now brake-aware: the per-tick poll brakes it when its run-on would pass the heading, which took the floor bias from +2.4 to +0.4 degrees. Precise settle below 5 mm (the developer's addition): creep at 20 mm/s, stop on the per-tick predicted stop point, brake 200 ms, average 4 raw fixes into an axle, then nudge (turn onto the line, or creep along it) up to 6 times.
Wire, the 3.9 gaps closed.LH2_WAYPOINTS keeps threshold, count, points and adds a trailer (batch id, heading tolerance, pass radius, one centidegree heading per point, 0x7FFF none): 7 + 10n bytes, 167 at 16 points. A trailer rather than pose-waypoints' interleaved layout only so the old app still parses the batch for the head-to-head. The advert gains an 8-byte report (status, reason, batch id, max speed, axle x and y; 42 bytes); status NONE / IN_PROGRESS / ARRIVED / FAILED (the steering's six reasons) / ABORTED (stop, direct command, control mode). Lost packets: the robot ignores a batch repeating its current id, the controller resends until the advert shows it (1.2 s, at most 5 tries, once only to apps without a report), which closes phase 6's silent-loss note. CMD_MAX_SPEED (0x11), 20 to 700 mm/s, 0 for the default 300. Terminal versus intermediate thresholds are separate fields, as 3.9 asked.
Tests. DotBot-libs make test: wheel 154, estimator 106, steering 227 (141 in phase 6), rerun on ceede9b; 13 of 15 mutants killed, the survivors being the per-tick stop and the nudge's run-on, which the simulation cannot separate. PyDotBot 917 passed, the 5 failures pre-existing on wheel-control; console vitest 625 on #302. SES 7.22 builds, 0 warnings.
Floor, 2426 (telemetry build, OTA; axle miss is the LH2 fix at rest minus the lever along the heading). Paths at 10 mm, 2 runs each, all ARRIVED with the report correct: square 200 x 160 in 5.4-5.6 s, miss 9.7-10.9 mm; zigzag of 110-degree turns, 9.3-10.7; 400 mm U-turn, 9.6-12.8; 3-point pose path, 4.0-4.6. Precise settle, Figure 16: 22 of 22 arrived, mean miss 5.6 / 2.6 / 2.1 / 1.5 mm at 5 / 3 / 2 / 1 mm, never FAILED(SETTLE). Lost batch 3 of 3 recovered by the resend (1.4 s); duplicate at index 1, 3 of 3 with no restart; max speed 150 / 450 / default measured 170 / 485 / 319 mm/s; a 180-degree pose turn moved the axle 2.9-5.0 mm; final heading over 8 poses mean +0.4 degrees with both signs.
Figure 16. Precise arrival on 2426: the axle miss against LH2 truth (mean fix at rest minus 51.5 mm along a 100 mm probe heading) for each threshold, 22 runs, all ARRIVED. Below 5 mm the robot creeps, settles and corrects; the mean tracks the threshold down to 2 mm and then flattens at about 1.5 mm, the floor set by the heading estimate at rest (shaded), not by LH2 or the encoder. Against the robot's own heading every precise run is inside its threshold.Old against new, this phase's metric, shortened: E21A on the old dotbot app and 2426 on dotbot-next, parallel lanes, a 400 mm straight. New: 6 of 6 arrived at 10 mm, axle miss 9.4-10.9 mm, path error 4.6-10.2 mm. Old: 0 of 3 at 10 mm (overshot and left its lane), 2 of 3 at 20 mm with photodiode misses of 14.3 and 16.6 mm and paths 38-44 mm off, 134 mm on the failed run. The new app wins on reliability, miss and path error; the old one is faster on a straight when it works. Short of the deliverable's 16 runs per arm per start pose, one trajectory only.
Found on the floor. The console sent a 60 mm terminal radius and the robot stops at the edge, which was the visible end-pose error; #302 makes it 10 with presets down to 1. The PyDotBot record's 53.5 mm lever against the firmware's fitted 51.5 put 2 mm along the heading into any axle expanded from a fix; the console now centres on the advertised axle. The camera reads (+7.8, +17.8) mm off LH2 with a position-dependent scale, so it cannot judge anything below about 20 mm until calibrated.
Limits and what is left. Axle precision is bounded by heading knowledge at rest (about 1.8 degrees sd, 0.9 mm per degree at the lever), so about 1.5-3 mm; a photodiode target would be sub-millimetre. Docs (README, doc/sphinx toctree for drv_steering, which fails the DotBot-libs doc CI job since #34, PyDotBot REST reference) wait for the post-review pass. The old apps and drv/move stay for comparison only. Robots left running dotbot-next with the final-turn fix (dotbot-next-wp2.bin, 0c53fc5b), no locks held.
- Cut-over done in code, as draft PRs, on the developer's approval after the shortened head-to-head (new 6 of 6 arrived at 10 mm; old 0 of 3 at 10 mm, 2 of 3 at 20 mm with paths up to 134 mm off), accepted in place of the 16-runs-per-arm check. Branch cutover on waypoints: DotBot-libs#36 (@ 00b4e34), DotBot-firmware#429 (@ f1ea6fc), PyDotBot#303 (@ 945a20e). Chip to active rather than done, like phases 4 to 6, until the PRs merge.
Renamed and removed.apps-sandbox/dotbot-next moved to apps-sandbox/dotbot (2 lines changed), the old sandbox app deleted, the SES project dotbot-next gone, so dotbot-sandbox-dotbot-v3.bin is the new app and PyDotBot's rc-car already resolves to it; DOTBOT_CONTROL_LOOP_USE_PURE_PURSUIT dropped from the sandbox solutions. drv/move, 00drv_move and 01drv_move deleted; the successor is db_wheel_goal_* in drv/wheel_control (a signed distance per wheel, arrival at the longer wheel's target minus the 0.05 s-per-mm/s braking run-on, zero setpoints after, host-tested: wheel suite 154 to 184 checks, two mutants caught), with apps-sandbox/move ported to it (200 mm square at 150 mm/s, turns at 100) and 01drv_wheel_control replacing 01drv_move.
Deliberately kept. The bare apps/dotbot (the documented single-robot path without SwarmIT, released as dotbot-dotbot-v*.hex) and with it drv/control_loop, compute_angle and the bare app's 500 mm outlier gate, which PyDotBot's simulator and its control_loop CI job also build. Porting the new app to the bare build needs a platform layer for the fix and its sequence, the keep-alive, command RX and the advert path, with a floor test on a cabled robot: proposed in #429, not done. dotbot-simple stays (no control loop, a HIL target). swarmit names the image only in a test fixture.
Builds and floor. SES 7.22, the full CI matrices (firmware: 12 bare targets Debug and Release plus 3 sandbox; libs: 6 targets Debug and Release), 0 warnings, 0 errors; make test 184 / 106 / 234. Smoke on 2426, OTA, plain build, battery 1.3 V, lock robot-B4AB5A04DF9E2426.lock held and released: a single waypoint from a standing start without heading ARRIVED in 2.5 s (advertised axle 10.0 mm off at a 10 mm threshold); a 3-point path indexed 0 to 3 and ARRIVED in 4.7 s (11.4 mm); a stop mid-batch gave ABORTED(STOP); swarm stop / start fine, image reported as dotbot-sandbox-dotbot-v3.bin. Left running it. apps-sandbox/move built, not driven.
- The waypoints branches rebased onto main after #34 and #427 merged, force-pushed to fork with a lease, each linear with only its own commits. DotBot-libs#35: its 6 commits replayed from the old #34 tip 9f01c64 onto 55cefbe (c8f433a to d4c8d6f, 2d1c236 to 283237d, e0375b3 to f23043c, cccde38 to 8ab1b70, 0b88937 to f968794, ab0227d to aefdf62), the tree equal to ab0227d's plus exactly #34's diagram hunk; then 62f1f14 extends the diagram above db_steering_state_t to the batch machine (SETTLE, NUDGE and FAILED(SETTLE), passing points, FINAL_TURN to ALIGN mid-batch, SETTLE and NUDGE to ALIGN on a new batch, completion). make test 154 / 106 / 234 passed, clang-format 18 clean; GitHub shows 7 commits, +1184 / -148. DotBot-firmware#428: its 5 own commits after fa92a4a replayed onto 9435f5f, each dotbot-libs bump remapped to the rebased libs commit (b1c985a to 6493f1e at f23043c, 931614a to 25f0ec7, a45b4d2 to e049e9b at 8ab1b70, 6b4f5d3 to 4accace at aefdf62, ddbf514 to 0cefd59), plus e75f238 bumping to 62f1f14; no diff against ddbf514 outside the submodule, SES 7.22 sandbox-dotbot-v3 Release builds with 0 errors; GitHub shows 6 commits, +164 / -58, 2 files. PyDotBot#301 was already linear on main's tip 1ed5f7b at 9d2e148, so it was not pushed; pytest 944 passed, 5 failed, the same 5 that fail on main on this machine. PyDotBot#302 (25c170f) already contains #301's tip and needs no rebase. Safety refs waypoints-pre-rebase-2026-09-25 in the libs and firmware worktrees.
- DotBot-libs#35 and DotBot-firmware#428 merged. DotBot-libs#35 (62f1f14, all checks green, clean) merged with a plain merge commit, 739d285; 62f1f14 is its ancestor and the trees are identical. DotBot-firmware#428 got c277e84 "dotbot-libs: bump to the waypoints merge on main" (submodule 62f1f14 to 739d285, the only change against e75f238), pushed fast-forward, all 32 checks green, then merged with a plain merge commit, 0e0ab7b. The waypoint firmware is on main in both repos; the chip stays active until PyDotBot#301 and #302 merge, and the cut-over after them. DotBot-libs#36 and DotBot-firmware#429 were retargeted to the new mains. #36 was cut from #35 before its last rebase, so it still carries six pre-rebase copies of #35’s commits (9 commits, +1539 / -450): it merges cleanly to the same tree, and a rebase onto main would leave its own 3 commits, +387 / -317 in 14 files. #429 carries old copies of #427 and #428 and conflicts on dotbot-libs; it is rebased onto main after #36 merges, then bumped to #36’s merge commit; against main its tree is +1287 / -1532 in 12 files. PyDotBot’s main did not move, so #301 to #303 needed no retarget. PR bodies updated for the new chain.
- PyDotBot#301 merged. All checks green (15 checks, codecov and readthedocs), clean and mergeable at 9d2e148; merged with a plain merge commit, 6668874. PyDotBot#302 and #303 had their bases refreshed to the new main: #302 now shows its own 13 commits, +2737 -78 in 22 files, and #303 its one commit, +11 -11 in 5 files; both merge cleanly with no rebase. DotBot-libs#36 and DotBot-firmware#429 were already based on their main tips; #429 still conflicts on the submodule until it is rebased, as planned. The four PR bodies now list #301 as merged, #302 as next, and the size tables without #301's rows. #301 moves to the merged column of the line count.
- DotBot-firmware#429 merged, the second PR of the cut-over. Rebased first: its own 8 commits (ddbf514..7afb215; the 14 before them were pre-rebase copies of #427 and #428, already on main, whose tree equals ddbf514’s outside the submodule) replayed onto 0e0ab7b with author, date and message kept, 7afb215 becoming 1343219 (safety ref cutover-pre-rebase-2026-09-25 at 7afb215, local). Its three dotbot-libs bumps were remapped to #36’s rebased commits by patch-id: 6859478 to 58a3f05, ddb10f2 to 13e6643, b6027b3 to c11eb27, all on DotBot-libs main. git diff 7afb215 1343219 outside the submodule is empty, so the rebase neither resurrected apps-sandbox/dotbot-next nor lost a file. The final bump, ac15985 "dotbot-libs: bump to the cut-over merge on main", points at c1ff6ca, whose tree equals c11eb27. Local SES Release builds exit 0 with no errors or warnings for sandbox-dotbot-v3, sandbox-dotbot-v2, sandbox-nrf5340dk and dotbot-v3. Force-pushed with a lease on 7afb215; 9 commits, +1287 / -1532 in 12 files, the same as before the rebase (the line-count table had it at -1242, and its open column now matches git diff --numstat). All 31 checks green, merged with a plain merge commit, db3cdb6, whose tree equals ac15985. Next and last is PyDotBot#303, already on main at 3a38ee1; its body now states the chain.
- DotBot-libs#36 merged, the first PR of the cut-over. Rebased first: git rebase --onto origin/main ab0227d cutover dropped the six patch-identical copies of #35’s pre-rebase commits and kept its own 3, linear on 739d285: 6859478, ddb10f2, b6027b3 became 58a3f05, 13e6643, c11eb27 (safety ref cutover-pre-rebase-2026-09-25 at b6027b3, local). No conflicts; the new tree b3cc31f is identical to a trial merge of b6027b3 into main. #36 does not touch drv/steering*, so the state diagram in steering.h still matches. make test 184 + 106 + 234 passed, check-format clean with clang-format 18. Force-pushed with a lease on b6027b3; now 3 commits, +387 / -317 in 14 files. All checks green (release skipped, tag-only), merged with a plain merge commit, c1ff6ca. The line counts move from open to merged unchanged. Next is DotBot-firmware#429, whose dotbot-libs pointers name #36’s pre-rebase commits and need remapping before its final bump to c1ff6ca; then PyDotBot#303. PR bodies of #429 and #303 updated.
- PyDotBot#302 merged; the waypoint half of phase 7 is complete. All checks green, clean and mergeable at 25c170f (13 commits, +2737 / -78 in 22 files); merged with a plain merge commit, 3a38ee1. Waypoint batches are now on main in DotBot-libs, DotBot-firmware and PyDotBot. The chip stays active: what remains of this phase is the cut-over, DotBot-libs#36, DotBot-firmware#429 and PyDotBot#303. PyDotBot#303’s base was refreshed to 3a38ee1, still its one commit and clean; DotBot-libs#36 (9 commits, clean) and DotBot-firmware#429 (22 commits, conflicting on dotbot-libs until rebased) were already on their repos’ main tips. Next is DotBot-libs#36, which should first be rebased onto main to drop its six duplicate copies of #35’s commits; the developer’s decision on that is pending. PR bodies of #36, #429 and #303 updated for the chain.
- State machine along a batch drawn, Figure 15, in the design section above, traced from steering.c at DotBot-libs#35 62f1f14 with the numbers from dotbot-next's steering config. The Doxygen diagram above db_steering_state_t agrees with the C; two things it does not show are in the caption: FINAL_TURN's per-tick brake, and the correction count surviving HOLD and RECOVER. Figures 13 and 15 are now standalone SVGs beside the plan, figures/steering-states.svg and figures/steering-waypoint-states.svg, each carrying the plan's palette with its own dark variant, so documentation can reuse them. The precise-settle chart becomes Figure 16.
- PyDotBot#303 merged; phase 7 is complete, and with it all seven phases. Rebased first, since it sat on #301’s tip 9d2e148 rather than main’s 3a38ee1: its one commit replayed onto main with author, date and message kept, 9d9fb84 becoming ae0ca6e (safety ref cutover-pre-rebase-2026-09-25 at 9d9fb84, local); the new tree d948864 is identical to a trial merge of 9d9fb84 into main. pytest (--ignore=dotbot/examples, the shared venv lacks scipy) 943 passed, 5 failed, the same 5 that fail on main on this machine (four test_cli_helpers reading the local config file, the simulator controller test); no console change, so no build. Force-pushed with a lease on 9d9fb84; the base was already 3a38ee1, one commit, +11 / -11 in 5 files. All checks green (15, publish release skipped, tag-only), merged after DotBot-firmware#429 with a plain merge commit, ab48d87. The chip goes to done: the deliverable, one sandbox app with the old one and drv/move deleted, is on main in all three repos, judged by the shortened head-to-head the developer accepted in place of 16 runs per arm. The plan stays active rather than done: the docs sweep (DotBot-libs README and the drv_steering toctree entry whose absence fails the doc CI job, the PyDotBot REST reference) has not landed, and the converge pass has not run. Carried to it: the phase 6 gain-set comparison, never run; phase 4’s check (b) on three robots over 2 m, the loop above 700 mm/s and encoder count drops; porting the new app to the bare apps/dotbot.
- Converge pass; the plan is done. The pinned merge commits check out against GitHub for all fourteen PRs of phases 4 to 7 (DotBot-libs caa788b, cd5f862, 55cefbe, 739d285, c1ff6ca; DotBot-firmware ff3e4c8, 21eba1b, 9435f5f, 0e0ab7b, db3cdb6; PyDotBot 1ed5f7b, 6668874, 3a38ee1, ab48d87). Where the code diverged from the design it is already logged in the phase it belongs to, and the design prose is left as written: the shortened check (b), one steering gain set instead of a comparison, the head-to-head in place of 16 runs per arm, and the bare apps/dotbot left on drv/control_loop. validated: hil stands on the agent-run floor tests of phases 4 to 6. The docs sweep is not done under this plan and goes to its own ticket; the unrun checks and the bare-app port become the backlog and C19 (08 Close-out). The plan moves to plans/done/dotbot-control-fw/ with its siblings, figures, results, report and bench scripts, and status goes to done.
05Relationship to the precision campaign
What this restructures, and what it keeps intact
This does not discard plans/dotbot-control-loop-precision/. That plan's
analysis is what produced this one, and its ranked findings survive unchanged. What changes
is the delivery vehicle: thirteen phases of modification become seven layers of
construction, and three of the thirteen dissolve because the structure they patch is not
rebuilt.
Precision-campaign phase
Fate here
1 - measurement rig and baseline
Phase 1, with the parts that need an open NSC boundary in phase 2. The rig becomes the app rather than a throwaway build.
2 - encoder scale factor and geometry
Phase 3, widened to own the sensor lever arm too.
3 - secure gate and fix sequence
Phase 2, plus a solve timestamp the estimator needs, and the fix characterisation that only becomes possible once the gate is gone.
4, 5, 6 - one timeout, split the anchors, bench-validate
Dissolved. Innovation gating and the declared reset replace the anchor machinery; there is no anchor to split.
7 - brake on arrival
Phase 6.
8 - shared encoder sampling layer
Phase 3.
9 - inner wheel-velocity loop
Phase 4.
10 - EKF predict between fixes
Phase 5, extended with the lever arm and the position-only measurement.
11 - raise the fix rate
Folded into 2 and 5. Heading no longer degrades with a shorter period, so the trade that made this risky is gone.
12 - D-term bugs, then retune
Phase 6, written fresh rather than fixed in place.
13 - pure-pursuit A/B
Deferred. Valid any time after phase 7, and still an A/B rather than a change.
If this plan is adopted, that one becomes superseded with
superseded_by pointing here, and its analysis sections stay readable as the
evidence base. That is a decision to take deliberately, not a side effect of writing this.
06Risks
What could go wrong, and what only the bench can settle
Second-system syndrome. The strongest pull will be to also redesign the
protocol, the telemetry schema and the configuration while in there. The command surface
in 3.3 is frozen specifically to make that harder. Minimal means minimal.
Rediscovering undocumented fixes at the bench. A rewrite loses the accreted
corrections that nobody wrote down. Phase 1's harvest list is the mitigation, and it is
a deliverable rather than an intention.
The 500 mm gate may have been protecting against something real.
Lighthouse does produce outliers. Phase 2 removes the gate and measures, in that order,
because the gate hides the very distribution that would justify keeping it - so the
measurement is taken with the fleet exposed, on a bench bot rather than in a campaign.
If it shows large frequent outliers, phase 5's innovation gate takes its threshold from
that distribution rather than a guess, and the interval between the two phases is the
window where a bot can wander.
Heading may be too weakly observable from position alone. The lever arm makes
it observable, but only through motion and only if the differential is above the noise.
If phase 5's spin check fails, the fallback is to restore a heading measurement row with
a speed-dependent R rather than a constant one - worse, but recoverable, and still
better than today.
The tick-ownership answer may be worse than assumed. If one RTC0 channel
cannot carry the fastest rate the estimator needs, the fallbacks are a TIMER_HF instance
or an NSC-exported tick, and the latter rides phase 2 because it means another implib
regeneration. Deciding this is phase 1 work, not a discovery.
The control-loop ABI is mirrored in Python and consumed by a second app.robot_control_t is mirrored byte-for-byte by ctypes
(dotbot_simulator.py:146-171,439), and the bare apps/dotbot
links the same driver and survives phase 7. Phases 4 to 6 must either preserve that ABI or
move the simulator mirror, the utils/control_loop host build and the bare app
in the same wave. No phase currently owns a PyDotBot deliverable even though the new
command types and the bench frame both need sender and parser support there; fold that
into whichever phase introduces each.
Motor authority is smaller than the control law assumes. Carpet breakaway sits
between 40 and 45 PWM against a DB_MAX_PWM of 60, so autonomous mode has about
twenty units of headroom, and once the 0.75 speed reduction is in play any real turn
command drives one wheel below the point where it moves at all
(3.10, 3.11). Raising the ceiling is the decision taken, and it invalidates the existing heading
PD tuning, so phase 6 cannot inherit gains - which is a retune on hardware, not a constant
edit.
The robot may not pivot about the axle midpoint. Long-exposure photographs of a
v3 spinning at 100 PWM on carpet suggest the rotation centre is elsewhere (3.13). A
side-to-side offset is motor mismatch and phase 4 removes it; an offset forward, toward
the caster, means slip or a binding caster, which no wheel-speed loop can correct and
which makes both ddir = -(d_right - d_left) / DB_TRACK and the 53.5 mm
lever arm wrong - the second possibly wrong in sign. Phase 5's spin check is now designed
to measure it by fitting a circle to the logged fixes rather than to confirm a sign.
The hardware brake is confirmed by hand, not by instrument. The motor
API had no brake at all: db_motors_set_speed(0, 0) drives both H-bridge inputs
low, which is coast, and a single signed value per motor cannot express the both-high
state that brakes (drv/motors/motors.c:57-60). Phase 6 therefore carried a
DotBot-libs change, db_motors_brake(), which landed in DotBot-libs#28 and
resists a push on a v3 (phase 6 log, 2026-08-31). That is the whole evidence: the truth
table is the part's, and the v3 fits a BDR6120H rather than the DRV8833 the header names,
so how much the latch actually shortens a stop is still unmeasured.
Every phase needs hardware. None of the sampling, estimation or
control claims can be settled in this workspace. The simulator runs the real control
function through ctypes but models no lighthouse layer at all, so it can prove a control-law
bug exists and cannot say anything about fix rate, measurement noise or brake versus
coast.
07Terms
Dotted words in the text show these on hover, on focus, or on tap
Control and kinematics vocabulary that this plan leans on, with the Brazilian Portuguese term
beside it. Generated from the same table that feeds the inline balloons, so the two
cannot drift apart.
setpoint - Valor de referencia
The value a controller is asked to maintain. In phase 4 it is the desired speed of one wheel; the controller changes PWM until the measured speed follows it.
closed-loop control - Controle em malha fechada
Control that measures what actually happened and feeds that result back into the next command. The wheel PI is closed loop because encoder rate changes the PWM it produces.
open-loop control - Controle em malha aberta
Control with no feedback from the quantity being controlled. MOVE_RAW is open loop with respect to wheel speed because it writes PWM without checking the resulting encoder rate.
sample interval, dt - Intervalo de amostragem
The actual elapsed time represented by one controller update. The wheel PI derives it from the scheduler tick difference: normally 10 ms, but 20 ms if one update was skipped.
PI controller - Controlador PI
Proportional-Integral controller. P reacts to the current error; I accumulates persistent error so the controlled value can reach the setpoint without retaining a steady offset.
PD controller - Controlador PD
Proportional-Derivative controller. P reacts to the current error; D reacts to how quickly that error is changing and adds damping. The outer heading controller is PD.
PID controller - Controlador PID
A controller containing P, I and D terms. It is not automatically better: the wheel loop needs I but gains little from differentiating quantised encoder rate, while the heading loop benefits from D but deliberately avoids integral windup.
anti-windup - Protecao contra saturacao do integrador
A guard that stops the integral term accumulating while PWM is saturated and the motor cannot satisfy the target. Without it, an impossible request leaves a stored error that delays recovery.
slew-rate limit - Limite da taxa de variacao
A bound on how much a command may change per update. Here it limits PWM steps to reduce jerk and current spikes.
cascaded control - Controle em cascata
Nested feedback loops in which a slower outer loop changes the setpoint of a faster inner loop. Waypoint steering chooses wheel speeds; the wheel PI loops turn those speeds into PWM.
bandwidth - Largura de banda
How fast a loop can actually respond, measured as the time to get most of the way to a new setpoint. A cascade needs the inner loop to settle much faster than the outer loop's period, typically five to ten times. Not the same as sample rate: how often a loop looks is not how fast it responds, so 100 Hz against 10 Hz is a sampling ratio, not a bandwidth ratio.
differential drive - Rodagem diferencial
A drivetrain, not a motor: two independently driven wheels on one axis plus a passive support. There is no steering mechanism - you turn by driving one wheel faster than the other, and the difference in speed is what rotates the robot.
instantaneous centre of rotation - Centro instantaneo de rotacao
The point the robot is turning about at this instant, often shortened to ICR. It is not fixed to the robot: it slides along the axle line as the wheel speeds change, and sits at infinity when the robot drives straight.
axle line - Linha do eixo
The straight line through both driven wheel centres, extended indefinitely in both directions. On the DotBot it is y = 124.500 mm. It matters because the centre of rotation is always somewhere on it.
track - Bitola
The distance between the two driven wheels, measured between their contact points. Nothing to do with the ground the robot drives on. It is the L in the turn-rate formula, so an error in it scales every rotation the odometry reports.
wheelbase - Distancia entre eixos
Strictly the front-to-rear distance between axles, which for the DotBot is axle to ball caster, about 64.5 mm. Robotics writing often uses it loosely to mean track; this plan says track when it means side to side.
caster - Rodizio, ou roda boba
A passive undriven wheel that carries weight and rolls in whatever direction it is dragged. The DotBot uses a ball caster at the front. Because it is free it adds no kinematic constraint, which is why it does not move the centre of rotation - unless it binds.
non-holonomic - Nao holonomico
The robot has three degrees of freedom in its pose but only two controls, and cannot move sideways at all. Every pose is still reachable, just not by travelling straight there - which is why parking a car takes manoeuvring.
strafe - Deslocamento lateral
Moving sideways without rotating. A differential drive cannot do it; omni and mecanum wheels can. Borrowed from video games.
skid-steer - Direcao por derrapagem
The same steer-by-speed-difference idea with four or more fixed wheels. Because the wheels sit at different points along the body they cannot all roll cleanly through a turn, so they scrub. Bobcat loaders and tracked vehicles work this way.
lever arm - Braco de alavanca
The offset from the point the robot turns about to the sensor. On the DotBot it is 53.5 mm forward, which is why rotating the robot moves the sensor even when the robot goes nowhere.
odometry - Odometria
Estimating how far and how much you have turned by counting wheel rotation. Cheap and smooth, but it drifts, because slip and scale errors accumulate with no outside reference to correct them.
innovation - Inovacao
The gap between what a filter predicted and what the sensor actually reported. Gating on it, rather than on raw displacement, is what stops the estimator latching: rejecting a measurement widens the gate rather than freezing it.
backlash - Folga
Slack in a gear train. On a direction reversal the motor shaft, and so the encoder, turns before the wheel does, so odometry counts motion that never reached the ground.
breakaway - PWM minimo de partida
The smallest motor command that actually starts the wheel turning. Below it nothing moves at all. On a v3 on carpet, nothing moves below 40 and it drives straight at 45. Spinning needs more than 45; that figure is not yet measured.
feedforward - Acao antecipativa
A term added to a controller from what is already known about the plant, rather than from the measured error. The wheel loop adds the breakaway PWM as feedforward so the PI only has to trim around the operating point instead of discovering it every time.
stiction - Atrito estatico
The friction that must be broken before anything starts moving. It is why low motor commands produce no motion at all, and why a terminal approach needs a velocity floor rather than fading smoothly to zero.
coast - Roda livre
An H-bridge state in which both outputs are disconnected, so the motor freewheels and only friction slows it. Writing zero to both PWM channels of a DRV8833 selects it, which is why a commanded stop lets the DotBot roll on.
hardware brake - Frenagem por curto-circuito
The opposite H-bridge state: both outputs driven to the same rail, shorting the motor windings so the motor's own back-EMF opposes any further turning. It resists being pushed, where coast does not.
kinematics - Cinematica
Motion described purely as geometry - where things are, how fast, which way - with no mention of forces, mass or torque. Its companion is dynamics, which does include them. Worth keeping apart here: the rule that the robot turns about a point on its axle line is kinematics, while the worry that a sticky caster moves that point is dynamics.
gear ratio - Relacao de reducao
How much the gearbox slows the motor down, and so how much it multiplies torque. The DotBot gearbox is sold as 50:1 but hand-counts at about 51:1, which the measured 1430 encoder counts per wheel turn confirm (28 × 51 = 1428).
CPR - Contagens por revolucao
Counts per revolution: how many steps a quadrature encoder reports for one turn of the shaft it is attached to. Not the same as PPR, pulses per revolution - quadrature decoding gives 4 counts per pulse cycle, so CPR is usually 4x PPR. On the DotBot the encoder is on the motor shaft, so counts per WHEEL turn are CPR times the gear ratio.
quadrature encoder - Encoder em quadratura
Two sensor channels offset by a quarter cycle. The order in which they change tells you which way the shaft turned, and counting every edge of both channels gives four counts per cycle - which is why a 72-line encoder reports 288 counts per revolution.
NEMA 17 - NEMA 17
A stepper motor size standard from the US NEMA body: the 17 is 1.7 inches across the mounting face. It fixes the bolt pattern and face size and nothing else, so motors from different makers interchange. Used here only as an analogy for N20, which is an informal industry size convention rather than a NEMA one.
08Close-out
Closed 2026-09-25; what is carried out of this plan
All seven phases are on main in DotBot-libs, DotBot-firmware and PyDotBot, and the
plan closed at the converge pass (phase 7 log, 13:38). What was still owed goes on elsewhere:
Bench validation, BACKLOG C18: (a) the phase 6 gain-set comparison, 16 runs per
gain set per start pose, never run; (b) phase 4's check (b) on three robots over 2 m;
(c) the wheel loop above 700 mm/s; (d) encoder count drops near the sample-rate limit.
All four need the testbed.
Porting the new app to the bare apps/dotbot, BACKLOG C19: the bare
app still runs drv/control_loop, which retires once it is ported.
Docs sweep (the DotBot-libs README, the drv_steering Sphinx toctree entry
whose absence fails the DotBot-libs doc CI job, the PyDotBot REST reference): not
done under this plan; tracked separately.