Skip to content

KUKA iiwa14 cell: manipulator showcase with a crossing worker and joint-velocity CBF-QP - #404

Merged
bardhh merged 13 commits into
mainfrom
feat/kuka-cell
Oct 15, 2026
Merged

bardhh merged 13 commits into
mainfrom
feat/kuka-cell

Conversation

@bardhh

@bardhh bardhh commented Oct 15, 2026

Copy link
Copy Markdown
Owner

Summary

A fifth MuJoCo/MJX showcase, this time a fixed-base industrial arm: a KUKA iiwa14 on a pedestal cycles parts from a bin to a conveyor while a worker walks through its sweep. Without the filter the arm strikes the worker; with a CBF-QP on the commanded joint velocities it folds back, holds, and resumes the cycle.

What is in the branch

  • src/cbfkit/systems/mujoco/kuka_cell.py: scene assembled at runtime from the menagerie iiwa14 (pedestal, bin, conveyor, mocap worker mannequin); CellPlant whose input carries the joint-velocity command and the worker pose (the worker is a kinematic MuJoCo body, so the unfiltered strike is a physical contact); 35 sphere–capsule barriers h = dist − r_i − r_j − d0 − τ|v_worker| evaluated through differentiable mjx.kinematics, plus 14 joint-limit barriers; an operational-space pick-and-place nominal whose cycle phase is held while the arm is displaced; the safe controller wired for simulator.execute(plant=...).
  • examples/mujoco/kuka_cell.py (simulate [--unfiltered] → showcase-compatible npz, contact recomputed offline with mj_forward) and examples/mujoco/kuka_cell_render.py (keep-out capsules coloured by barrier value, active sphere–capsule pair, tool trail, HUD, side-by-side, and a --slowmo T0 T1 FACTOR window with frames interpolated from the 50 Hz log).
  • Assets: vendored iiwa14.xml + LICENSE and a checksum manifest; assets.iiwa14_model_dir() fetches the meshes through the existing cache.
  • showcase.apply_showcase_look(spec, floor) factored out of render_model so spec-built scenes share the studio look.
  • README: a fifth row in the MuJoCo section with the clip and a paragraph on the example.
  • Tests: tests/test_mujoco/test_kuka_cell.py, test_kuka_cell_render.py (16 tests, marked slow) and one test each in test_assets.py and test_showcase.py.

Measured (home box, CPU JAX, 10 s runs)

run result
no filter 13 contact steps from 3.22 s, penetration up to 0.18 m
CBF-QP no contact, h_min +0.073 (never negative), relaxation slack ≤ 7 mm, intervention only during the crossing (2.1–5.2 s), cycle resumes

Design notes worth knowing

  • The menagerie iiwa14 actuators are position servos (kp 2000, kv 200); a target of qpos + qdot·dt reaches only ~20 % of the commanded speed, so the servo target is integrated in data.ctrl at the physics rate and clamped to qpos ± 0.15 rad.
  • The link2 shoulder sphere is excluded from the barrier set: it sits 0.2 m from the base axis and cannot retreat from a walker's keep-out.
  • jaxopt OSQP hits its 10 000-iteration cap on this QP once the arm is folded back with several rows active; the example pins get_solver("fast", tol=1e-8, max_iter=48). The CBF rows are relaxable with the generator's default penalty as a feasibility net; the slack is logged and shown in the HUD.
  • The filtered run is simulated on CPU: the 48-iteration interior-point solve crashes cuSolver on the GPU and the scan is launch-bound there anyway.

Verification

  • pytest tests/test_mujoco/test_kuka_cell.py tests/test_mujoco/test_kuka_cell_render.py tests/test_mujoco/test_assets.py tests/test_mujoco/test_showcase.py green locally (macOS, CPU).
  • Both runs and all renders reproduced on the home box with JAX_PLATFORM_NAME=cpu and MUJOCO_GL=egl.

@bardhh
bardhh merged commit 29f887f into main Oct 15, 2026
11 checks passed
@bardhh
bardhh deleted the feat/kuka-cell branch October 15, 2026 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant