Repository navigation
Fix prismatic IK folding and harden joint-travel grasp ranking - #1324
Merged
Merged
Conversation
Two choices could send an arm through a large joint swing for a pose it could reach directly: - PytorchSolver "nearest" selection folds every multi-start candidate into [-pi, pi] before measuring its distance to the seed. On a joint whose limits allow more than one turn, a candidate just across +-pi then looks almost a turn away, and a flipped-wrist branch can win for nearly the same TCP pose. PytorchSolverCfg.ik_wrap_to_seed compares and returns each candidate at its whole-turn equivalent nearest the seed (nearest the previous waypoint in continuous path selection). - PickUp keeps the first reachable grasp in cache order and picks the half-turn roll variant by TCP rotation error, which cannot tell the two variants apart from an upright start pose. PickUpOptions.prefer_least_joint_motion ranks the first least_motion_candidates reachable grasps, and the roll variant, by IK joint travel from the current arm posture (joint_motion_weights); a fixed_object_to_eef grasp may be replaced by its half-turn twin. HandOverOptions.receive_prefer_least_joint_motion ranks the receiving grasp the same way. All options default off; inactive options are omitted from the Task Program integration identity. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Confidence Score: 5/5
[Medium impact] The PR appears safe to merge; no blocking issues remain. SummaryAdds opt-in choices that reduce joint travel when selecting IK solutions and grasps. Defaults remain unchanged.
Reviews (8) · Last reviewed commit: "docs(atomic-skill): describe the least-m..." · Reviewed by Greptile |
- select_ranked_grasp: rank only the first motion_candidates reachable labels by motion cost; labels kept in a larger pool (check_selection retries, sampling branches) follow them in cache order, and the motion cost is evaluated only for the compared labels. - PickUp fixed-grasp twin comparison: with approach_along_grasp_axis the pre-grasp follows the grasp's TCP +Z (shared by the twin), as the pickup does, instead of the configured approach direction. Co-Authored-By: Claude Opus 5.5 <[email protected]>
5 tasks done
yuecideng
reviewed
Dec 2, 2026
yuecideng
left a comment
Contributor
There was a problem hiding this comment.
Reviewed 6d27d39 with focused CPU checks. The inline findings cover the remaining solver, grasp planning, and configuration issues.
yuecideng
reviewed
Dec 2, 2026
matafela
reviewed
Dec 3, 2026
…osture - prefer_least_joint_motion no longer drops reachable sampled grasps beyond least_motion_candidates: the shortlist is ranked by joint travel ahead of them, and the rest keep their geometric cost order (as on the validated-label path), so other sampling branches can still take them. - With initial_lift_height, grasp, roll-variant and fixed-twin ranking seed the pre-grasp IK at the clearance waypoint and measure travel from there (plus the lift itself), as the execution moves. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main already carries the first two commits of this branch through the squash merge of #1325, so each conflicted file takes main's version and only the last commit of this branch (post-lift travel origin, unranked grasps kept) is reapplied on top. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…toff The shortlist mixed joint travel with a fixed 1e7 cost for the other reachable grasps, so large joint_motion_weights could push a compared grasp behind an uncompared one. Reachable grasps now get their position in the lexicographic order (shortlist with finite travel, rest of the shortlist, other reachable; then travel; then geometric order) as cost, which does not depend on the travel's scale. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Move the whole-turn rule into compute.kinematics.nearest_periodic_equivalents and apply it through BaseSolver.nearest_periodic_equivalents with the chain's joint types, so prismatic joints are never shifted. - Make PytorchSolverCfg.ik_wrap_to_seed keyword-only to keep the positional order of the seed-selection fields. - Rank least-motion label groups by an explicit order (shortlist by travel, then the rest; cache rank breaks equal travel) in the shared selection. - Reuse the joint travel of the reachability screening in the sampled and validated PickUp paths and in the HandOver receiver instead of solving the same pre-grasp and grasp IK again. - Plan the authored fixed grasp where its half-turn twin's trajectory fails. - Reject prefer_least_joint_motion under workspace_joint screening, which only covers the authored fixed grasp. - Accept an empty joint_motion_weights list in configured skill options. Co-Authored-By: Claude Opus 5.5 <[email protected]>
_qpos_map_to_limits shifted every joint by whole turns of 2*pi, so a prismatic solution above pi (x = +3.5 m within [-4, 4] m) came back as x = -2.78 m with success, with or without ik_wrap_to_seed. Only revolute joints are now shifted; a CPU IK-to-FK round trip covers the case. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d twin fallback Co-Authored-By: Claude Opus 5.5 <[email protected]>
yuecideng
approved these changes
Dec 4, 2026
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.
Description
The first two commits of this branch reached main through #1325. They added the opt-in options
PytorchSolverCfg.ik_wrap_to_seed,PickUpOptions.prefer_least_joint_motionandHandOverOptions.receive_prefer_least_joint_motion. Against current main (41610e5e2), this PR fixes the problemsreview found in them, plus one older IK bug that also affects default settings: prismatic joints were folded by
2π. Apart from that IK fix, behaviour and registration identity with the options off are unchanged.
Each item below gives what happens on main, where it comes from, and the fix. The numbers come from one probe
script run on main
41610e5e2and on this branch (CPU).1. Prismatic joints are folded by 2π (also with the options off)
_qpos_map_to_limitsshifts every joint by whole turns of 2π
(L427).
_wrap_candidates_to_referencealso shifts any joint whose range exceeds 2π. On one prismatic joint with
[-4, 4] mlimits and a+3 mseed,both still report success:
x = +3.5 mx = −3.0 mFix: both mappings shift only revolute joints, read from the chain's joint types
(
BaseSolver.get_periodic_joint_mask). The whole-turn rule now lives incompute.kinematics.nearest_periodic_equivalentsand is applied throughBaseSolver.nearest_periodic_equivalents, so other backends can adopt it. Moving the weighted scoring andSolverCfg-level opt-in into the shared layer is left until the next backend adopts the rule.2.
ik_wrap_to_seedshifted the positional arguments ofPytorchSolverCfgThe field sits before the seed-selection fields
(L99).
On main, the positional parameters after
ik_solution_selectionareik_wrap_to_seed, enable_seed_selection, seed_db_size, so an existing positional tail(True, 2048, 0.25)setsenable_seed_selection=2048. The fieldis now keyword-only and the order is back to
enable_seed_selection, seed_db_size, seed_rot_scale.3. Least-motion ranking mixed travel with fixed cost offsets
(L1403-L1416)
drops every reachable grasp beyond
least_motion_candidates, so a second sampling branch can be left withnothing.
(
_grasp_selection.pyL655-L656)gives unscored labels
1e7 + rankand adds1e-6 * rankto the travel of scored ones.With four reachable labels and travel
|x − 0.2|:Fix:
motion_ranked_costsorders reachable candidates in three groups: compared ones with finite travel (bytravel), other compared ones, then the rest. The cache or geometric rank breaks equal travel, and each candidate's
position in this order becomes its cost. Both paths use it, and no reachable grasp is dropped.
4. Travel ignored the initial lift
With
initial_lift_height, execution moves start → clearance waypoint → pre-grasp, but_joint_motion_costseeds the pre-grasp IK at the start
(L1645).
Grasp, roll-variant and fixed-twin ranking now seed and measure from the clearance waypoint, and add the lift's
own travel.
5. Pre-grasp and grasp IK were solved twice
Screening solves pre-grasp and grasp IK, then the travel pass solves them again. This happens in PickUp's sampled
path (L1403-L1416), its validated-label path
(L1598-L1614)
and the HandOver receiver
(L2316-L2361).
With 50 sampled grasps this costs 400 IK targets per environment on main and 300 here. When a least-motion option
is on, screening now returns its own travel:
_select_feasible_grasp_variants(return_travel=True);reachable_path(..., return_joints=True);select_ranked_graspaccepts(reachable, travel)fromfeasible.With the options off, screening is called as before.
6. A failed half-turn twin had no fallback
The fixed grasp's twin is chosen from waypoint IK
(L992),
and only the chosen pose gets a full trajectory
(L1042).
If the planner rejects the twin, the pickup fails even when the authored grasp would plan. Rows whose twin
trajectory fails are now planned with the authored grasp and keep it where that succeeds.
7.
workspace_jointscreened a grasp that might not runThe binding check
screens the authored
fixed_object_to_eef, but withprefer_least_joint_motionthe pick may execute its twin.Binding now rejects that combination.
8.
joint_motion_weights: []was rejected_finite_tuplerejects an empty list (main:
ValueError: options.joint_motion_weights must not be empty), althoughPickUpOptionsaccepts()for all weights 1. The list now decodes to(), and each supplied weight is stillchecked as finite and non-negative.
Docs (compute and solver API pages, built-in skills) and agent context (ik-solvers, atomic-actions,
expansion-engine) are updated.
Type of change
Validation
41610e5e2and on this branch: tables and counts above.keyword-only field;
calling the travel callbacks;
workspace_jointrejection;tests/sim/motion/solvers,tests/sim/atomic_skills,tests/compute/kinematics,tests/lab/expansion,test_configured_integration.py,-m "not sim"): main 2142 passed, this branch 2151 passed (the 9 new). Both have the same 5 failures and 57errors, all simulation tests that cannot start without a GPU (
CUDA_ERROR_NO_DEVICE).black26.10.1,python docs/scripts/check_api_docs.py(5081/5081),context.py check.Checklist
black .command to format the code base.python docs/scripts/check_api_docs.py), if applicable🤖 Generated with Claude Code