mujoco icon indicating copy to clipboard operation
mujoco copied to clipboard

Intermittent box-box contact with positive contact margin

Open jjyyxx opened this issue 1 year ago • 2 comments

Intro

Hi!

I am a graduate student at HKU, I use MuJoCo for my research on robotic manipulation.

My setup

MuJoCo 3.3.0, Python and C, Linux

What's happening? What did you expect?

When setting box geom with positive margin (nativeccd on by default, multiccd off), the box-box contact becomes intermittent under certain settings. The model below is reduced from more legitimate use cases. In this simple setting, it is necessary to have quat="1 0 1e-6 0" or larger to avoid perfectly aligned boxes, to see the intermittent contact. When margin is set to zero, the behavior disappears.

Steps for reproduction

  • Setting the actuator to 1e-7 to make two geoms contact. Turn on the contact point/force rendering to visualize.

Minimal model for reproduction

<mujoco>
  <compiler angle="radian" />

  <worldbody>
    <body name="1" quat="1 0 1e-6 0">
      <geom type="box" size="0.007 0.007 0.01" pos="0 0 0.05" condim="1" />
    </body>
    <body name="2" pos="0 0.02 0">
      <joint name="2" axis="1 0 0" />
      <geom type="box" size="0.007 0.007 0.01" pos="0 0 0.06" condim="1" margin="0.0005" />
    </body>
  </worldbody>

  <actuator>
    <motor name="2" joint="2" ctrlrange="0 1e-7" />
  </actuator>
</mujoco>

Code required for reproduction

Confirmations

jjyyxx avatar Mar 05 '25 16:03 jjyyxx

Presumably I can close #2472?

yuvaltassa avatar Mar 05 '25 18:03 yuvaltassa

Clearly something to do with margin. This is not a very highly used feature so there may be some latent bugs. This is indeed interesting and worth a look. Thanks.

yuvaltassa avatar Mar 05 '25 18:03 yuvaltassa