Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
bench/real-probe.ts steps one joint a little, reports arrive time, final error and overshoot, refuses while a turn is held, and always restores the start pose #543
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
I added Software/so101/bench/real-probe.ts and its test, and pushed. The four new tests pass against the fake server, and tsc reports no errors in the new files. The repo has other type errors, but none of them are in the new files.
shipped merged
2 earlier comments · 1 event
I added Software/so101/bench/real-probe.ts and its test, and pushed. The four new tests pass against the fake server, and tsc reports no errors in the new files. The repo has other type errors, but none of them are in the new files.
I wrote the probe fresh. The smith/439-… branch wasn't in my clone, so there was no existing version to take.
Command
bun run Software/so101/bench/real-probe.ts <url> --joint N [--step ticks]
- Step: it drives servo id N over
/followby 60 ticks by default, toward the middle of the joint's bounds and clamped inside them. - Output: it samples
/statusevery 20 ms and prints the time to arrive within 12 ticks, the final error and the overshoot. - Refusals: it won't start if
/statusshows someone driving, STOP or an E-stop. If STOP or an E-stop appears mid-run, or the stream closes, it stops. - Restore: a
finallyblock always sends the joint back to its start pose and waits for it to settle, reopening/followif the stream died. Ctrl-C stops the run and then restores. If STOP or an E-stop is still in force during the restore, the restore throws and the joint stays where it is.
Tests (bench/real-probe.test.ts)
- Fake server: a step produces numbers, and the joint ends within 12 ticks of its start.
- Refusals: a probe is refused while someone drives, and refused while a turn is held. The held case is simulated by wrapping
fetch, because the fake server has no way to hold a turn. - Bounds: clamping and direction are covered separately.
Docs: Software/README.md has one new paragraph with the command. forge.json is untouched.
I merged main into the branch and pushed. The only conflict was in Software/README.md, and I kept both paragraphs there: the real-probe.ts one from this pull and the jam-rate.ts one that came in from main.
I re-ran only bench/real-probe.test.ts after the merge, and all 4 tests pass. I did not run the whole suite; the forge's check runs it on the push.
real-probe.ts and its test are unchanged by the merge.
🤖 Generated with Claude Code
The probe is well shaped and in scope, but it claims things it does not check, and its main safety promise has no test.
- Fix first:
report()always prints "restored to the start pose", and the title and README say it "always restores the start pose". Inrun(..., restoring=true)the loop ends silently after RESTORE_MS (4 s) when the joint never got within 12 ticks ofstart.probethen returns normally and the operator is told the arm is home when it may not be. Fix: after the restore, read /status. If |position - start| > ARRIVE_TICKS, throw "joint N did not return to its start pose (at X, start Y)". PutrestoredinProbeand print it from that, not as a constant.
- Tests: the restore-on-abort path is the point of this change and no test would fail without it. Add: (a) a test where the stream closes or STOP appears mid-run (wrap fetch as the held test does, flipping
heldafter the first sample) and assert the probe rejects with "stopped: STOP", and that with the fake arm the joint is back at start once the hold is lifted or never moved; (b) a test that the restore failure in item 1 is reported. The "emergency stop" branch ofstopped()and the--stepvalidation (0, NaN) are also untested.
- Smaller: the
finallyrestore throws "stopped: STOP" and so replaces the original error. Keep the first error, for example by attaching it ascause, so the operator sees what actually went wrong.interruptedis module state set by SIGINT, so it cannot be tested; pass an AbortSignal intoprobeinstead.
Security, dependencies (ws is already used) and docs are fine; README documents the command. Preview is the app server and does not serve this bench tool, so nothing there to try.
I've addressed all three review points and pushed. The 10 tests in bench/real-probe.test.ts pass, and tsc reports nothing in the probe files.
- Restore is now checked. After sending the joint home, the probe reads
/statusand throwsjoint N did not return to its start pose (at X, start Y)if it is more than 12 ticks off.Probe.restoredis set from that read, andreport()prints "restored to the start pose" or "NOT restored to the start pose" from it. - The first error is kept. If the restore also fails, the probe throws the original error with
(and the restore failed: …)added to the message. The restore error is attached ascause. - Abort uses an
AbortSignal.probe(url, id, step, signal)takes the signal, and the module-levelinterruptedflag is gone. The command-line entry point passes a signal that SIGINT triggers. - New tests:
- STOP appearing mid-run.
- An E-stop appearing mid-run.
- An abort signal.
- A joint that never comes home.
- A stop that also blocks the restore.
- --step of 0 and NaN.
In the STOP, E-stop and abort tests the probe rejects with the expected message and the joint is back within 12 ticks of its start. The joint-never-comes-home test passes only because of the new read-back check.
One thing to look at: the "did not return" test fakes /status by rewriting the joint position, because the fake arm always obeys. Those tests take about 4 s each because the restore waits out its full 4 s.
🤖 Generated with Claude Code
Approved. A bench script with no page or terminal door, no new dependency, README paragraph present, and 10 tests that cover refusal while driving or held, STOP and E-stop mid-run, abort, a failed restore, and a bad step. It is the probe the issue asked for and adds nothing else. I did not run it on a real arm.
Two things I would do next:
- In
run(),ws.sendgoes out before the first/statuscheck. Whenrestoreruns after a STOP or E-stop, the home command is sent first and only then refused. Read/statusand checkstopped()before the first send. The restore will then never command motion while a stop is in force, and the test for a stop that also blocks the restore can assert nothing was sent. - The restore waits the full 4 s whenever the joint does not arrive, so those tests take about 4 s each. Pass the restore time as a parameter so the tests can shorten it.
I added
Software/so101/bench/real-probe.tsand its test, and pushed. The four new tests pass against the fake server, andtscreports no errors in the new files. The repo has other type errors, but none of them are in the new files.I wrote the probe fresh. The
smith/439-…branch wasn't in my clone, so there was no existing version to take.Command
/followby 60 ticks by default, toward the middle of the joint's bounds and clamped inside them./statusevery 20 ms and prints the time to arrive within 12 ticks, the final error and the overshoot./statusshows someone driving, STOP or an E-stop. If STOP or an E-stop appears mid-run, or the stream closes, it stops.finallyblock always sends the joint back to its start pose and waits for it to settle, reopening/followif the stream died. Ctrl-C stops the run and then restores. If STOP or an E-stop is still in force during the restore, the restore throws and the joint stays where it is.Tests (
bench/real-probe.test.ts)fetch, because the fake server has no way to hold a turn.Docs:
Software/README.mdhas one new paragraph with the command.forge.jsonis untouched.Closes #517