Weird behavior when changing margin and gap to large numbers

Discussion in 'Support requests' started by Pedro Morais, Mar 12, 2020.

  1. Hi,

    I'd like to essentially use mujoco's collision detection to record distances between geoms. To do this, I'm setting margin=gap=<large number> for all contacts but the distances I'm seeing in d->contact.dis don't align with what I would expect.

    I've attached an mjcf file which reproduces the behavior. Particularly, note that when joint0 > 0.5 the distance between the geoms is recorded as <0 despite the geoms being visually far apart. When I reduce the value of margin/gap this behavior goes away. Is this expected? Is there a better way to get true distances between geoms?

    Edit: after some investigation it seems like this might only be a problem with cylinder-box contacts too


    Attached Files:

    • test.xml
      File size:
      641 bytes
    Last edited: Mar 14, 2020