google-deepmind / mujoco

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

Error converting URDF file in Mojoco #1767

Closed Akanksha0401 closed 1 month ago

Akanksha0401 commented 3 months ago

Dear Colleagues,

I was having trouble in converting the URDF file of Single Leg Hopper in mujoco , I tried adding

<mujoco> 
     <compiler meshdir="C:\Users\Akanksha Mishra\Downloads\mujoco-3.1.6-windows-x86_64\model\meshes" balanceinertia="true"  discardvisual="false" />
    <worldbody>
    <light pos=".4 -.4 .3" dir="-2 2 -1.5" diffuse=".6 .6 .6"/>
    <light pos="-.2 -.4 .3" dir="1 2 -1.5" diffuse=".6 .6 .6"/>
    <geom type="plane" size=".5 .5 .01"/>
    <body name="ball" pos="0 0 0.05">
      <freejoint/>
      <geom size=".03"/>
    </body>
    <body name="hammer" pos="-.05 0 0.18">
      <joint axis="0 1 0"/>
      <geom type="capsule" size=".01" fromto="0 0 0 -.15 0 0"/>
      <geom type="box" size=".02 .02 .03" pos="-.15 0 0"/>
    </body>
  </worldbody>
    </mujoco>

but when it gets open in Mujoco, the object (robotic leg as given below) falls immediately.

My XML file looks somewhat like this-

<?xml version="1.0" ?>
<robot name="hopper">
<mujoco> 
     <compiler meshdir="C:\Users\Akanksha Mishra\Downloads\mujoco-3.1.6-windows-x86_64\model\meshes" balanceinertia="true"  discardvisual="false" />
    <worldbody>
    <light pos=".4 -.4 .3" dir="-2 2 -1.5" diffuse=".6 .6 .6"/>
    <light pos="-.2 -.4 .3" dir="1 2 -1.5" diffuse=".6 .6 .6"/>
    <geom type="plane" size=".5 .5 .01"/>
    <body name="ball" pos="0 0 0.05">
      <freejoint/>
      <geom size=".03"/>
    </body>
    <body name="hammer" pos="-.05 0 0.18">
      <joint axis="0 1 0"/>
      <geom type="capsule" size=".01" fromto="0 0 0 -.15 0 0"/>
      <geom type="box" size=".02 .02 .03" pos="-.15 0 0"/>
    </body>
  </worldbody>
    </mujoco>
  <link name="world"/>
  <joint name="fixed" type="fixed">

Please guide , what could be a possible solution. image image

yuvaltassa commented 3 months ago

There is not enough information in this issue for us to help you. From a cursory look it seems like "hammer" is supposed to be a child of "ball"?

kevinzakka commented 1 month ago

Marking as closed due to inactivity.