<mujoco model="hexapod">
  <compiler angle="radian" coordinate="local" inertiafromgeom="true"/>
  <option integrator="RK4" timestep="0.003"/>
  <size nconmax="1000" njmax="2000"/>

  <default>
    <joint armature="0.1" damping="1.0" limited="true"/>
    <geom conaffinity="0" condim="3" density="5.0" friction="1.0 1.0 1.0" margin="0.0001" rgba="0.2 0.2 0.2 0.8"/>
  </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" width="1" height="1" file="white2.png"/>
    <texture name="texhex" type="2d" width="1" height="1" file="white2.png"/>
    <texture name="texleg" type="2d" width="1" height="1" file="white2.png"/>
    <material name="MatPlane" reflectance="0.0" shininess="1" specular="1" texrepeat="14 4" texture="texplane"/>
    <material name="MatHex" reflectance="0.0" shininess="1" specular="1" texrepeat=".6 0.6" texture="texhex"/>
    <material name="MatLeg" reflectance="0.0" shininess="1" specular="1" texrepeat="1 1" texture="texleg"/>
    <material name='geom' texture="texgeom" texuniform="true" />
    <hfield name="hill" file="hybrid.png" size="4 0.6 0.6 0.1"/>
  </asset>

  <worldbody>
    <light cutoff="100" diffuse="0.7 0.7 0.7" dir="0 0 -1.3" directional="true" exponent="1" pos="0 0 0" specular="0.1 0.1 0.1"/>
    <geom name="floor" conaffinity="1" condim="3" material="MatPlane" pos="1.5 0 0" rgba="0.8 0.9 0.8 1" type="hfield" hfield="hill" />
    <!--geom conaffinity="1" condim="3" material="MatPlane" name="floor" pos="0 0 0" rgba="0.8 0.9 0.8 1" size="4 4 1" type="plane" /-->
    <body name="torso" pos="0 0 0.35">
      <camera name="track" mode="track" pos="-2 -0.5 0.5" xyaxes="0.4 -1 0 0 0 1"/>
      <geom name="torso_geom" pos="0 0 -0.015" size="0.14 0.07 0.04" mass="1.4" type="ellipsoid" material="MatHex"/>
      <joint armature="0" damping="0" limited="false" margin="0.01" name="root" pos="0 0 0" type="free"/>

      <body name="front_left_leg" pos="0.12 0.06 0">
        <joint axis="0 0 1" name="coxa_fl" pos="0.0 0.0 0.0" range="-0.3 0.3" type="hinge"/>
          <geom fromto="0.0 0.0 0.0 0.03676 0.03676 0.0" name="coxa_fl_geom" size="0.015" mass="0.015" type="capsule" material="MatLeg"/>
          <body pos="0.03676 0.03676 0">
            <joint axis="-1 1 0" name="femur_fl" pos="0.0 0.0 0.0" range="-1.6 0.0" type="hinge"/>
            <geom fromto="0.0 0.0 0.0 0.0466 0.0466 0.0" name="femur_fl_geom" size="0.015" mass="0.07" type="capsule" material="MatLeg"/>
             <body pos="0.0466 0.0466 -0.015">
                <joint axis="-1 1 0" name="tibia_fl" pos="0.0 0.0 0.0" range="0.7 1.9" type="hinge"/>
                <geom fromto="0.0 0.0 0.0 0.0636 0.0636 -0.1" name="tibia_fl_geom" size="0.015" mass="0.08" type="capsule" rgba="0 1 1 1" material="MatLeg"/>
                <site name="l0" pos="0.0636 0.0636 -0.1" size=".017" type="sphere" rgba="1.0 1.0 1.0 1.0"/>
             </body>
          </body>
      </body>

      <body name="front_right_leg" pos="0.12 -0.06 0">
        <joint axis="0 0 1" name="coxa_fr" pos="0.0 0.0 0.0" range="-0.3 0.3" type="hinge"/>
          <geom fromto="0.0 0.0 0.0 0.03676 -0.03676 0.0" name="coxa_fr_geom" size="0.015" mass="0.015" type="capsule"/>
          <body pos="0.03676 -0.03676 0">
            <joint axis="1 1 0" name="femur_fr" pos="0.0 0.0 0.0" range="-1.6 0.0" type="hinge"/>
            <geom fromto="0.0 0.0 0.0 0.0466 -0.0466 0.0" name="femur_fr_geom" size="0.015" mass="0.07" type="capsule"/>
             <body pos="0.0466 -0.0466 -0.015">
                <joint axis="1 1 0" name="tibia_fr" pos="0.0 0.0 0.0" range="0.7 1.9" type="hinge"/>
                <geom fromto="0.0 0.0 0.0 0.0636 -0.0636 -0.1" name="tibia_fr_geom" size="0.015" mass="0.08" type="capsule" rgba="0 1 1 1"/>
                <site name="l1" pos="0.0636 -0.0636 -0.1" size=".017" type="sphere" rgba="1.0 1.0 1.0 1.0"/>
            </body>
          </body>
      </body>

      <body name="mid_left_leg" pos="0.0 0.1 0">
        <joint axis="0 0 1" name="coxa_ml" pos="0.0 0.0 0.0" range="-0.3 0.3" type="hinge" />
          <geom fromto="0.0 0.0 0.0 0.0 0.052 0.0" name="coxa_ml_geom" size="0.015" mass="0.015" type="capsule" material="MatLeg"/>
          <body pos="0.0 0.052 0">
            <joint axis="-1 0 0" name="femur_ml" pos="0.0 0.0 0.0" range="-1.6 0.0" type="hinge"/>
            <geom fromto="0.0 0.0 0.0 0.0 0.066 0" name="femur_ml_geom" size="0.015" mass="0.07" type="capsule" material="MatLeg"/>
             <body pos="0.0 0.066 -0.015">
                <joint axis="-1 0 0" name="tibia_ml" pos="0.0 0.0 0.0" range="0.7 1.9" type="hinge"/>
                <geom fromto="0.0 0.0 0.0 0.0 0.09 -0.10" name="tibia_ml_geom" size="0.015" mass="0.8" type="capsule" material="MatLeg"/>
                <site name="l2" pos="0 0.09 -0.1" size=".017" type="sphere" rgba="1.0 1.0 1.0 1.0"/>
            </body>
          </body>
      </body>


      <body name="mid_right_leg" pos="0.0 -0.1 0">
        <joint axis="0 0 1" name="coxa_mr" pos="0.0 0.0 0.0" range="-0.3 0.3" type="hinge"/>
          <geom fromto="0.0 0.0 0.0 0.0 -0.052 0.0" name="coxa_mr_geom" size="0.015" mass="0.015" type="capsule"/>
          <body pos="0.0 -0.052 0">
            <joint axis="1 0 0" name="femur_mr" pos="0.0 0.0 0.0" range="-1.6 0.0" type="hinge"/>
            <geom fromto="0.0 0.0 0.0 0.0 -0.066 0.0" name="femur_mr_geom" size="0.015" mass="0.07" type="capsule"/>
             <body pos="0.0 -0.066 -0.015">
                <joint axis="1 0 0" name="tibia_mr" pos="0.0 0.0 0.0" range="0.7 1.9" type="hinge"/>
                <geom fromto="0.0 0.0 0.0 0.0 -0.09 -0.1" name="tibia_mr_geom" size="0.015" mass="0.08" type="capsule"/>
                <site name="l3" pos="0 -0.09 -0.1" size=".017" type="sphere" rgba="1.0 1.0 1.0 1.0"/>
            </body>
          </body>
      </body>


      <body name="back_left_leg" pos="-0.12 0.06 0">
        <joint axis="0 0 1" name="coxa_rl" pos="0.0 0.0 0.0" range="-0.3 0.3" type="hinge"/>
          <geom fromto="0.0 0.0 0.0 -0.03676 0.03676 0.0" name="coxa_rl_geom" size="0.015" mass="0.015" type="capsule"/>
          <body pos="-0.03676 0.03676 0">
            <joint axis="-1 -1 0" name="femur_rl" pos="0.0 0.0 0.0" range="-1.6 0.0" type="hinge"/>
            <geom fromto="0.0 0.0 0.0 -0.0466 0.0466 0" name="femur_rl_geom" size="0.015" mass="0.07"  type="capsule"/>
             <body pos="-0.0466 0.04660 -0.015">
                <joint axis="-1 -1 0" name="tibia_rl" pos="0.0 0.0 0.0" range="0.7 1.9" type="hinge"/>
                <geom fromto="0.0 0.0 0.0 -0.0636 0.0636 -0.095" name="tibia_rl_geom" size="0.015" mass="0.08" type="capsule"/>
               <site name="l4" pos="-0.0636 0.0636 -0.095" size=".017" type="sphere" rgba="1.0 1.0 1.0 1.0"/>
            </body>
          </body>
      </body>

      <body name="back_right_leg" pos="-0.12 -0.06 0">
        <joint axis="0 0 1" name="coxa_rr" pos="0.0 0.0 0.0" range="-0.3 0.3" type="hinge"/>
          <geom fromto="0.0 0.0 0.0 -0.03676 -0.03676 0.0" name="coxa_rr_geom" size="0.015" mass="0.015" type="capsule"/>
          <body pos="-0.03676 -0.03676 0">
            <joint axis="1 -1 0" name="femur_rr" pos="0.0 0.0 0.0" range="-1.6 0.0" type="hinge"/>
            <geom fromto="0.0 0.0 0.0 -0.0466 -0.0466 0.0" name="femur_rr_geom" size="0.015" mass="0.07" type="capsule"/>
             <body pos="-0.0466 -0.0466 -0.015">
                <joint axis="1 -1 0" name="tibia_rr" pos="0.0 0.0 0.0" range="0.7 1.9" type="hinge"/>
                <geom fromto="0.0 0.0 0.0 -0.0636 -0.0636 -0.1" name="tibia_rr_geom" size="0.015" mass="0.08" type="capsule"/>
               <site name="l5" pos="-0.0636 -0.0636 -0.1" size=".017" type="sphere" rgba="1.0 1.0 1.0 1.0"/>
            </body>
          </body>
      </body>




    </body>
  </worldbody>

  <sensor>
     <touch name="t0" site="l0" />
  </sensor>

  <sensor>
     <touch name="t1" site="l1" />
  </sensor>

  <sensor>
     <touch name="t2" site="l2" />
  </sensor>

  <sensor>
     <touch name="t3" site="l3" />
  </sensor>

  <sensor>
     <touch name="t4" site="l4" />
  </sensor>

  <sensor>
     <touch name="t5" site="l5" />
  </sensor>


  <actuator>
    <position joint="coxa_fl" kp="10" forcelimited="true" forcerange="-1.4 1.4" />
    <position joint="femur_fl" kp="10" forcelimited="true" forcerange="-1.4 1.4" />
    <position joint="tibia_fl" kp="10" forcelimited="true" forcerange="-1.4 1.4" />
    <position joint="coxa_fr" kp="10" forcelimited="true" forcerange="-1.4 1.4" />
    <position joint="femur_fr" kp="10" forcelimited="true" forcerange="-1.4 1.4" />
    <position joint="tibia_fr" kp="10" forcelimited="true" forcerange="-1.4 1.4" />
    <position joint="coxa_ml" kp="10" forcelimited="true" forcerange="-1.4 1.4" />
    <position joint="femur_ml" kp="10" forcelimited="true" forcerange="-1.4 1.4" />
    <position joint="tibia_ml" kp="10" forcelimited="true" forcerange="-1.4 1.4" />
    <position joint="coxa_mr" kp="10" forcelimited="true" forcerange="-1.4 1.4" />
    <position joint="femur_mr" kp="10" forcelimited="true" forcerange="-1.4 1.4" />
    <position joint="tibia_mr" kp="10" forcelimited="true" forcerange="-1.4 1.4" />
    <position joint="coxa_rl" kp="10" forcelimited="true" forcerange="-1.4 1.4" />
    <position joint="femur_rl" kp="10" forcelimited="true" forcerange="-1.4 1.4" />
    <position joint="tibia_rl" kp="10" forcelimited="true" forcerange="-1.4 1.4" />
    <position joint="coxa_rr" kp="10" forcelimited="true" forcerange="-1.4 1.4" />
    <position joint="femur_rr" kp="10" forcelimited="true" forcerange="-1.4 1.4" />
    <position joint="tibia_rr" kp="10" forcelimited="true" forcerange="-1.4 1.4" />


<!--
    <motor joint="coxa_fl" gear="100"/>
    <motor joint="femur_fl" gear="100"/>
    <motor joint="tibia_fl" gear="100"/>
    <motor joint="coxa_fr" gear="100"/>
    <motor joint="femur_fr" gear="100"/>
    <motor joint="tibia_fr" gear="100"/>
    <motor joint="coxa_rr" gear="100"/>
    <motor joint="femur_rr" gear="100"/>
    <motor joint="tibia_rr" gear="100"/>
    <motor joint="coxa_rl" gear="100"/>
    <motor joint="femur_rl" gear="100"/>
    <motor joint="tibia_rl" gear="100"/>
    <motor joint="coxa_mr" gear="100"/>
    <motor joint="femur_mr" gear="100"/>
    <motor joint="tibia_mr" gear="100"/>
    <motor joint="coxa_ml" gear="100"/>
    <motor joint="femur_ml" gear="100"/>
    <motor joint="tibia_ml" gear="100"/>
    -->
  </actuator>
</mujoco>
