From d6cb6ececb4f6b5ea3e9136b2593517609e4e0f6 Mon Sep 17 00:00:00 2001 From: Dan Wahl Date: Sun, 26 Jul 2026 09:32:57 -0500 Subject: [PATCH] fix(sim): migrate suction margin/gap for MuJoCo 3.9 contact semantics MuJoCo 3.9 redesigned contact margin/gap. Detection moved from `dist < margin` to `dist < margin + gap`, and force generation from `dist < margin - gap` to `dist < margin`. All five suction sites here use margin == gap, the idiom for "detect early but only apply force on true contact". Under the new semantics that same markup generates force from a full margin away, so the cups push parts off before touching them. Measured with margin = gap = 0.02: on 3.6 a 15 mm separation is detected with no force, on 3.10 it is force-generating. Applies the upstream migration, margin_new = margin_old - gap_old, which is 0 at every site since margin equals gap. This is the same markup upstream migrated its own adhesion demo to. Ordering: this markup only behaves correctly on MuJoCo 3.10 or newer. Under 3.6 it reads as detection at 0 and force at -gap, so the cups stop sensing parts until they interpenetrate. Merge this only once moveit_pro ships the 3.10 bump, which also carries the widen_body_margin_for_gap change that restores detection on multi-geom bodies. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_012DpJinnRQknbm62X7GCveK --- src/factory_sim/description/inspection_tool.xml | 2 +- src/factory_sim/description/suction_tool.xml | 4 ++-- src/hangar_sim/description/vacuum.xml | 2 +- .../mujoco_assets/lrmate200id/lrmate200id.xml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/factory_sim/description/inspection_tool.xml b/src/factory_sim/description/inspection_tool.xml index 7e3b1cd2b..63b69778b 100644 --- a/src/factory_sim/description/inspection_tool.xml +++ b/src/factory_sim/description/inspection_tool.xml @@ -21,7 +21,7 @@ type="cylinder" size="0.01 0.015" pos="0 0 0.015" - margin="0.01" + margin="0" gap="0.01" rgba="0 0 1 1" /> diff --git a/src/factory_sim/description/suction_tool.xml b/src/factory_sim/description/suction_tool.xml index 04b27afe3..54e720566 100644 --- a/src/factory_sim/description/suction_tool.xml +++ b/src/factory_sim/description/suction_tool.xml @@ -21,7 +21,7 @@ type="cylinder" size="0.01 0.03" pos="0 0 0.03" - margin="0.01" + margin="0" gap="0.01" rgba=".1 .1 .1 1" /> @@ -30,7 +30,7 @@ class="collision" type="cylinder" size="0.01 0.005" - margin="0.01" + margin="0" gap="0.01" /> diff --git a/src/hangar_sim/description/vacuum.xml b/src/hangar_sim/description/vacuum.xml index 002a60d6b..339b111cc 100644 --- a/src/hangar_sim/description/vacuum.xml +++ b/src/hangar_sim/description/vacuum.xml @@ -36,7 +36,7 @@ type="mesh" name="collision_vacuum_suction_cups geom" mesh="collision_vacuum_suction_cups" - margin="0.02" + margin="0" gap="0.02" /> diff --git a/src/picknik_accessories/mujoco_assets/lrmate200id/lrmate200id.xml b/src/picknik_accessories/mujoco_assets/lrmate200id/lrmate200id.xml index 1416ee702..98ff7a9a9 100644 --- a/src/picknik_accessories/mujoco_assets/lrmate200id/lrmate200id.xml +++ b/src/picknik_accessories/mujoco_assets/lrmate200id/lrmate200id.xml @@ -90,7 +90,7 @@ type="box" size="0.01 0.01 0.001" pos="0 0 -0.001" - margin="0.02" + margin="0" gap="0.02" />