<!-- Cheetah Model
    The state space is populated with joints in the order that they are
    defined in this file. The actuators also operate on joints.
    State-Space (name/joint/parameter):
        - rootx     slider      position (m)
        - rootz     slider      position (m)
        - rooty     hinge       angle (rad)
        - rbthigh    hinge       angle (rad)
        - rbshin     hinge       angle (rad)
        - rbfoot     hinge       angle (rad)
        - fthigh    hinge       angle (rad)
        - fshin     hinge       angle (rad)
        - ffoot     hinge       angle (rad)
        - rootx     slider      velocity (m/s)
        - rootz     slider      velocity (m/s)
        - rooty     hinge       angular velocity (rad/s)
        - rbthigh    hinge       angular velocity (rad/s)
        - rbshin     hinge       angular velocity (rad/s)
        - rbfoot     hinge       angular velocity (rad/s)
        - fthigh    hinge       angular velocity (rad/s)
        - fshin     hinge       angular velocity (rad/s)
        - ffoot     hinge       angular velocity (rad/s)
    Actuators (name/actuator/parameter):
        - rbthigh    hinge       torque (N m)
        - rbshin     hinge       torque (N m)
        - rbfoot     hinge       torque (N m)
        - fthigh    hinge       torque (N m)
        - fshin     hinge       torque (N m)
        - ffoot     hinge       torque (N m)
-->
<mujoco model="quadrupedrobot">
  <!-- coordinate="local" settotalmass="14" coordinate="local" -->
  <compiler angle="radian"  inertiafromgeom="true"  />
  <default>
    <!-- <joint armature=".1" damping=".01" limited="true" 
          solimplimit=".8 .8 .03" solreflimit=".02 1" stiffness="8"/> -->
    <!-- <geom conaffinity="1" condim="1" contype="1" friction=".1 .01 .1" 
          rgba="0.8 0.6 .4 1" solimp="0.8 0.8 0.01" solref="0.02 1"/> -->
     <!-- <geom conaffinity="0" condim="1" density="5.0" friction="0.5 0.5 0.5" 
          margin="0.001" rgba="0.8 0.6 0.4 1"/> -->
    <joint limited='true' damping='1' armature='0'/>
    <geom contype='1' conaffinity='1' condim='1' rgba='0.8 0.6 .4 1'
          margin="0.001" solref=".02 1" solimp=".8 .8 .01" material="geom"/>
    <motor ctrllimited="true" ctrlrange="-1 1"/>
  </default>
  <size nstack="300000" nuser_geom="1"/>
  <option gravity="0 0 -9.81" timestep="0.01"
          tolerance="1e-10" solver="Newton" jacobian="dense" cone="elliptic"/>
  <!-- <option timestep='0.002' iterations="50" tolerance="1e-10" solver="Newton" jacobian="dense" cone="elliptic"/> -->
  <visual>
      <map fogstart="3" fogend="5" force="0.1" znear="0.5"/>
      <quality shadowsize="2048" offsamples="8"/>
      <global offwidth="800" offheight="800"/>
  </visual>
  <asset>
    <texture builtin="gradient" height="100" rgb1="1 1 1" rgb2="0 0 0" type="skybox" width="100"/>
    <texture builtin="flat" height="1278" mark="cross" markrgb="1 1 1" name="texgeom" random="0.01" 
              rgb1="0.8 0.6 0.4" rgb2="0.8 0.6 0.4" type="cube" width="127"/>
    <texture builtin="checker" height="100" name="texplane" rgb1=".2 .3 .4" rgb2=".1 0.15 0.2" type="2d" width="100"/>
    <material name="MatPlane" reflectance="0.5" shininess="1" specular="1" texrepeat="60 60" texture="texplane"/>
    <material name="geom" texture="texgeom" texuniform="true"/>
  </asset>
  <worldbody>
    <light cutoff="100" diffuse="1 1 1" dir="-0 0 -1.3" directional="true" exponent="1" pos="0 0 1.3" specular=".1 .1 .1"/>
    <geom conaffinity="1" condim="3" material="MatPlane" name="floor" pos="0 0 0" rgba="0.8 0.9 0.8 1" size="40 40 40" type="plane"/>
    <body name="torso" pos="0 0 .7">
      <camera name="track" mode="trackcom" pos="0 -5 2" xyaxes="1 0 0 0 0.25 1"/>
      <!-- <joint armature="0" axis="1 0 0" damping="0" limited="false" name="rootx" pos="0 0 0" stiffness="0" type="hinge"/>
      <joint armature="0" axis="0 0 1" damping="0" limited="false" name="rootz" pos="0 0 0" stiffness="0" type="hinge"/>
      <joint armature="0" axis="0 1 0" damping="0" limited="false" name="rooty" pos="0 0 0" stiffness="0" type="hinge"/> -->
      <freejoint name="root"/>
      <geom fromto="-.25 .25 0 .5 .25 0" name="torso" size="0.125 " type="capsule"/>
      <geom axisangle="0 1 0 .87" name="head" pos=".6 .25 .1" size="0.046 .15" type="capsule"/>
      <!-- <geom name="neck" size="0.1 " pos=".7 .25 .2" type="sphere"/> -->
      
      <!-- <site name='tip'  pos='.15 0 .11'/>-->
      <body name="lbthigh" pos="-.25 .4 0">
        <joint name="lbthigh_y" type="hinge" axis="0 1 0" damping="6" pos="0 0 0" range="-.52 1.05" stiffness="240"  armature="0.02"  />
        <joint name="lbthigh_x" type="hinge" axis="1 0 0" damping="6" pos="0 0 0" range="-0.2 0.2" stiffness="240"  armature="0.02"  />
        <geom axisangle="0 1 0 -3.8" name="lbthigh" pos=".1 0 -.13" size="0.046 .145" type="capsule"/>
        <body name="lbshin" pos=".16 0 -.25">
          <joint  name="lbshin" type="hinge"  axis="0 1 0" damping="4.5" pos="0 0 0" range="-.785 .785" stiffness="180" armature="0.02"/>
          <geom axisangle="0 1 0 -2.03" name="lbshin" pos="-.14 0 -.07" rgba="0.9 0.6 0.6 1" size="0.046 .15" type="capsule"/>
          <body name="lbfoot" pos="-.28 0 -.14">
            <joint name="lbfoot" type="hinge" axis="0 1 0" damping="3" pos="0 0 0" range="-.4 .785" stiffness="120" armature="0.02"/>
            <geom axisangle="0 1 0 -.27" name="lbfoot" pos=".03 0 -.097" rgba="0.9 0.6 0.6 1" size="0.046 .094" type="capsule"/>
          </body>
        </body>
      </body>
      <body name="rbthigh" pos="-.25 .1 0">
        <joint name="rbthigh_y" type="hinge" axis="0 1 0" damping="6" pos="0 0 0" range="-.52 1.05" stiffness="240" armature="0.02"/>
        <joint name="rbthigh_x" type="hinge" axis="1 0 0" damping="6" pos="0 0 0" range="-0.2 0.2" stiffness="240"   armature="0.02"  />
        <geom axisangle="0 1 0 -3.8" name="rbthigh" pos=".1 0 -.13" size="0.046 .145" type="capsule"/>
        <body name="rbshin" pos=".16 0 -.25">
          <joint axis="0 1 0" damping="4.5" name="rbshin" pos="0 0 0" range="-.785 .785" stiffness="180" type="hinge"  armature="0.02"/>
          <geom axisangle="0 1 0 -2.03" name="rbshin" pos="-.14 0 -.07" rgba="0.9 0.6 0.6 1" size="0.046 .15" type="capsule"/>
          <body name="rbfoot" pos="-.28 0 -.14">
            <joint axis="0 1 0" damping="3" name="rbfoot" pos="0 0 0" range="-.4 .785" stiffness="120" type="hinge"  armature="0.02"/>
            <geom axisangle="0 1 0 -.27" name="rbfoot" pos=".03 0 -.097" rgba="0.9 0.6 0.6 1" size="0.046 .094" type="capsule"/>
          </body>
        </body>
      </body>
      <body name="lfthigh" pos=".5 .4 0">
          <joint name="lfthigh_y" type="hinge" axis="0 1 0" damping="4.5" pos="0 0 0" range="-1 .7" stiffness="180"  armature="0.02"/>
          <joint name="lfthigh_x" type="hinge" axis="1 0 0" damping="6" pos="0 0 0" range="-0.2 0.2" stiffness="240"   armature="0.02"  />
        
          <geom axisangle="0 1 0 .52" name="lfthigh" pos="-.07 0 -.12" size="0.046 .133" type="capsule"/>
          <body name="lfshin" pos="-.14 0 -.24">
              <joint type="hinge"  name="lfshin" axis="0 1 0" damping="3" pos="0 0 0" range="-1.2 .87" stiffness="120"  armature="0.02"/>
              <geom axisangle="0 1 0 -.6" name="lfshin" pos=".065 0 -.09" rgba="0.9 0.6 0.6 1" size="0.046 .106" type="capsule" />
              <body name="lffoot" pos=".13 0 -.18">
                  <joint type="hinge"  name="lffoot" axis="0 1 0" damping="1.5" pos="0 0 0" range="-.5 .5" stiffness="60"  armature="0.02"/>
                  <geom axisangle="0 1 0 -.6" name="lffoot" pos=".045 0 -.07" rgba="0.9 0.6 0.6 1" size="0.046 .07" type="capsule"/>
              </body>
          </body>
      </body>
      <body name="rfthigh" pos=".5 .1 0">
        <joint name="rfthigh_y" type="hinge" axis="0 1 0" damping="4.5" pos="0 0 0" range="-1 .7" stiffness="180"  armature="0.02"/>
        <joint name="rfthigh_x" type="hinge" axis="1 0 0" damping="6" pos="0 0 0" range="-0.2 0.2" stiffness="240"   armature="0.02"  />
        
        <geom axisangle="0 1 0 .52" name="fthigh" pos="-.07 0 -.12" size="0.046 .133" type="capsule"/>
        <body name="rfshin" pos="-.14 0 -.24">
          <joint name="rfshin" type="hinge" axis="0 1 0" damping="3"  pos="0 0 0" range="-1.2 .87" stiffness="120"  armature="0.02"/>
          <geom axisangle="0 1 0 -.6" name="rfshin" pos=".065 0 -.09" rgba="0.9 0.6 0.6 1" size="0.046 .106" type="capsule"/>
          <body name="rffoot" pos=".13 0 -.18">
            <joint name="rffoot" type="hinge" axis="0 1 0" damping="1.5"  pos="0 0 0" range="-.5 .5" stiffness="60" armature="0.02"/>
            <geom axisangle="0 1 0 -.6" name="rffoot" pos=".045 0 -.07" rgba="0.9 0.6 0.6 1" size="0.046 .07" type="capsule"/>
          </body>
        </body>
      </body>
    </body>
  </worldbody>
  <actuator>
    
    <motor gear="120" joint="lbthigh_y" name="lbthigh_y"/>
    <motor gear="120" joint="lbthigh_x" name="lbthigh_x"/>
    <motor gear="90" joint="lbshin" name="lbshin"/>
    <motor gear="60" joint="lbfoot" name="lbfoot"/>
    
    <motor gear="120" joint="rbthigh_y" name="rbthigh_y"/>
    <motor gear="120" joint="rbthigh_x" name="rbthigh_x"/>
    <motor gear="90" joint="rbshin" name="rbshin"/>
    <motor gear="60" joint="rbfoot" name="rbfoot"/>

    <motor gear="120" joint="lfthigh_y" name="lfthigh_y"/>
    <motor gear="120" joint="lfthigh_x" name="lfthigh_x"/>
    <motor gear="60" joint="lfshin" name="lfshin"/>
    <motor gear="30" joint="lffoot" name="lffoot"/> 

    <motor gear="120" joint="rfthigh_y" name="rfthigh_y"/>
    <motor gear="120" joint="rfthigh_x" name="rfthigh_x"/>
    <motor gear="60" joint="rfshin" name="rfshin"/>
    <motor gear="30" joint="rffoot" name="rffoot"/>

  </actuator>
</mujoco>