google-deepmind / mujoco

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

about dofs in mujoco #1776

Closed ALitleLight closed 3 months ago

ALitleLight commented 4 months ago

Hi,

I'm a student and I'm trying to use MuJoCo for simulating robot to grab cylinder.

I'm looking for some help with dofs use. when the cylinder's dofs is setted to 6, the cylinder slides on the plane. Here is a model which explains my question:

minimal XML ```XML xml definition: the plane definition: ```

Here is a screenshot / video, illustrating my question:

https://github.com/google-deepmind/mujoco/assets/162142936/f6b6ed54-2f35-4782-b195-a29589e56e53

Balint-H commented 4 months ago

My recommendations:

<mujoco>
  <visual>
    <map force="0.1" zfar="30"/>
    <rgba haze="0.15 0.25 0.35 1"/>
    <global offwidth="2560" offheight="1440" elevation="-20" azimuth="120"/>
  </visual>

  <asset>
    <texture type="skybox" builtin="gradient" rgb1=".3 .5 .7" rgb2="0 0 0" width="32" 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>

  <option><flag multiccd="enable"/></option>

  <worldbody>
    <geom name="floor" size="0 0 .05" type="plane" material="grid" condim="3"/>
    <light name="spotlight" mode="targetbodycom" target="item3" diffuse=".8 .8 .8" specular="0.3 0.3 0.3" pos="0 -6 4" cutoff="30"/>

     <body name="item3" pos="1.738 2.885 0.6829">
      <freejoint/>
      <geom name="item3_geom" type="cylinder" size="0.032 0.015" density="50" solref="0.000002 1" condim="6"/>
    </body>
<body name="shelf" pos="0 3 -0.5" quat="0.5 0.5 -0.5 -0.5">
      <geom type="box" size="0.75 0.03 0.28" pos="-0.035 1.1373 -1.5728" quat="0.707 0 0.707 0" rgba="1 1 1 1"/>
  </body>
  </worldbody>
</mujoco>
Balint-H commented 4 months ago

The XML is not visible, could you share it?

ALitleLight commented 4 months ago

Sorry,the details of this part of the xml are as follows:

minimal XML ```XML ```

the item3 is placed in shelf. I adjust the shelf's box attribute but it works is not good . Here is a video, illustrating my question:

https://github.com/google-deepmind/mujoco/assets/162142936/a62c5d23-cdc9-4d23-8dc1-e6f3fb8ec822

add flag multiccd="enable",the video: https://github.com/google-deepmind/mujoco/assets/162142936/dd0b5e49-ded5-47e7-8393-2de77ad87849

I'm looking forward to your reply to solve my difficults.

Balint-H commented 4 months ago

Set the priority of the item object's geom to a higher value, to ensure its solver parameters are used. Make sure timestep is not too high (I have stable contacts at 0.002 for example). If you don't like the contact point swapping, then you can enable MultiCCD