<mujoco model="ant">
  <compiler angle="degree" coordinate="local" inertiafromgeom="true"/>
  <option integrator="RK4" timestep="0.01"/>
  <default>
    <joint armature="1" damping="1" limited="true"/>
    <geom conaffinity="0" condim="3" density="5.0" friction="1.5 0.1 0.1" margin="0.01" rgba="0.8 0.6 0.4 1"/>
  </default>

  <worldbody>
    <geom conaffinity="1" type="plane" size="10 10 0.1" rgba=".2 .4 .6 1"/>
  </worldbody>

  <!--############################### FIRST ANT ############################-->

  <worldbody>
    <body name="torso" pos="-1 -1 3">
      <freejoint name="jtorso_free"/>
      <geom name="torso_geom" pos="0 0 0" size="0.25" type="sphere"/>
      <body name="front_left_leg" pos="0 0 0">
        <geom fromto="0.0 0.0 0.0 0.2 0.2 0.0" name="aux_1_geom" size="0.08" type="capsule" rgba=".8 .5 .3 1"/>
        <body name="aux_1" pos="0.2 0.2 0">
          <joint axis="0 0 1" name="hip_1" pos="0.0 0.0 0.0" range="-40 40" type="hinge"/>
          <geom fromto="0.0 0.0 0.0 0.2 0.2 0.0" name="left_leg_geom" size="0.08" type="capsule" rgba=".8 .5 .3 1"/>
          <body pos="0.2 0.2 0" name="front_left_foot">
            <joint axis="-1 1 0" name="ankle_1" pos="0.0 0.0 0.0" range="30 100" type="hinge"/>
            <geom fromto="0.0 0.0 0.0 0.4 0.4 0.0" name="left_ankle_geom" size="0.08" type="capsule" rgba=".8 .5 .3 1"/>
          </body>
        </body>
      </body>
      <body name="front_right_leg" pos="0 0 0">
        <geom fromto="0.0 0.0 0.0 -0.2 0.2 0.0" name="aux_2_geom" size="0.08" type="capsule"/>
        <body name="aux_2" pos="-0.2 0.2 0">
          <joint axis="0 0 1" name="hip_2" pos="0.0 0.0 0.0" range="-40 40" type="hinge"/>
          <geom fromto="0.0 0.0 0.0 -0.2 0.2 0.0" name="right_leg_geom" size="0.08" type="capsule"/>
          <body pos="-0.2 0.2 0" name="front_right_foot">
            <joint axis="1 1 0" name="ankle_2" pos="0.0 0.0 0.0" range="-100 -30" type="hinge"/>
            <geom fromto="0.0 0.0 0.0 -0.4 0.4 0.0" name="right_ankle_geom" size="0.08" type="capsule"/>
          </body>
        </body>
      </body>
      <body name="left_back_leg" pos="0 0 0">
        <geom fromto="0.0 0.0 0.0 -0.2 -0.2 0.0" name="aux_3_geom" size="0.08" type="capsule"/>
        <body name="aux_3" pos="-0.2 -0.2 0">
          <joint axis="0 0 1" name="hip_3" pos="0.0 0.0 0.0" range="-40 40" type="hinge"/>
          <geom fromto="0.0 0.0 0.0 -0.2 -0.2 0.0" name="back_leg_geom" size="0.08" type="capsule"/>
          <body pos="-0.2 -0.2 0" name="left_back_foot">
            <joint axis="-1 1 0" name="ankle_3" pos="0.0 0.0 0.0" range="-100 -30" type="hinge"/>
            <geom fromto="0.0 0.0 0.0 -0.4 -0.4 0.0" name="third_ankle_geom" size="0.08" type="capsule"/>
          </body>
        </body>
      </body>
      <body name="right_back_leg" pos="0 0 0">
        <geom fromto="0.0 0.0 0.0 0.2 -0.2 0.0" name="aux_4_geom" size="0.08" type="capsule" rgba=".8 .5 .3 1"/>
        <body name="aux_4" pos="0.2 -0.2 0">
          <joint axis="0 0 1" name="hip_4" pos="0.0 0.0 0.0" range="-40 40" type="hinge"/>
          <geom fromto="0.0 0.0 0.0 0.2 -0.2 0.0" name="rightback_leg_geom" size="0.08" type="capsule" rgba=".8 .5 .3 1"/>
          <body pos="0.2 -0.2 0" name="right_back_foot">
            <joint axis="1 1 0" name="ankle_4" pos="0.0 0.0 0.0" range="30 100" type="hinge"/>
            <geom fromto="0.0 0.0 0.0 0.4 -0.4 0.0" name="fourth_ankle_geom" size="0.08" type="capsule" rgba=".8 .5 .3 1"/>
          </body>
        </body>
      </body>
    </body>
  </worldbody>
  <actuator>
    <velocity name="vel_hip_4"      ctrllimited="true" ctrlrange="-1.0 1.0" joint="hip_4"   kv="25"/>
    <velocity name="vel_ankle_4"    ctrllimited="true" ctrlrange="-1.0 1.0" joint="ankle_4" kv="25"/>
    <velocity name="vel_hip_1"      ctrllimited="true" ctrlrange="-1.0 1.0" joint="hip_1"   kv="25"/>
    <velocity name="vel_ankle_1"    ctrllimited="true" ctrlrange="-1.0 1.0" joint="ankle_1" kv="25"/>
    <velocity name="vel_hip_2"      ctrllimited="true" ctrlrange="-1.0 1.0" joint="hip_2"   kv="25"/>
    <velocity name="vel_ankle_2"    ctrllimited="true" ctrlrange="-1.0 1.0" joint="ankle_2" kv="25"/>
    <velocity name="vel_hip_3"      ctrllimited="true" ctrlrange="-1.0 1.0" joint="hip_3"   kv="25"/>
    <velocity name="vel_ankle_3"    ctrllimited="true" ctrlrange="-1.0 1.0" joint="ankle_3" kv="25"/>

    <position name="pos_hip_4"      ctrllimited="true" ctrlrange="-2.0 2.0" joint="hip_4"   kp="100"/>
    <position name="pos_ankle_4"    ctrllimited="true" ctrlrange="-2.0 2.0" joint="ankle_4" kp="100"/>
    <position name="pos_hip_1"      ctrllimited="true" ctrlrange="-2.0 2.0" joint="hip_1"   kp="100"/>
    <position name="pos_ankle_1"    ctrllimited="true" ctrlrange="-2.0 2.0" joint="ankle_1" kp="100"/>
    <position name="pos_hip_2"      ctrllimited="true" ctrlrange="-2.0 2.0" joint="hip_2"   kp="100"/>
    <position name="pos_ankle_2"    ctrllimited="true" ctrlrange="-2.0 2.0" joint="ankle_2" kp="100"/>
    <position name="pos_hip_3"      ctrllimited="true" ctrlrange="-2.0 2.0" joint="hip_3"   kp="100"/>
    <position name="pos_ankle_3"    ctrllimited="true" ctrlrange="-2.0 2.0" joint="ankle_3" kp="100"/>
  </actuator>

  <!--############################### SECOND ANT ############################-->
  <worldbody>
    <body name="torso_2" pos="1 1 3">
      <freejoint name="jtorso_free_2"/>
      <geom name="torso_geom_2" pos="0 0 0" size="0.25" type="sphere"/>
      <body name="front_left_leg_2" pos="0 0 0">
        <geom fromto="0.0 0.0 0.0 0.2 0.2 0.0" name="aux_1_geom_2" size="0.08" type="capsule" rgba=".8 .5 .3 1"/>
        <body name="aux_1_2" pos="0.2 0.2 0">
          <joint axis="0 0 1" name="hip_1_2" pos="0.0 0.0 0.0" range="-40 40" type="hinge"/>
          <geom fromto="0.0 0.0 0.0 0.2 0.2 0.0" name="left_leg_geom_2" size="0.08" type="capsule" rgba=".8 .5 .3 1"/>
          <body pos="0.2 0.2 0" name="front_left_foot_2">
            <joint axis="-1 1 0" name="ankle_1_2" pos="0.0 0.0 0.0" range="30 100" type="hinge"/>
            <geom fromto="0.0 0.0 0.0 0.4 0.4 0.0" name="left_ankle_geom_2" size="0.08" type="capsule" rgba=".8 .5 .3 1"/>
          </body>
        </body>
      </body>
      <body name="front_right_leg_2" pos="0 0 0">
        <geom fromto="0.0 0.0 0.0 -0.2 0.2 0.0" name="aux_2_geom_2" size="0.08" type="capsule"/>
        <body name="aux_2_2" pos="-0.2 0.2 0">
          <joint axis="0 0 1" name="hip_2_2" pos="0.0 0.0 0.0" range="-40 40" type="hinge"/>
          <geom fromto="0.0 0.0 0.0 -0.2 0.2 0.0" name="right_leg_geom_2" size="0.08" type="capsule"/>
          <body pos="-0.2 0.2 0" name="front_right_foot_2">
            <joint axis="1 1 0" name="ankle_2_2" pos="0.0 0.0 0.0" range="-100 -30" type="hinge"/>
            <geom fromto="0.0 0.0 0.0 -0.4 0.4 0.0" name="right_ankle_geom_2" size="0.08" type="capsule"/>
          </body>
        </body>
      </body>
      <body name="left_back_leg_2" pos="0 0 0">
        <geom fromto="0.0 0.0 0.0 -0.2 -0.2 0.0" name="aux_3_geom_2" size="0.08" type="capsule"/>
        <body name="aux_3_2" pos="-0.2 -0.2 0">
          <joint axis="0 0 1" name="hip_3_2" pos="0.0 0.0 0.0" range="-40 40" type="hinge"/>
          <geom fromto="0.0 0.0 0.0 -0.2 -0.2 0.0" name="back_leg_geom_2" size="0.08" type="capsule"/>
          <body pos="-0.2 -0.2 0" name="left_back_foot_2">
            <joint axis="-1 1 0" name="ankle_3_2" pos="0.0 0.0 0.0" range="-100 -30" type="hinge"/>
            <geom fromto="0.0 0.0 0.0 -0.4 -0.4 0.0" name="third_ankle_geom_2" size="0.08" type="capsule"/>
          </body>
        </body>
      </body>
      <body name="right_back_leg_2" pos="0 0 0">
        <geom fromto="0.0 0.0 0.0 0.2 -0.2 0.0" name="aux_4_geom_2" size="0.08" type="capsule" rgba=".8 .5 .3 1"/>
        <body name="aux_4_2" pos="0.2 -0.2 0">
          <joint axis="0 0 1" name="hip_4_2" pos="0.0 0.0 0.0" range="-40 40" type="hinge"/>
          <geom fromto="0.0 0.0 0.0 0.2 -0.2 0.0" name="rightback_leg_geom_2" size="0.08" type="capsule" rgba=".8 .5 .3 1"/>
          <body pos="0.2 -0.2 0" name="right_back_foot_2">
            <joint axis="1 1 0" name="ankle_4_2" pos="0.0 0.0 0.0" range="30 100" type="hinge"/>
            <geom fromto="0.0 0.0 0.0 0.4 -0.4 0.0" name="fourth_ankle_geom_2" size="0.08" type="capsule" rgba=".8 .5 .3 1"/>
          </body>
        </body>
      </body>
    </body>
  </worldbody>
  <actuator>
    <velocity name="vel_hip_4_2"      ctrllimited="true" ctrlrange="-1.0 1.0" joint="hip_4_2"   kv="25"/>
    <velocity name="vel_ankle_4_2"    ctrllimited="true" ctrlrange="-1.0 1.0" joint="ankle_4_2" kv="25"/>
    <velocity name="vel_hip_1_2"      ctrllimited="true" ctrlrange="-1.0 1.0" joint="hip_1_2"   kv="25"/>
    <velocity name="vel_ankle_1_2"    ctrllimited="true" ctrlrange="-1.0 1.0" joint="ankle_1_2" kv="25"/>
    <velocity name="vel_hip_2_2"      ctrllimited="true" ctrlrange="-1.0 1.0" joint="hip_2_2"   kv="25"/>
    <velocity name="vel_ankle_2_2"    ctrllimited="true" ctrlrange="-1.0 1.0" joint="ankle_2_2" kv="25"/>
    <velocity name="vel_hip_3_2"      ctrllimited="true" ctrlrange="-1.0 1.0" joint="hip_3_2"   kv="25"/>
    <velocity name="vel_ankle_3_2"    ctrllimited="true" ctrlrange="-1.0 1.0" joint="ankle_3_2" kv="25"/>

    <position name="pos_hip_4_2"      ctrllimited="true" ctrlrange="-2.0 2.0" joint="hip_4_2"   kp="100"/>
    <position name="pos_ankle_4_2"    ctrllimited="true" ctrlrange="-2.0 2.0" joint="ankle_4_2" kp="100"/>
    <position name="pos_hip_1_2"      ctrllimited="true" ctrlrange="-2.0 2.0" joint="hip_1_2"   kp="100"/>
    <position name="pos_ankle_1_2"    ctrllimited="true" ctrlrange="-2.0 2.0" joint="ankle_1_2" kp="100"/>
    <position name="pos_hip_2_2"      ctrllimited="true" ctrlrange="-2.0 2.0" joint="hip_2_2"   kp="100"/>
    <position name="pos_ankle_2_2"    ctrllimited="true" ctrlrange="-2.0 2.0" joint="ankle_2_2" kp="100"/>
    <position name="pos_hip_3_2"      ctrllimited="true" ctrlrange="-2.0 2.0" joint="hip_3_2"   kp="100"/>
    <position name="pos_ankle_3_2"    ctrllimited="true" ctrlrange="-2.0 2.0" joint="ankle_3_2" kp="100"/>
  </actuator>

</mujoco>