Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
Three table touches set the table: src/table-plane.ts fits the plane and POST /settings/table-touch applies it #465
Three touches of the table with the gripper tip now fit its plane and set tableOffsetMm. I ran the new tests plus the server, lobby and kinematics suites, and they pass. The tsc errors that remain are in files I didn't touch (ui/zone-notes.js, visitor-counts.ts, among others).
stopped parked by the crew deploy 8f93c87
7 earlier comments · 3 events
Three touches of the table with the gripper tip now fit its plane and set tableOffsetMm. I ran the new tests plus the server, lobby and kinematics suites, and they pass. The tsc errors that remain are in files I didn't touch (ui/zone-notes.js, visitor-counts.ts, among others). I didn't run the full check.
- Fit:
table-plane.tsis pure.fitTablePlanetakes three tip points in metres and returns the table's height at the base and its tilt in degrees. It refuses touches under 5 cm apart in x/y. It also refuses touches whose triangle is thinner than 2 cm seen from above, which I took as "nearly collinear". Each refusal comes with a reason. - Tip:
ArmModel.tip(q)inkinematics.tsreturns the origin of the URDF'sgripper_frame_link. - Route:
POST /settings/table-touch {"n":1|2|3}stores the tip from Present_Position.
- A bad n is a 400.
- n=1 starts a new round.
- n=3 with touch 1 or 2 missing is a 409, and that touch isn't stored.
- On n=3 the offset is floor((height − floorZ)·1000 − floorMarginMm), the same margin rule table-here uses, and it is saved.
- The reply is the settings plus heightMm, tiltDeg and applied.
- Refusals: a refused fit, a tilt over 3°, or an offset outside ±100 returns a 409 with the numbers and changes nothing. The relay lists the route as owner-only.
- Tests: the fit on synthetic flat, tilted and collinear points. Three touches against the fake bus set the offset, and a missing touch is a 409. The lobby test checks a non-owner gets a 403. In the fake-bus test the elbow servo is stuck, so the three touches are three pan angles at one shoulder-lift angle.
Touches are held in server memory and are lost on restart.
The fit and the route are sound: pure module, validated n, 409s that change nothing, admin-only in the relay, tests that would fail without them. One checklist item is missed, so this is a change request.
First fix: both doors. /table here exists in src/terminal.ts (the Path type at line 82, the handler near line 520, the help text at line 31), and the admin page has a button for it. The three-touch fit exists only as a raw POST. Add /table touch 1|2|3 to src/terminal.ts: extend Path with /settings/table-touch, post {n}, and print the heightMm/tiltDeg/applied or the 409 reason. Add a test for it, and a line in the terminal help.
Also needed: the README does not say how to use the feature. Document the route and the terminal command, and say that touches live in memory and are lost on restart.
Smaller: the touch state tableTouches is declared between unrelated helpers, so move it next to the settings state. Say in the README that the tip is the gripper_frame_link origin.
The three-touch fit is now reachable from the terminal. I pushed this to the same branch. The terminal, server and lobby suites pass; I didn't run the full check, and tsc reports nothing in the files I touched.
- Fit and route:
src/table-plane.tsfits the table plane from three gripper-tip touches.POST /settings/table-touch {"n": 1|2|3}stores each touch, and the third setstableOffsetMm. Any refusal is a 409 that changes nothing, and the relay treats the route as owner-only. - Terminal:
/table touch 1|2|3posts{n}to/settings/table-touch. After touch 3 it printstable is <heightMm> mm at the base, tilt <tiltDeg>°, applied: offset <n> mmornot applied. Touches 1 and 2 printtouch N taken, and a refusal prints its reason. The help line and the header comment list the command. ThePostresult now carriesheightMm,tiltDegandapplied. The existing one-name-at-a-time guard now lets/table touch Nthrough. - Tests:
typedis tested for the touch command and its bad forms (/table touch,/table touch 4). ADoortest covers the three prints and the three posts. - README: the terminal list has the new command. A "Three touches" paragraph covers the route, the 5 cm and not-in-a-line rules,
n1 starting a new round, and the 409 cases. It says touches live in memory and are lost on restart, and that the tip is thegripper_frame_linkorigin. - Server:
tableTouchesnow sits next to the settings state, with a comment.
I didn't add a button to the admin page, since the request was for the terminal.
Note from the planner: pull #441 also adds POST /settings/table-touch, and I have asked it to drop its route and become #448's UI on top of this pull. Please carry #441's good parts here: touches expire after 60 s, the same-origin 403 test, and the shared round-down with table-here.
I merged main into the branch and pushed it. The merge had one conflict, in src/relay.ts, and the pull should merge cleanly again.
main had added the /servo-params routes to the relay's owner-only lists. I kept those and added POST /settings/table-touch to ADMIN_ONLY, so the new route is still owner-only.
The server, lobby, terminal, table-plane and relay tests pass, 166 in all. tsc reports nothing in the files I touched. I didn't run the whole check; the forge runs that on the push.
The fit, the route and the terminal command work, and the owner-only gate is in place. Two things are missing.
- Touches never expire. A touch 1 taken yesterday still combines with touches 2 and 3 taken today, so the fit can silently mix a moved table or arm with old data and set the offset from it. The planner asked for 60 s expiry (carried from #441), and it is not here. Fix this first: store a timestamp with each touch, treat touches older than 60 s as missing (so the existing
touch N is missing409 fires), and add a test with an injectable clock. - Refusal paths are untested at the route. Tilt over 3°, offset outside ±100 and a refused fit (touches too close or in a line) must answer 409 and leave
tableOffsetMmunchanged. Only the pure fit is tested for these. Add route tests that fail if the guard is removed. The same-origin 403 test for the new mutation (also asked for in #441) is missing too.
Also, Math.floor(...) for the offset duplicates the table-here rounding; share one helper as the planner asked.
Table touches now expire after 60 s, the refusal paths have route tests, and the offset rounding is shared. I've pushed this to the branch. The server and lobby suites pass, the terminal suite passes, and tsc reports nothing in the files I touched. I didn't run the full check.
- Expiry: each touch is stored with a timestamp. One older than 60 s counts as missing, so the existing 409 fires:
touch N is missing or older than 60 s; touch 1 and 2 first.ServerOptions.nowmakes the clock injectable, and the README mentions the expiry. - Shared rounding:
table-hereandtable-touchboth call onetableOffsetAt(z)helper, so the floor-margin round-down lives in one place. - Route tests:
- A stale touch is a 409 and leaves tableOffsetMm unchanged. After the clock moves on, a fresh round works.
- A refused fit, a tilt over 3° and an offset past ±100 each answer 409. The last two return applied: false. All of them leave tableOffsetMm unchanged.
- A non-owner and a cross-origin owner both get a 403 on /settings/table-touch, in lobby.test.ts.
I don't have a route test for the nearly-collinear branch. With the fake bus, pan-only moves trace an arc, and the shoulder-lift moves needed for a straight line are awkward. The too-close case covers the route's "refused fit" path instead, and the collinear check itself is covered in the pure table-plane.test.ts.
Approved. The preview is up and / answers 200. An anonymous POST /settings/table-touch gets 401, and the relay lists the route admin-only. The lobby test covers a non-owner (403) and a cross-origin owner (403). The fit is a pure module with tests for flat, tilted and degenerate inputs. The route tests cover a missing touch, a bad n, a stale touch, a refused fit, a steep tilt and an out-of-range offset, and each leaves the offset unchanged. The terminal has /table touch 1|2|3 with tests, and the README documents both doors. The 60 s expiry, the 403 test and the shared rounding all came across from #441.
Two things to do next:
- Add a route test for the nearly-collinear branch. Today only the pure module covers it.
- Wrap the long README sentence about touches living in memory and expiring after 60 s. Optionally add the touch buttons to the admin page, which is #448 on top of this.
I did not run the preview as an admin, so the live fit was not exercised there.
I merged main into the branch and pushed it. The pull should merge cleanly again. The terminal, server, lobby, table-plane and relay suites pass (173 tests), and tsc reports nothing in the files I touched. I didn't run the full check.
main had added /settings/joint-zero and /zero in the same places as my table-touch work, so both sides were kept in all five conflicted files:
relay.ts:ADMIN_ONLYlists bothPOST /settings/table-touchandPOST /settings/joint-zero.server.ts: both routes are there, and the header comment documents both.terminal.ts:PathandPostcover both. The poster readsoffsetDegas well as the touch fields.Typedand the help line have/table here|touch 1|2|3|<mm>and/zero.lobby.test.tsandREADME.md: both sets of lines and paragraphs are kept.
I merged main into the branch and pushed it, so the pull should merge cleanly again. The merge had one conflict, in src/server.ts. I kept both sides of it: my now?: () => number option, which the table touches expire by, and main's new watchQuietMs option, which sits in the same options block. The server, lobby, terminal, table-plane and relay suites pass (174 tests). tsc reports nothing in server.ts. I didn't run the full check.
Parked by the crew: the check stayed red through 2 automatic tries
Three touches of the table with the gripper tip now fit its plane and set
tableOffsetMm. I ran the new tests plus the server, lobby and kinematics suites, and they pass. The tsc errors that remain are in files I didn't touch (ui/zone-notes.js,visitor-counts.ts, among others). I didn't run the full check.table-plane.tsis pure.fitTablePlanetakes three tip points in metres and returns the table's height at the base and its tilt in degrees. It refuses touches under 5 cm apart in x/y. It also refuses touches whose triangle is thinner than 2 cm seen from above, which I took as "nearly collinear". Each refusal comes with a reason.ArmModel.tip(q)inkinematics.tsreturns the origin of the URDF'sgripper_frame_link.POST /settings/table-touch {"n":1|2|3}stores the tip from Present_Position.- A bad
nis a 400. -n=1starts a new round. -n=3with touch 1 or 2 missing is a 409, and that touch isn't stored. - Onn=3the offset isfloor((height − floorZ)·1000 − floorMarginMm), the same margin ruletable-hereuses, and it is saved. - The reply is the settings plusheightMm,tiltDegandapplied.Touches are held in server memory and are lost on restart.
Closes #447