<mujoco model="humanoid_CMU">

  <include file="./common/skybox.xml"/>
  <include file="./common/visual.xml"/>
  <include file="./common/materials.xml"/>

  <statistic extent="2" center="0 0 1"/>

  <default class="main">
    <joint limited="true" solimplimit="0 0.99 0.01" stiffness="0.1" armature=".01" damping="1"/>
    <geom friction="0.7" solref="0.015 1" solimp="0.95 0.99 0.003"/>
    <motor ctrllimited="true" ctrlrange="-1 1"/>
    <default class="humanoid">
      <geom type="capsule" material="self"/>
      <default class="stiff_low">
        <joint stiffness=".5" damping="4"/>
      </default>
      <default class="stiff_medium">
        <joint stiffness="10" damping="5"/>
      </default>
      <default class="stiff_high">
        <joint stiffness="30" damping="10"/>
      </default>
      <default class="touch">
        <site group="3" rgba="0 0 1 .5"/>
      </default>
    </default>
  </default>

  <worldbody>
    <geom name="floor" type="plane" conaffinity="1" size="100 100 .2" material="grid"/>
    <light name="tracking_light" pos="0 0 7" dir="0 0 -1" mode="trackcom"/>
    <camera name="back" pos="0 3 2.4" xyaxes="-1 0 0 0 -1 2" mode="trackcom"/>
    <camera name="side" pos="-3 0 2.4" xyaxes="0 -1 0 1 0 2" mode="trackcom"/>
    <body name="root" childclass="humanoid" pos="0 0 1" euler="90 0 0">
      <site name="root" size=".01" rgba="0.5 0.5 0.5 0"/>
      <freejoint name="root"/>
      <geom name="root_geom" size="0.09 0.06" pos="0 -0.05 0" quat="1 0 -1 0"/>
      <body name="lhipjoint">
        <geom name="lhipjoint" size="0.008 0.022" pos="0.051 -0.046 0.025" quat="0.5708 -0.566602 -0.594264 0"/>
        <body name="lfemur" pos="0.102 -0.092 0.05" quat="1 0 0 0.17365">
          <joint name="lfemurrz" axis="0 0 1" range="-60 70" class="stiff_medium"/>
          <joint name="lfemurry" axis="0 1 0" range="-70 70" class="stiff_medium"/>
          <joint name="lfemurrx" axis="1 0 0" range="-160 20" class="stiff_medium"/>
          <geom name="lfemur" size="0.06 0.17" pos="-.01 -0.202473 0" quat="0.7 -0.7 -0.1228 -0.07"/>
          <body name="ltibia" pos="0 -0.404945 0">
            <joint name="ltibiarx" axis="1 0 0" range="1   170" class="stiff_low"/>
            <geom name="ltibia" size="0.03 0.1825614" pos="0 -0.202846 0" quat="0.7 -0.7 -0.1228 -0.1228"/>
            <geom name="lcalf" size="0.045 0.08" pos="0 -0.1 -.01" quat="0.7 -0.7 -0.1228 -0.1228"/>
            <body name="lfoot" pos="0 -0.405693 0" quat="0.707107 -0.707107 0 0">
              <site name="lfoot_touch" type="box" pos="-.005 -.02 -0.025" size=".04 .08 .02" euler="10 0 0" class="touch"/>
              <joint name="lfootrz" axis="0 0 1" range="-70 20" class="stiff_medium"/>
              <joint name="lfootrx" axis="1 0 0" range="-45    90" class="stiff_medium"/>
              <geom name="lfoot0" size="0.02 0.06" pos="-0.02 -0.023 -0.01" euler="100 -2 0"/>
              <geom name="lfoot1" size="0.02 0.06" pos="0 -0.023 -0.01" euler="100 0 0"/>
              <geom name="lfoot2" size="0.02 0.06" pos=".01 -0.023 -0.01" euler="100 10 0"/>
              <body name="ltoes" pos="0 -0.106372 -0.0227756">
                <joint name="ltoesrx" axis="1 0 0" range="-90 20"/>
                <geom name="ltoes0" type="sphere" size="0.02" pos="-.025 -0.01 -.01"/>
                <geom name="ltoes1" type="sphere" size="0.02" pos="0 -0.005 -.01"/>
                <geom name="ltoes2" type="sphere" size="0.02" pos=".02 .001 -.01"/>
                <site name="ltoes_touch" type="capsule" pos="-.005 -.005 -.01" size="0.025 0.02" zaxis="1 .2 0" class="touch"/>
              </body>
            </body>
          </body>
        </body>
      </body>
      <body name="rhipjoint">
        <geom name="rhipjoint" size="0.008 0.022" pos="-0.051 -0.046 0.025" quat="0.574856 -0.547594 0.608014 0"/>
        <body name="rfemur" pos="-0.102 -0.092 0.05" quat="1 0 0 -0.17365">
          <joint name="rfemurrz" axis="0 0 1" range="-70 60" class="stiff_medium"/>
          <joint name="rfemurry" axis="0 1 0" range="-70 70" class="stiff_medium"/>
          <joint name="rfemurrx" axis="1 0 0" range="-160 20" class="stiff_medium"/>
          <geom name="rfemur" size="0.06 0.17" pos=".01 -0.202473 0" quat="0.7 -0.7 0.1228 0.07"/>
          <body name="rtibia" pos="0 -0.404945 0">
            <joint name="rtibiarx" axis="1 0 0" range="1   170" class="stiff_low"/>
            <geom name="rtibia" size="0.03 0.1825614" pos="0 -0.202846 0" quat="0.7 -0.7 0.1228 0.1228"/>
            <geom name="rcalf" size="0.045 0.08" pos="0 -0.1 -.01" quat="0.7 -0.7 -0.1228 -0.1228"/>
            <body name="rfoot" pos="0 -0.405693 0" quat="0.707107 -0.707107 0 0">
              <site name="rfoot_touch" type="box" pos=".005 -.02 -0.025" size=".04 .08 .02" euler="10 0 0" class="touch"/>
              <joint name="rfootrz" axis="0 0 1" range="-20 70" class="stiff_medium"/>
              <joint name="rfootrx" axis="1 0 0" range="-45    90" class="stiff_medium"/>
              <geom name="rfoot0" size="0.02 0.06" pos="0.02 -0.023 -0.01" euler="100 2 0"/>
              <geom name="rfoot1" size="0.02 0.06" pos="0 -0.023 -0.01" euler="100 0 0"/>
              <geom name="rfoot2" size="0.02 0.06" pos="-.01 -0.023 -0.01" euler="100 -10 0"/>
              <body name="rtoes" pos="0 -0.106372 -0.0227756">
                <joint name="rtoesrx" axis="1 0 0" range="-90 20"/>
                <geom name="rtoes0" type="sphere" size="0.02" pos=".025 -0.01 -.01"/>
                <geom name="rtoes1" type="sphere" size="0.02" pos="0 -0.005 -.01"/>
                <geom name="rtoes2" type="sphere" size="0.02" pos="-.02 .001 -.01"/>
                <site name="rtoes_touch" type="capsule" pos=".005 -.005 -.01" size="0.025 0.02" zaxis="1 -.2 0" class="touch"/>
              </body>
            </body>
          </body>
        </body>
      </body>
      <body name="lowerback">
        <joint name="lowerbackrz" axis="0 0 1" range="-30 30" class="stiff_high"/>
        <joint name="lowerbackry" axis="0 1 0" range="-30 30" class="stiff_high"/>
        <joint name="lowerbackrx" axis="1 0 0" range="-20 45" class="stiff_high"/>
        <geom name="lowerback" size="0.065 0.055" pos="0 0.056 .03" quat="1 0 1 0"/>
        <body name="upperback" pos="0 0.1 -0.01">
          <joint name="upperbackrz" axis="0 0 1" range="-30 30" class="stiff_high"/>
          <joint name="upperbackry" axis="0 1 0" range="-30 30" class="stiff_high"/>
          <joint name="upperbackrx" axis="1 0 0" range="-20 45" class="stiff_high"/>
          <geom name="upperback" size="0.06 0.06" pos="0 0.06 0.02" quat="1 0 1 0"/>
          <body name="thorax" pos="0.000512528 0.11356 0.000936821">
            <joint name="thoraxrz" axis="0 0 1" range="-30 30" class="stiff_high"/>
            <joint name="thoraxry" axis="0 1 0" range="-30 30" class="stiff_high"/>
            <joint name="thoraxrx" axis="1 0 0" range="-20 45" class="stiff_high"/>
            <geom name="thorax" size="0.08 0.07" pos="0 0.05 0" quat="1 0 1 0"/>
            <body name="lowerneck" pos="0 0.113945 0.00468037">
              <joint name="lowerneckrz" axis="0 0 1" range="-30 30" class="stiff_medium"/>
              <joint name="lowerneckry" axis="0 1 0" range="-30 30" class="stiff_medium"/>
              <joint name="lowerneckrx" axis="1 0 0" range="-20 45" class="stiff_medium"/>
              <geom name="lowerneck" size="0.08 0.02" pos="0 0.04 -.02" quat="1 1 0 0"/>
              <body name="upperneck" pos="0 0.09 0.01">
                <joint name="upperneckrz" axis="0 0 1" range="-30 30" class="stiff_medium"/>
                <joint name="upperneckry" axis="0 1 0" range="-30 30" class="stiff_medium"/>
                <joint name="upperneckrx" axis="1 0 0" range="-20 45" class="stiff_medium"/>
                <geom name="upperneck" size="0.05 0.03" pos="0 0.05 0" quat=".8 1 0 0"/>
                <body name="head" pos="0 0.09 0">
                  <camera name="egocentric" pos="0 0 0" xyaxes="-1 0 0 0 1 0" fovy="80"/>
                  <joint name="headrz" axis="0 0 1" range="-30 30" class="stiff_medium"/>
                  <joint name="headry" axis="0 1 0" range="-30 30" class="stiff_medium"/>
                  <joint name="headrx" axis="1 0 0" range="-20 45" class="stiff_medium"/>
                  <geom name="head" size="0.085 0.035" pos="0 0.11 0.03" quat="1 .9 0 0"/>
                  <geom name="leye" type="sphere" size="0.02" pos=" .03 0.11 0.1"/>
                  <geom name="reye" type="sphere" size="0.02" pos="-.03 0.11 0.1"/>
                </body>
              </body>
            </body>
            <body name="lclavicle" pos="0 0.113945 0.00468037">
              <joint name="lclaviclerz" axis="0 0 1" range="0 20" class="stiff_high"/>
              <joint name="lclaviclery" axis="0 1 0" range="-20 10" class="stiff_high"/>
              <geom name="lclavicle" size="0.08 0.04" pos="0.09 0.05 -.01" quat="1 0 -1 -.4"/>
              <body name="lhumerus" pos="0.183 0.076 0.01" quat="0.18 0.68 -0.68 0.18">
                <joint name="lhumerusrz" axis="0 0 1" range="-90 90" class="stiff_low"/>
                <joint name="lhumerusry" axis="0 1 0" range="-90 90" class="stiff_low"/>
                <joint name="lhumerusrx" axis="1 0 0" range="-60 90" class="stiff_low"/>
                <geom name="lhumerus" size="0.035 0.124" pos="0 -0.138 0" quat="0.612 -0.612 0.35 0.35"/>
                <body name="lradius" pos="0 -0.277 0">
                  <joint name="lradiusrx" axis="1 0 0" range="-10 170" class="stiff_low"/>
                  <geom name="lradius" size="0.03 0.06" pos="0 -0.08 0" quat="0.612 -0.612 0.35 0.35"/>
                  <body name="lwrist" pos="0 -0.17 0" quat="-0.5 0 0.866 0">
                    <joint name="lwristry" axis="0 1 0" range="-180 0"/>
                    <geom name="lwrist" size="0.025 0.03" pos="0 -0.02 0" quat="0 0 -1 -1"/>
                    <body name="lhand" pos="0 -0.08 0">
                      <joint name="lhandrz" axis="0 0 1" range="-45 45"/>
                      <joint name="lhandrx" axis="1 0 0" range="-90 90"/>
                      <geom name="lhand" type="ellipsoid" size=".048 0.02 0.06" pos="0 -0.047 0" quat="0 0 -1 -1"/>
                      <body name="lfingers" pos="0 -0.08 0">
                        <joint name="lfingersrx" axis="1 0 0" range="0 90"/>
                        <geom name="lfinger0" size="0.01 0.04" pos="-.03 -0.05 0" quat="1 -1 0 0" />
                        <geom name="lfinger1" size="0.01 0.04" pos="-.008 -0.06 0" quat="1 -1 0 0" />
                        <geom name="lfinger2" size="0.009 0.04" pos=".014 -0.06 0" quat="1 -1 0 0" />
                        <geom name="lfinger3" size="0.008 0.04" pos=".032 -0.05 0" quat="1 -1 0 0" />
                      </body>
                      <body name="lthumb" pos="-.02 -.03 0" quat="0.92388 0 0 -0.382683">
                        <joint name="lthumbrz" axis="0 0 1" range="-45 45"/>
                        <joint name="lthumbrx" axis="1 0 0" range="0 90"/>
                        <geom name="lthumb" size="0.012 0.04" pos="0 -0.06 0" quat="0 0 -1 -1"/>
                      </body>
                    </body>
                  </body>
                </body>
              </body>
            </body>
            <body name="rclavicle" pos="0 0.113945 0.00468037">
              <joint name="rclaviclerz" axis="0 0 1" range="-20 0" class="stiff_high"/>
              <joint name="rclaviclery" axis="0 1 0" range="-10 20" class="stiff_high"/>
              <geom name="rclavicle" size="0.08 0.04" pos="-.09 0.05 -.01" quat="1 0 -1 .4"/>
              <body name="rhumerus" pos="-0.183 0.076 0.01" quat="0.18 0.68 0.68 -0.18">
                <joint name="rhumerusrz" axis="0 0 1" range="-90 90" class="stiff_low"/>
                <joint name="rhumerusry" axis="0 1 0" range="-90 90" class="stiff_low"/>
                <joint name="rhumerusrx" axis="1 0 0" range="-60 90" class="stiff_low"/>
                <geom name="rhumerus" size="0.035 0.124" pos="0 -0.138 0" quat="0.61 -0.61 -0.35 -0.35"/>
                <body name="rradius" pos="0 -0.277 0">
                  <joint name="rradiusrx" axis="1 0 0" range="-10 170" class="stiff_low"/>
                  <geom name="rradius" size="0.03 0.06" pos="0 -0.08 0" quat="0.612 -0.612 -0.35 -0.35"/>
                  <body name="rwrist" pos="0 -0.17 0" quat="-0.5 0 -0.866 0">
                    <joint name="rwristry" axis="0 1 0" range="-180 0"/>
                    <geom name="rwrist" size="0.025 0.03" pos="0 -0.02 0" quat="0 0 1 1"/>
                    <body name="rhand" pos="0 -0.08 0">
                      <joint name="rhandrz" axis="0 0 1" range="-45 45"/>
                      <joint name="rhandrx" axis="1 0 0" range="-90 90"/>
                      <geom name="rhand" type="ellipsoid" size=".048 0.02 .06" pos="0 -0.047 0" quat="0 0 1 1"/>
                      <body name="rfingers" pos="0 -0.08 0">
                        <joint name="rfingersrx" axis="1 0 0" range="0 90"/>
                        <geom name="rfinger0" size="0.01 0.04" pos=".03 -0.05 0" quat="1 -1  0 0" />
                        <geom name="rfinger1" size="0.01 0.04" pos=".008 -0.06 0" quat="1 -1  0 0" />
                        <geom name="rfinger2" size="0.009 0.04" pos="-.014 -0.06 0" quat="1 -1  0 0" />
                        <geom name="rfinger3" size="0.008 0.04" pos="-.032 -0.05 0" quat="1 -1  0 0" />
                      </body>
                      <body name="rthumb" pos=".02 -.03 0" quat="0.92388 0 0 0.382683">
                        <joint name="rthumbrz" axis="0 0 1" range="-45    45"/>
                        <joint name="rthumbrx" axis="1 0 0" range="0 90"/>
                        <geom name="rthumb" size="0.012 0.04" pos="0 -0.06 0" quat="0 0 1 1"/>
                      </body>
                    </body>
                  </body>
                </body>
              </body>
            </body>
          </body>
        </body>
      </body>
    </body>
  </worldbody>

  <contact>
    <exclude body1="lclavicle" body2="rclavicle"/>
    <exclude body1="lowerneck" body2="lclavicle"/>
    <exclude body1="lowerneck" body2="rclavicle"/>
    <exclude body1="upperneck" body2="lclavicle"/>
    <exclude body1="upperneck" body2="rclavicle"/>
  </contact>

  <actuator>
    <motor name="headrx" joint="headrx" gear="20"/>
    <motor name="headry" joint="headry" gear="20"/>
    <motor name="headrz" joint="headrz" gear="20"/>
    <motor name="lclaviclery" joint="lclaviclery" gear="20"/>
    <motor name="lclaviclerz" joint="lclaviclerz" gear="20"/>
    <motor name="lfemurrx" joint="lfemurrx" gear="120"/>
    <motor name="lfemurry" joint="lfemurry" gear="40"/>
    <motor name="lfemurrz" joint="lfemurrz" gear="40"/>
    <motor name="lfingersrx" joint="lfingersrx" gear="20"/>
    <motor name="lfootrx" joint="lfootrx" gear="20"/>
    <motor name="lfootrz" joint="lfootrz" gear="20"/>
    <motor name="lhandrx" joint="lhandrx" gear="20"/>
    <motor name="lhandrz" joint="lhandrz" gear="20"/>
    <motor name="lhumerusrx" joint="lhumerusrx" gear="40"/>
    <motor name="lhumerusry" joint="lhumerusry" gear="40"/>
    <motor name="lhumerusrz" joint="lhumerusrz" gear="40"/>
    <motor name="lowerbackrx" joint="lowerbackrx" gear="40"/>
    <motor name="lowerbackry" joint="lowerbackry" gear="40"/>
    <motor name="lowerbackrz" joint="lowerbackrz" gear="40"/>
    <motor name="lowerneckrx" joint="lowerneckrx" gear="20"/>
    <motor name="lowerneckry" joint="lowerneckry" gear="20"/>
    <motor name="lowerneckrz" joint="lowerneckrz" gear="20"/>
    <motor name="lradiusrx" joint="lradiusrx" gear="40"/>
    <motor name="lthumbrx" joint="lthumbrx" gear="20"/>
    <motor name="lthumbrz" joint="lthumbrz" gear="20"/>
    <motor name="ltibiarx" joint="ltibiarx" gear="80"/>
    <motor name="ltoesrx" joint="ltoesrx" gear="20"/>
    <motor name="lwristry" joint="lwristry" gear="20"/>
    <motor name="rclaviclery" joint="rclaviclery" gear="20"/>
    <motor name="rclaviclerz" joint="rclaviclerz" gear="20"/>
    <motor name="rfemurrx" joint="rfemurrx" gear="120"/>
    <motor name="rfemurry" joint="rfemurry" gear="40"/>
    <motor name="rfemurrz" joint="rfemurrz" gear="40"/>
    <motor name="rfingersrx" joint="rfingersrx" gear="20"/>
    <motor name="rfootrx" joint="rfootrx" gear="20"/>
    <motor name="rfootrz" joint="rfootrz" gear="20"/>
    <motor name="rhandrx" joint="rhandrx" gear="20"/>
    <motor name="rhandrz" joint="rhandrz" gear="20"/>
    <motor name="rhumerusrx" joint="rhumerusrx" gear="40"/>
    <motor name="rhumerusry" joint="rhumerusry" gear="40"/>
    <motor name="rhumerusrz" joint="rhumerusrz" gear="40"/>
    <motor name="rradiusrx" joint="rradiusrx" gear="40"/>
    <motor name="rthumbrx" joint="rthumbrx" gear="20"/>
    <motor name="rthumbrz" joint="rthumbrz" gear="20"/>
    <motor name="rtibiarx" joint="rtibiarx" gear="80"/>
    <motor name="rtoesrx" joint="rtoesrx" gear="20"/>
    <motor name="rwristry" joint="rwristry" gear="20"/>
    <motor name="thoraxrx" joint="thoraxrx" gear="40"/>
    <motor name="thoraxry" joint="thoraxry" gear="40"/>
    <motor name="thoraxrz" joint="thoraxrz" gear="40"/>
    <motor name="upperbackrx" joint="upperbackrx" gear="40"/>
    <motor name="upperbackry" joint="upperbackry" gear="40"/>
    <motor name="upperbackrz" joint="upperbackrz" gear="40"/>
    <motor name="upperneckrx" joint="upperneckrx" gear="20"/>
    <motor name="upperneckry" joint="upperneckry" gear="20"/>
    <motor name="upperneckrz" joint="upperneckrz" gear="20"/>
  </actuator>

  <sensor>
    <subtreelinvel name="thorax_subtreelinvel" body="thorax"/>
    <velocimeter name="sensor_root_veloc" site="root"/>
    <gyro name="sensor_root_gyro" site="root"/>
    <accelerometer name="sensor_root_accel" site="root"/>
    <touch name="sensor_touch_ltoes" site="ltoes_touch"/>
    <touch name="sensor_touch_rtoes" site="rtoes_touch"/>
    <touch name="sensor_touch_rfoot" site="rfoot_touch"/>
    <touch name="sensor_touch_lfoot" site="lfoot_touch"/>
  </sensor>

</mujoco>
