Robot arms pass goods from belt to belt; native beam primitive
Deploy web Studio / deploy (push) Successful in 1m3s

- Robot arm (category Industry): picks goods off the end of the nearest conveyor within its reach
  and puts them on the start of another conveyor within reach, or on a pallet a quarter turn on
  (pick / put: auto or a side). One move per item coming in (cycle 0) or a set cycle; waits while
  the line before it stands. The belt it feeds carries its goods at its pace and starts its loop
  when they land (feeds carry a time offset `ph`), so arm and belts stay in step.
- Drawn as a 16-pose flipbook: two-link inverse kinematics per pose, each pose shown for a
  sixteenth of the cycle by a stepped CSS animation (iso-flip; pose 0 alone when unanimated).
  Poses pointing away from the viewer are drawn before the base, the others after it.
- New sprite method beam(a, b, n, w, mat): a square bar between two 3D points, six faces culled
  and shaded like face(). Native, so the factory demo renders in 4.7 ms instead of 18.8 ms.
- Factory demo: a palletiser at the end of the carton line, a loading robot passing drums from the
  incline onto the loading belt into the truck. MCP instructions on robot arms.

Checks: 70 Rust tests (arms and belts in step, waiting arm, beam faces from every side),
Studio 109/109, web 90/90.
This commit is contained in:
grabowski committed 2026-10-24 22:05:46 +07:00
1 parent 18dd324543
commit f49798583e
14 files changed
+460 -31

No files matched your search

+10 -2
View File
@@ -379,11 +379,19 @@ with sync_playwright() as p:
pg.locator('#right input[type="number"][data-prop="rate"]').press("Enter")
pg.wait_for_timeout(900)
check("30 cartons a minute, 1 m apart" in rows().get("Carries", ""), "a faster producer packs the belt closer: " + rows().get("Carries", "?"))
# a robot arm at the belt's end picks the goods off and stacks them on a pallet, one per item
pg.evaluate("__studio.op({op: 'add', type: 'robot_arm', x: 19.2, y: -4.5})")
pg.wait_for_timeout(900)
rid = doc()["objects"][-1]["id"]
rrows = dict(pg.evaluate(f"(__studio.view.info('{rid}') || {{}}).rows || []"))
check(rrows.get("Moves") == f"cartons from {cv['id']} to a pallet" and rrows.get("Cycle") == "2 s" and
pg.evaluate(f"document.querySelectorAll('.iso-svg [data-obj=\"{rid}\"] .iso-flip').length") == 16,
f"a robot arm at the belt's end moves its goods to a pallet in step with them: {rrows}")
pg.screenshot(path=str(OUT / "studio-conveyor.jpg"), type="jpeg", quality=80)
for _ in range(3):
for _ in range(4):
pg.locator("#undo").click()
pg.wait_for_timeout(500)
check(len(doc()["objects"]) == n4, "undo takes the producer and the belt back")
check(len(doc()["objects"]) == n4, "undo takes the robot, the producer and the belt back")
pg.evaluate("__studio.select(null)")
pg.wait_for_timeout(300)
+3
View File
@@ -321,6 +321,9 @@ try:
f"Factory demo opens a production yard ({nf} objects, goods riding {rides} belts, no warnings)")
carries = pg.evaluate("() => Object.fromEntries((__studio.view.info('belt-a3') || {rows: []}).rows)['Carries'] || ''")
check("20 cartons a minute" in carries and "(from belt-a2)" in carries, "goods come down the line: " + carries)
loads = pg.evaluate("() => Object.fromEntries((__studio.view.info('belt-load') || {rows: []}).rows)['Carries'] || ''")
flips = pg.evaluate("() => document.querySelectorAll('.iso-svg .iso-flip').length")
check("(from robot-b)" in loads and flips == 32, f"robot arms pass the goods on ({flips} poses): " + loads)
shot(pg, "web-factory.jpg")
# ---------------------------------------------------------------- folder project (OPFS stands in for a picked folder)