Add SAM3 perception and persistent placed-box obstacles to hangar_sim ML Move Boxes#746
Draft
griswaldbrooks wants to merge 3 commits into
Draft
Add SAM3 perception and persistent placed-box obstacles to hangar_sim ML Move Boxes#746griswaldbrooks wants to merge 3 commits into
griswaldbrooks wants to merge 3 commits into
Conversation
Replace the CLIPSeg text-query + SAM2 point-refine perception chain with SAM3 (GetMasks2DFromExemplar), which produces high-quality per-detection masks directly from a text prompt. Restructure the outer loop to a drain-aware Fallback so it exits SUCCESS when the scene is cleared and surfaces real pick errors as FAILURE (fixes the #19112 infinite loop). Adds an area-based SAM3 mask false-positive filter, discards noisy box-yaw from grasps with max_ik_solutions=16, and ships a calibrate_sam3_mask_areas diagnostic Objective. Carries forward the #732 grasp-cup offset and the SetupMTCSetCollisionRule migration from main.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
|
After each box is released at the loading zone, add a persistent collision object at the world-frame place_pose (dropped to floor height) under a unique id (placed_box_N), so the whole-body base+arm planner avoids every already-placed box on later picks instead of driving over them (#19973). ResetPlanningSceneObjects at objective start clears boxes from a previous run; a placed_count counter (ported across perception passes) keeps the ids unique. The obstacle is placed from place_pose, not the ICP target_pose: target_pose is base-relative but stamped world, so using it (with attach/detach) dropped the obstacles ~10 m off the robot. place_pose is built world-frame by the parent Objective, so the obstacle lands where the box was actually placed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fad7d97 to
47b1269
Compare
|
bccd327 to
68e8c2a
Compare
|
|
Lift each grasped box ~10 cm (Cartesian, grasp_link -Z) before transiting so it clears the surface and does not drag along the ground. Tune the pick for speed and consistency: drop num_orientation_samples 20->8 and max_ik_solutions 16->8 (fewer candidates, the pose IK is the bottleneck), and bias the redundant base yaw via cost_joint_names/cost_joint_weights so MTC selects the lowest-base-yaw grasp IK and the omni-base stops pirouetting between picks. The cost_joint_names/cost_joint_weights ports require the SetupMTCBatchPoseIK support added in moveit_pro#20073 and the pose_ik seed-distance config from moveit_pro_example_ws#736; this objective therefore overlaps #736's pirouette work and is not standalone-mergeable to main until those land. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
68e8c2a to
0eecc95
Compare
|
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.
[written by AI]
Migrates the hangar_sim ML Move Boxes to Loading Zone Objective to SAM3 perception and makes the base stop driving over boxes it has already placed. Two self-contained commits.
Problem
RetryUntilSuccessful+ForceFailure) never terminated cleanly and could spin forever (#19112).Approach
Commit 1 — SAM3 perception. Replace
GetMasks2DFromTextQuery(CLIPSeg) +GetMasks2DFromPointQuery(SAM2) withGetMasks2DFromExemplar(SAM3), which produces high-quality per-detection masks directly from a text prompt — no point-refine step. Restructure the loop into a drain-awareFallback { RepeatUnlessFailureEachTick + ScriptCondition }that exits SUCCESS when the scene is cleared and surfaces real pick errors as FAILURE (the #19112 fix). Adds aFilterMasks2DByAreafalse-positive filter, discards noisy box-yaw from grasps (max_ik_solutions=16), and ships acalibrate_sam3_mask_areasdiagnostic Objective for tuning the area thresholds.This commit reconstructs work that was reviewed and merged (PRs #649/#652) onto an integration branch that was never proposed to main. It re-applies the two main-side fixes that postdate that branch's base: the #732 grasp-cup offset (
ee_to_tcp0;0;0→0;0;0.045) and theSetupMTCUpdateGroupCollisionRule→SetupMTCSetCollisionRulemigration (with the matchingmonitored_stagestring).Commit 2 — persistent placed-box obstacles. After each box is released at the loading zone, a persistent collision object is added at the world-frame
place_pose(dropped to floor height) under a unique id (placed_box_N). The whole-bodymanipulatorgroup includes the planar base joints, so the base plans around every already-placed box; theplaced_box_*ids are not in the SRDF disable list.ResetPlanningSceneObjectsat objective start clears boxes from a previous run; aplaced_countcounter (ported across perception passes) keeps the ids unique.The obstacle is placed from
place_pose, not the ICPtarget_pose:target_poseis base-relative but stampedworld, so placing the mesh there (and carrying it via attach/detach) dropped the obstacles ~10 m off the robot.place_poseis built world-frame by the parent Objective, so the obstacle lands where the box was actually placed. This drops the carried-box (in-transit) avoidance the earlier attach approach intended — acceptable, since the base-drives-over-placed-boxes symptom is the #19973 concern and the carried box moves with the robot.Commit 3 — post-grasp lift + pick tuning. Each grasped box is lifted ~10 cm straight up (
PlanCartesianPathalonggrasp_link-Z) before transiting, so it clears the surface and does not drag along the ground. The pick is tuned for speed and consistency:num_orientation_samples= 8 andmax_ik_solutions= 8 (fewer candidates — the pose IK is the bottleneck), andcost_joint_names/cost_joint_weightsbias the redundant base yaw so MTC selects the lowest-base-yaw grasp IK and the omni-base stops pirouetting between picks.Carried-box-in-scene — investigated, deferred
Attaching the carried box so the planner accounts for it in-transit was attempted and deferred. Root cause of the difficulty: MTC builds collision checking from in-task
SetupMTCSetCollisionRule, not the live ACM, and the transit is the sharedMove to Pose No PreviewSubTree, so a held box can't be whitelisted without forking that SubTree into an inline MTC task. Compounding it, the hangar boxes are baked into the URDF as 16 staticcollision_Cube_*links, so an attached box overlaps its own static duplicate. Left as a follow-up; the placed-box obstacles already deliver the #19973 base-avoidance.Relationship to other work
fix/19112-ml-move-boxes-sam3(never PR'd to main; main still ran CLIPSeg+SAM2).Verification
Run live on the SAM3 backend: the combined objective picks boxes via SAM3, and the placed-box obstacles land on the floor in the loading-zone line exactly at the place poses (
(-4.50, 8.40, 0.10),(-4.90, 8.40, 0.10), …), tracking where each box was placed; the tree loads with no port/behavior errors.Release notes
None.