Skip to content

Fix the MuJoCo IK fallback in the UR5e examples; add restarts to unseeded solves - #68

Merged
siddhss5 merged 3 commits into
mainfrom
fix/mujoco-ik-fallback
Sep 19, 2026
Merged

siddhss5 merged 3 commits into
mainfrom
fix/mujoco-ik-fallback

Conversation

@siddhss5

@siddhss5 siddhss5 commented Sep 19, 2026 •

Copy link
Copy Markdown
Collaborator

Why

#65: both examples passed the collision checker in MuJoCoIKSolver's joint_limits positional slot, so the differential-IK fallback raised TypeError on its first update. Reproduced as described.

What

  • Examples: each has build_ik_solver(model, data, joints, collision, menagerie, backend) returning (solver, name), with backend in auto (SSIK if installed), ssik, or mujoco, and a --ik flag on main. The fallback passes collision_checker= by keyword; limits come from the model. The SSIK path is unchanged.
  • Second finding, fixed here because the fallback was never runnable before: MuJoCoIKSolver.solve without a seed started from whatever the shared MjData was last left in and converged on only 14 of 30 top-grasp poses (23 of 30 side); with random restarts it converged on 30 and 28. Unseeded solves now try the current state and then restarts (default 3) random configurations within one turn of the limits, returning every distinct converged solution, which also gives the sampler several branches per pose. Seeded solves are unchanged, so projection keeps its seed-nearest behavior.
  • Changelog updated.

Fixes #65.

Test plan

New test_examples_mujoco.py, gated on mujoco and the menagerie but not on ssik, so the non-SSIK path is exercised in an environment where SSIK is installed:

  • forced backend="mujoco" returns a MuJoCoIKSolver with the collision checker attached and solves a nontrivial pose from a seed to 5 mm;

  • backend="auto" returns SSIKSolver when ssik is installed;

  • a bad backend name is rejected;

  • ur5e_mujoco.py --no-viz --ik mujoco runs end to end and reports the MuJoCo solver and a found path;

  • one planning query in tsr_union_demo through the fallback succeeds with a collision-free path.

  • Full suite without the menagerie: 303 passed, 2 skipped (the two menagerie-gated modules). With MUJOCO_MENAGERIE_PATH: the 7 UR5e SSIK integration tests and the 5 fallback tests pass (12 passed, about 25 s). Ruff clean.

🤖 Generated with Claude Code

…eded solves

Both examples passed the collision checker in MuJoCoIKSolver's
joint_limits positional slot, so the differential-IK fallback raised
TypeError on its first update. Each example now selects its backend
through build_ik_solver(model, data, joints, collision, menagerie,
backend) with a --ik {auto,ssik,mujoco} flag, and constructs the
fallback with collision_checker= by keyword.

Exercising the fallback for the first time showed a second problem:
MuJoCoIKSolver.solve without a seed started from whatever the shared
MjData was last left in and converged on about half of reachable
grasp poses, so TSR goal sampling through the fallback found no roots.
Unseeded solves now try the current state and then
(default 3) random initial configurations within one turn of the
limits, returning every distinct converged solution; seeded solves are
unchanged so projection keeps its seed-nearest semantics.

Tests (tests/test_examples_mujoco.py, needs mujoco and the menagerie
but not ssik): the forced fallback solves a nontrivial pose from a
seed; auto prefers SSIK when installed; a bad backend name is
rejected; ur5e_mujoco.py --no-viz --ik mujoco runs end to end; one
planning query in tsr_union_demo through the fallback succeeds.

Fixes #65.
@siddhss5
siddhss5 merged commit ff4541f into main Sep 19, 2026
4 checks passed
@siddhss5
siddhss5 deleted the fix/mujoco-ik-fallback branch September 19, 2026 21:47
@siddhss5

Copy link
Copy Markdown
Collaborator Author

Post-merge audit confirmed that #65 and #66 are fixed, then found two follow-ups associated with the expanded restart path and the combined real-model test gate:

  • Make MuJoCo IK restarts topology-aware and reproducible #69: make MuJoCo IK restarts topology-aware and reproducible. The current blanket intersection with [-pi, pi] raises ValueError: high - low < 0 for a valid finite interval such as [4, 5], applies a revolute heuristic to prismatic joints, and is not seeded by the examples' --seed option.
  • Make the SSIK and MuJoCo integration tests isolation-safe #70: remove order dependence from the SSIK/MuJoCo tests. test_ssik_backend.py reloads the production backend and changes the SSIKSolver class identity cached by the example modules. The focused modules pass independently, while the combined Menagerie run gives 35 passed and 1 failed at the exact-type assertion.

The original regressions remain green independently: the forced MuJoCo fallback module passes 5 tests and the transform-ownership module passes 24 tests.

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.

Fix the MuJoCo IK fallback in the UR5e examples

1 participant