Public: anyone can read this; the crew can change it.

Migrated from github.com/Trevato/SO-ARM100

The table plane can be set: a tableOffsetMm setting and POST /settings/table-here from the arm's lowest point now #173

Merged opened this

Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.

Merged

The virtual table can now be moved with a tableOffsetMm setting, and POST /settings/table-here sets it from the arm's lowest link. server.test.ts passes except one test, and I couldn't run the type check here.

Notes

shipped merged

opened this

The virtual table can now be moved with a tableOffsetMm setting, and POST /settings/table-here sets it from the arm's lowest link. server.test.ts passes except one test, and I couldn't run the type check here.

Test and check results

  • Failing test: "serves the model, its meshes and the vendored libraries" fails because node_modules is missing. bun install couldn't write to its tempdir in this sandbox, so I didn't investigate further. The forge's check should show whether it passes there.
  • Type check: bun x tsc --noEmit hit the same tempdir error, so it didn't run.
  • Other suites: kinematics.test.ts and relay.test.ts passed. I didn't run the rest of the suite.
  • Test added: it covers a 400 for an out-of-range or non-numeric tableOffsetMm, and checks that the resting pose has no violation after table-here.

What changed

  • Setting: tableOffsetMm lives in src/server.ts next to the other settings. It's validated to -100..100, returns a 400 outside that, and is persisted in settings.json.
  • Floor check: src/kinematics.ts now puts the floor at the model's floor plus the offset plus the floor margin. The status lowestMm and the closest-approach metric are measured from the offset table.
  • Table-here: POST /settings/table-here reads the joint positions and sets the offset to the lowest link's height minus the floor margin, rounded down. That puts the margin line at or below the lowest link, so the resting arm isn't flagged.
  • Admin only: I added the route to ADMIN_ONLY in src/relay.ts. The relay already enforces same-origin for mutations, and the arm server has no auth of its own.

Not done: the 3D viewer still draws the table at the model's own floor, because the issue didn't ask for the viewer to follow the offset.

🤖 Generated with Claude Code

Closes #162

1 earlier comment · 1 event
commented

The virtual table can now be moved with a tableOffsetMm setting, and POST /settings/table-here sets it from the arm's lowest link. server.test.ts passes except one test, and I couldn't run the type check here.

Test and check results

  • Failing test: "serves the model, its meshes and the vendored libraries" fails because node_modules is missing. bun install couldn't write to its tempdir in this sandbox, so I didn't investigate further. The forge's check should show whether it passes there.
  • Type check: bun x tsc --noEmit hit the same tempdir error, so it didn't run.
  • Other suites: kinematics.test.ts and relay.test.ts passed. I didn't run the rest of the suite.
  • Test added: it covers a 400 for an out-of-range or non-numeric tableOffsetMm, and checks that the resting pose has no violation after table-here.

What changed

  • Setting: tableOffsetMm lives in src/server.ts next to the other settings. It's validated to -100..100, returns a 400 outside that, and is persisted in settings.json.
  • Floor check: src/kinematics.ts now puts the floor at the model's floor plus the offset plus the floor margin. The status lowestMm and the closest-approach metric are measured from the offset table.
  • Table-here: POST /settings/table-here reads the joint positions and sets the offset to the lowest link's height minus the floor margin, rounded down. That puts the margin line at or below the lowest link, so the resting arm isn't flagged.
  • Admin only: I added the route to ADMIN_ONLY in src/relay.ts. The relay already enforces same-origin for mutations, and the arm server has no auth of its own.

Not done: the 3D viewer still draws the table at the model's own floor, because the issue didn't ask for the viewer to follow the offset.

🤖 Generated with Claude Code

Changes requested — before the latest push

Fix first: table-here can fail with a confusing 400 and nothing tests the admin gate. Details:

  1. table-here computes the offset from the arm pose and then runs it through validateSettings, which caps it at -100..100. If the arm is raised more than about 100 mm above the model floor, the admin gets "tableOffsetMm must be -100 to 100" from a button that sent no number. Clamp the computed offset, or answer 409 with "lower the arm to the table first" and the lowest height.
  2. The ADMIN_ONLY change in relay.ts has no test. Add one to relay.test.ts showing a non-admin gets 403 on POST /settings/table-here and an admin passes. Without it, deleting that line would break nothing.
  3. No README or API-doc change says how to use the setting. Both doors are also missing: there is no page control and nothing in src/tty.ts for tableOffsetMm or table-here, so a person has no way to reach it except raw curl. Add the page control and the tty command, or open an issue naming where the viewer and terminal get it, and document the endpoint in the README.
  4. The new test only asserts that the resting pose is not flagged. It does not show the offset moves the floor. Add a case where a nonzero tableOffsetMm turns a previously refused move into an allowed one, or the reverse, so it would fail if kinematics ignored tableOffset.
  5. The 3D viewer still draws the table at the model floor, so it disagrees with the enforced plane. The pull says so. File the follow-up issue.

The core change in kinematics.ts and server.ts reads correctly: the offset is optional with a default of 0, it is validated at the boundary, and it is persisted. The status and approach metrics use the same reference as the floor check.

commented

Four of the five review points are fixed. The page control and tty command (point 3) are deferred to follow-up issues instead. server.test.ts and lobby.test.ts pass except one test, which already failed before this round's changes. I didn't run the type check or the other suites.

  • Out-of-range table-here: POST /settings/table-here now answers 409 when the computed offset is past ±100 mm. The message gives the lowest link, its height above the model floor, and says to put the arm near the table first. It no longer reaches validateSettings.
  • Admin gate test: I put it in src/lobby.test.ts, not relay.test.ts. relay.test.ts has no lobby or identity setup, and the existing estop/settings gate test already lives in lobby.test.ts. It shows anonymous gets 401, a non-admin gets 403, and an admin gets 200. Deleting the ADMIN_ONLY entry in src/relay.ts would now fail it.
  • Offset moves the floor: a new server.test.ts case finds a forward lean that is refused with tableOffsetMm at 0. It then sets the offset to -100 and expects the same move to be allowed.
  • README: a new "table plane" paragraph documents tableOffsetMm, POST /settings/table-here and the 409.
  • Page control and tty command: I did not build these, and I disagree that they belong in this pull. src/tty.ts is the chat-room door and has no arm commands, so a tty command needs a design decision. Both are in #178, with the page control and button for the settings panel, and #179 covers the terminal.
  • Viewer table: the 3D viewer still draws the table at the model floor. #179 covers drawing it at the offset plane.

The test that still fails is "serves the model, its meshes and the vendored libraries". bun install couldn't write to its tempdir in this sandbox, so the vendored three.js files are missing.

🤖 Generated with Claude Code

Approved

Does what the issue asks: tableOffsetMm is validated (-100..100, 400 otherwise), persisted, moves the floor in the zone check, status lowestMm and the approach metric. POST /settings/table-here is admin-only in the relay: the preview answers 401 to an anonymous caller, and lobby.test.ts covers 401/403/200. An out-of-range result answers 409 with a message a person can act on. Tests would fail without the change, and the README documents it. No new dependency.

Two things to do next, both already filed: (1) #178, a settings-panel control and button so a person can set the table without curl; (2) #179, the terminal door and drawing the 3D table at the offset plane. Until then the page and terminal cannot reach this setting, which is why it is not yet a full both-doors change; I accepted that because src/tty.ts has no arm commands today and the split follows the direction of small single-pull pieces.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs