Fix the MuJoCo IK fallback in the UR5e examples; add restarts to unseeded solves - #68
Merged
Merged
Conversation
…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.
This was referenced Sep 19, 2026
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:
The original regressions remain green independently: the forced MuJoCo fallback module passes 5 tests and the transform-ownership module passes 24 tests. |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
#65: both examples passed the collision checker in
MuJoCoIKSolver'sjoint_limitspositional slot, so the differential-IK fallback raisedTypeErroron its first update. Reproduced as described.What
build_ik_solver(model, data, joints, collision, menagerie, backend)returning(solver, name), withbackendinauto(SSIK if installed),ssik, ormujoco, and a--ikflag onmain. The fallback passescollision_checker=by keyword; limits come from the model. The SSIK path is unchanged.MuJoCoIKSolver.solvewithout a seed started from whatever the sharedMjDatawas 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 thenrestarts(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.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 aMuJoCoIKSolverwith the collision checker attached and solves a nontrivial pose from a seed to 5 mm;backend="auto"returnsSSIKSolverwhen ssik is installed;a bad backend name is rejected;
ur5e_mujoco.py --no-viz --ik mujocoruns end to end and reports the MuJoCo solver and a found path;one planning query in
tsr_union_demothrough 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