Files
Mujoco_WASM/test/testdata/flex.xml
T
Alessio Quaglino 7cdf180641 Introduce trilinear flex parametrization.
These flexes use only 24 DOFs (3 per vertex of the bounding box), while colliding with the full high resolution mesh.

On an 8x8x8 cube, the performance using DOFs at all vertices is

```
 Simulation time      : 18.74 s
 Steps per second     : 533
 Realtime factor      : 0.53 x
 Time per step        : 1874.4 µs

 Contacts per step    : 114.88
 Constraints per step : 3322.51
 Degrees of freedom   : 1536
```

With the new implementation, it is the following:

```
 Simulation time      : 1.82 s
 Steps per second     : 5507
 Realtime factor      : 5.51 x
 Time per step        : 181.6 µs

 Contacts per step    : 38.84
 Constraints per step : 155.36
 Degrees of freedom   : 24
```

PiperOrigin-RevId: 721008829
Change-Id: I833df027527db578d86667cc4b24295bcf6f7d22
2025-01-29 09:38:22 -08:00

56 lines
2.2 KiB
XML

<mujoco model="flex">
<option timestep="0.01" integrator="implicitfast"/>
<asset>
<texture type="skybox" builtin="gradient" rgb1=".3 .5 .7" rgb2="0 0 0" width="512" height="512"/>
<texture name="grid" type="2d" builtin="checker" width="512" height="512" rgb1=".1 .2 .3" rgb2=".2 .3 .4"/>
<material name="grid" texture="grid" texrepeat="1 1" texuniform="true" reflectance=".2"/>
</asset>
<visual>
<scale contactwidth="20" contactheight="10" jointlength="30" jointwidth="1"/>
<map force="0.1" zfar="30"/>
<rgba haze="0.15 0.25 0.35 1"/>
<quality shadowsize="4096"/>
<global offwidth="800" offheight="800"/>
</visual>
<worldbody>
<geom name="floor" size="5 5 .05" type="plane" material="grid" condim="3"/>
<light specular="0 0 0" pos="0 0 2" dir="0 0 -1"/>
<body pos="0 0 1">
<freejoint/>
<geom type="capsule" size="0.05 0.03" rgba=".6 .6 .6 1"/>
</body>
<body name="sphere" pos="0 0 0.8">
<inertial pos="0 0 0" mass="1" diaginertia="0.01 0.01 0.01"/>
<freejoint/>
<flexcomp name="f1" type="ellipsoid" rgba=".8 .2 .2 1" radius="0.001" count="4 4 4"
spacing=".025 .025 .025" dim="3" mass="1" dof="radial">
<edge equality="true" solref="0.15 0.2" stiffness="0" damping="0"/>
</flexcomp>
</body>
<flexcomp name="f2" type="grid" rgba="1 1 0 1" radius="0.003" dim="2" pos="0 0 .1"
zaxis="0 0 1" count="6 6 1" mass="1" spacing="0.02 0.03 0.04" material="grid">
<edge equality="true" solref="0.15 0.2" stiffness="0" damping="0"/>
<pin id="0"/>
</flexcomp>
<flexcomp name="f3" type="grid" rgba=".6 .5 .1 1" radius="0.003" dim="3" pos="0 0 .3"
zaxis="1 1 1" count="3 3 3" mass="1" spacing="0.02 0.03 0.04">
<edge equality="true" solref="0.15 0.2" stiffness="0" damping="0"/>
</flexcomp>
<flexcomp type="grid" count="8 8 8" spacing=".007 .007 .007" pos="0 0 1.5" dim="3"
radius=".0001" rgba="0 .7 .7 1" mass=".25" name="softbody" dof="trilinear">
<elasticity young="1e4" poisson="0.1" damping="0.01"/>
<contact selfcollide="none" internal="false"/>
</flexcomp>
</worldbody>
</mujoco>