mujoco icon indicating copy to clipboard operation
mujoco copied to clipboard

How to get the contact point(s) and contact force(s) between two composite bodies

Open Ekanshh opened this issue 2 years ago • 0 comments

Hi,

I am using robosuite for a project, which internally use mujoco as the physics engine.

I'm looking for some help on: How to get the contact point and contact force between two composite bodies of type box with geometry type capsule?

With the following model, the contact points are only visible for solid-composite body interaction, and not for composite-composite body interaction. Due to this, I am not able to get the contact force between two composite bodies. I have raised a similar issue in robosuite at here

Here is a model which explains my question:

Model XML
<mujoco model="stacked_composite_objects">
  <asset>
    <texture file="../textures/light-wood.png" type="2d" name="wood-tex"/>
    <material name="wood-material" reflectance="0.5" texrepeat="1 1" texture="wood-tex"/>
  </asset>
  <worldbody>
    <body>
        <!--base-->
        <body name="bottom_wall" pos="0. 0. 0." quat="0. 0. 0.707 0.707">
          <inertial pos="0. 0. 0" quat="0. 0. 0.707 0.707" mass="2.43455" diaginertia="0.0913751 0.0521615 0.043714"/>
          <geom size="0.24 0.01 0.15" type="box" friction="1 1 1" group="0"/>
        </body>
        <!--bottom object-->
        <body name="object_1" pos="0. 0. 0.075" quat="0.5 0.5 -0.5 -0.5">
          <composite prefix="T1" type="box" count="6 4 4" spacing="0.05" solrefsmooth="-1324.17 -17.59">
            <geom type="capsule" size="0.0075 0.025" rgba=".8 .2 .1 1" mass="0.001" friction="0.01 0.005 0.0001" contype="0" group="0"/>
            <skin material="wood-material" texcoord="true"/>
          </composite>
        </body> 
        <!--top object-->
        <body name="object_4" pos="0. 0. 0.22" quat="0.5 0.5 -0.5 -0.5">
          <composite prefix="T4" type="box" count="6 4 4" spacing="0.05" solrefsmooth="-1324.17 -17.59">
            <geom type="capsule" size="0.0075 0.025" rgba=".8 .2 .1 1" mass="0.001" friction="0.01 0.005 0.0001" contype="0" group="0"/>
            <skin material="wood-material" texcoord="true"/>
          </composite>
        </body>
        <!--robosuite specific-->
        <site rgba="0 0 0 0" size="0.005" pos="0 0 -0.05" name="bottom_site"/>
        <site rgba="0 0 0 0" size="0.005" pos="0 0 0.05" name="top_site"/>
        <site rgba="0 0 0 0" size="0.005" pos="0.2 0.2 0" name="horizontal_radius_site"/>
    </body>
  </worldbody>
</mujoco> 

Here is a screenshot, illustrating my question:

Simulate Model XML with ./mujoco210/bin/simulate: image

Visualize contact points: image

Close look at the contact points with solid base and bottom composite object in-contact with solid base plate: image

No contact points between two composite bodies: image

Ekanshh avatar Aug 12 '22 19:08 Ekanshh