google-deepmind / mujoco

Multi-Joint dynamics with Contact. A general purpose physics simulator.
https://mujoco.org
Apache License 2.0
7.47k stars 734 forks source link

Change in composite geometry semantics between 3.1.4 and 3.1.5 #1732

Closed benureau closed 1 week ago

benureau commented 1 week ago

The geometry obtained using composite objects seems to change between version 3.1.4 and 3.1.5 of MuJoCo.

Here is somewhat minimal example:

<mujoco model="torobo">

  <option cone="elliptic" impratio="10"/>
  <option>
    <flag multiccd="enable"/>
  </option>

  <asset>
    <texture name="texplane" type="2d" builtin="checker" rgb1=".2 .3 .4" rgb2=".1 0.15 0.2"
      width="512" height="512" mark="cross" markrgb=".8 .8 .8"/>

    <material name="matplane" reflectance="0.3" texture="texplane" texrepeat="1 1" texuniform="true"/>
  </asset>

  <worldbody>
    <light directional="true" diffuse=".4 .4 .4" specular="0.1 0.1 0.1" pos="0 0 5.0" dir="0 0 -1" castshadow="false"/>
    <light directional="true" diffuse=".6 .6 .6" specular="0.2 0.2 0.2" pos="0 0 4" dir="0 0 -1"/>
`
    <!-- soft red cube -->
    <body name="object" pos="0.0 0.0 1.0">
      <freejoint/>
      <composite type="box" count="5 5 5" spacing="0.2" offset="0 0 0" solrefsmooth="0.02 0.1">
        <!-- <skin rgba="1 0 0 0.30" inflate="0"/> -->
        <geom type="sphere" size="0.1" rgba=".8 .2 .1 0.2"/>
      </composite>
      <site name="cylinder_center"   pos="0 0 0" type="box" rgba="0 0 0 1" size="0.01 0.01 0.01"/>
    </body>

    <geom name="ground" type="plane" size="0 0 1" pos="0 0 0" quat="1 0 0 0" material="matplane" condim="1"/>

  </worldbody>

</mujoco>

Dropped in the MuJoCo.app 3.1.4 on macOS (Ventura 13.6.7), we get:

Screenshot 2024-06-12 at 21 27 45

The site at the center (small grey box) is in the center of the grid.

Dropped in the MuJoCo.app 3.1.5, we have:

Screenshot 2024-06-12 at 21 33 29

The site is not at the center anymore. If we activate the skins, the cube appears to be floating.

The issue is not fixed in 3.1.6.