Help to an illustration

Discussion in 'Modeling' started by lin, Feb 15, 2018.

  1. lin

    lin

    I'm a newbie to mujoco, and not clear about how to write MJCF file, even if I have read the docs several times.

    I'm using a off-the-shelf xml file to do some tasks, but I want to know how this xml works.
    Code:
    <mujoco model="ant">
      <compiler inertiafromgeom="true" angle="degree" coordinate="local" />
      <option timestep="0.02" integrator="RK4" />
      <custom>
        <numeric name="init_qpos" data="0.0 0.0 0.55 1.0 0.0 0.0 0.0 0.0 1.0 0.0 -1.0 0.0 -1.0 0.0 1.0" />
      </custom>
      <default>
        <joint limited="true" armature="1" damping="1" />
        <geom condim="3" conaffinity="0" margin="0.01" friction="1 0.5 0.5" solref=".02 1" solimp=".8 .8 .01" rgba="0.8 0.6 0.4 1" density="5.0" />
      </default>
      <asset>
        <texture type="skybox" builtin="gradient" width="100" height="100" rgb1="1 1 1" rgb2="0 0 0" />
        <texture name="texgeom" type="cube" builtin="flat" mark="cross" width="127" height="1278" rgb1="0.8 0.6 0.4" rgb2="0.8 0.6 0.4" markrgb="1 1 1" random="0.01" />
        <texture name="texplane" type="2d" builtin="checker" rgb1="0.1 0.2 0.3" rgb2="1 1 1" width="100" height="100" />
        <material name='MatPlane' texture="texplane" shininess="1" texrepeat="60 60" specular="1"  reflectance="0.5" />
        <material name='geom' texture="texgeom" texuniform="true" />
      </asset>
      <worldbody>
        <light directional="true" cutoff="100" exponent="1" diffuse="1 1 1" specular=".1 .1 .1" pos="0 0 1.3" dir="-0 0 -1.3" />
        <geom name='floor' material="MatPlane" pos='0 0 0' size='40 40 40' type='plane' conaffinity='1' rgba='0.8 0.9 0.8 1' condim='3' />
        <body name="torso" pos="0 0 0.75">
          <geom name="torso_geom" type="sphere" size="0.25" pos="0 0 0" />
          <joint name="root" type="free" limited="false" pos="0 0 0" axis="0 0 1" margin="0.01" armature="0" damping="0" />
          <body name="front_left_leg" pos="0 0 0">
            <geom name="aux_1_geom" type="capsule" size="0.08" fromto="0.0 0.0 0.0 0.2 0.0 0.0" />
            <body name="aux_1" pos="0.2 0 0">
              <joint name="hip_1" type="hinge" pos="0.0 0.0 0.0" axis="0 0 1" range="-30 30" />
              <geom name="left_leg_geom" type="capsule" size="0.08" fromto="0.0 0.0 0.0 0.2 0.0 0.0" />
              <body pos="0.2 0 0">
                <joint name="ankle_1" type="hinge" pos="0.0 0.0 0.0" axis="-1 1 0" range="30 70" />
                <geom name="left_ankle_geom" type="capsule" size="0.08" fromto="0.0 0.0 0.0 0.4 0.0 0.0" />
              </body>
            </body>
          </body>
        </body>
      </worldbody>
    </mujoco>
    
    I have the following two doubts:
    1) the function of the geom named "aux_1_geom", is it not correct if we only define "left_leg_geom";
    2) the reason why the "torso" has a leg-shaped body when rendering. I see that the last body have a "capsule " geom from "0 0 0" to "0.4 0 0", and I think it just lengthens the body "aux_1".

    I'd appreciate it if anyone can help me!