Add Jdot correction for connect and weld constaints

Measured reduction in constraint violations before/after this change:

| Model | Correction ON (Avg Viol) | Correction OFF (Avg Viol) | Reduction |
| :--- | :--- | :--- | :--- |
| `jdotv_connect_2d.xml` | 3.959e-4 | 1.699e-3 | **76.7%** |
| `jdotv_connect_3d.xml` | 1.399e-3 | 5.493e-3 | **74.5%** |
| `jdotv_weld_3d.xml` | 9.472e-3 | 1.148e-2 | **17.5%** |

PiperOrigin-RevId: 899137525
Change-Id: Ic3e33764ebd64239bab916289c23d80c3da0b51b
This commit is contained in:
Yuval Tassa
2026-04-13 12:47:17 -07:00
committed by Copybara-Service
parent 0c337799bd
commit 412cee2059
13 changed files with 481 additions and 43 deletions
@@ -0,0 +1,29 @@
<mujoco>
<option>
<flag contact="disable"/>
</option>
<worldbody>
<light pos="0 -1 1"/>
<!-- body 1: pendulum on world hinge, horizontal pointing right -->
<body name="upper" pos="0 0 1">
<joint name="hinge1" type="hinge" axis="0 1 0"/>
<geom type="capsule" size="0.03" fromto="0 0 0 0.5 0 0"/>
<site name="tip1" pos="0.5 0 0"/>
</body>
<!-- body 2: planar free body (slide x, slide z, hinge y) -->
<body name="lower" pos="0.5 0 1" euler="0 -90 0">
<joint type="slide" axis="1 0 0"/>
<joint type="slide" axis="0 0 1"/>
<joint type="hinge" axis="0 1 0"/>
<geom type="capsule" size="0.04" fromto="0 0 0 0.4 0 0"/>
<site name="tip2" pos="0 0 0"/>
</body>
</worldbody>
<equality>
<connect body1="upper" body2="lower" anchor="0.5 0 0"/>
</equality>
</mujoco>
@@ -0,0 +1,29 @@
<mujoco>
<option integrator="implicit">
<flag contact="disable"/>
</option>
<worldbody>
<light pos="0 -1 1"/>
<!-- body 1: pendulum on world ball joint, tilted -->
<body name="upper">
<joint type="ball"/>
<geom type="box" size="0.03" fromto="0 0 0 0.5 0 0"/>
<geom type="box" size="0.03" fromto="0.5 0 0 0.5 0.3 0"/>
<site name="tip1" pos="0.5 0.3 0"/>
</body>
<!-- body 2: free body, positioned at tip of upper -->
<body name="lower" pos="0.5 0.3 0">
<freejoint/>
<geom type="box" size="0.04" fromto="0 0 0 0.5 0 0"/>
<geom type="box" size="0.04" fromto="0.5 0 0 0.5 0.3 0"/>
<site name="tip2" pos="0 0 0"/>
</body>
</worldbody>
<equality>
<connect site1="tip1" site2="tip2"/>
</equality>
</mujoco>
+29
View File
@@ -0,0 +1,29 @@
<mujoco>
<option integrator="implicit">
<flag contact="disable"/>
</option>
<worldbody>
<light pos="0 -1 1"/>
<!-- body 1: pendulum on world ball joint, tilted -->
<body name="upper">
<joint type="ball"/>
<geom type="box" size="0.03" fromto="0 0 0 0.5 0 0"/>
<geom type="box" size="0.03" fromto="0.5 0 0 0.5 0.3 0"/>
<site name="tip1" pos="0.5 0.3 0"/>
</body>
<!-- body 2: free body, positioned at tip of upper -->
<body name="lower" pos="0.5 0.3 0">
<freejoint/>
<geom type="box" size="0.04" fromto="0 0 0 0.5 0 0"/>
<geom type="box" size="0.04" fromto="0.5 0 0 0.5 0.3 0"/>
<site name="tip2" pos="0 0 0"/>
</body>
</worldbody>
<equality>
<weld site1="tip1" site2="tip2" solimp="0 0.96 0.01" torquescale="0.1"/>
</equality>
</mujoco>