Add mjData.dof_islandind, indexing from dofs into islands.

Also fix bug in allocation for constraint islands, added allocation for limit constraints.

PiperOrigin-RevId: 561083128
Change-Id: I9e01d5a5b7454ec3cf60bccadaa0f96f2c0d87d1
This commit is contained in:
Yuval Tassa
2023-08-29 11:05:41 -07:00
committed by Copybara-Service
parent daa2ac7f8b
commit d3ed16e78f
9 changed files with 127 additions and 4 deletions
+53
View File
@@ -0,0 +1,53 @@
<!--
test model for constraint islanding:
- one equality
- one limit
- one friction
- one unconstrained dof
- two islands, one with non-contiguous dofs
-->
<mujoco>
<option>
<flag island="enable"/>
</option>
<default>
<geom size=".1"/>
</default>
<worldbody>
<body>
<joint type="slide" axis="0 0 1" range="0 1" limited="true"/>
<geom/>
</body>
<body pos=".25 0 0">
<joint type="slide" axis="1 0 0"/>
<geom/>
</body>
<body pos="0 0 0.25">
<joint type="slide" axis="0 0 1"/>
<geom/>
<body pos="0 -.15 0">
<joint name="hinge1" axis="0 1 0"/>
<geom type="capsule" size="0.03" fromto="0 0 0 -.2 0 0"/>
<body pos="-.2 0 0">
<joint axis="0 1 0"/>
<geom type="capsule" size="0.03" fromto="0 0 0 -.2 0 0"/>
</body>
</body>
</body>
<body pos="-.5 0 0">
<joint axis="0 1 0" frictionloss=".01"/>
<geom type="capsule" size="0.03" fromto="0 0 0 -.2 0 0"/>
</body>
<body pos="0 0 .5">
<joint name="hinge2" axis="0 1 0"/>
<geom type="box" size=".08 .02 .08"/>
</body>
</worldbody>
<equality>
<joint joint1="hinge1" joint2="hinge2"/>
</equality>
</mujoco>