<mujoco model="swimmer">
  <compiler angle="degree" coordinate="local" inertiafromgeom="true"/>
  <option collision="predefined" density="4000" integrator="RK4" timestep="0.01" viscosity="0.1"/>
  <default>
    <geom conaffinity="1" condim="1" contype="1" material="geom" rgba="0.8 0.6 .4 1"/>
    <joint armature='0.1'  />
  </default>
  <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="0 0 0" rgb2="0.8 0.8 0.8" type="2d" width="100"/>
    <material name="MatPlane" reflectance="0.5" shininess="1" specular="1" texrepeat="30 30" texture="texplane"/>
    <material name="geom" texture="texgeom" texuniform="true"/>
  </asset>
  <!--
<asset>
  <texture type="skybox" builtin="gradient" width="128" height="128" rgb1=".4 .6 .8" 
    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=".2 .3 .4" rgb2=".1 0.15 0.2" 
    width="512" height="512"/>  

  <material name='MatPlane' reflectance='0.5' texture="texplane" texrepeat="1 1" texuniform="true"/>
  <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.1" rgba="0.8 0.9 0.8 1" size="40 40 0.1" type="plane"/>
  <!--
        <geom conaffinity="1" name='floor' pos='0 0 0' size='50 50 .125' type='plane' material="MatPlane" condim='3'/>
        <light mode='targetbodycom' target='torso' directional='false' diffuse='.8 .8 .8' specular='0.3 0.3 0.3' pos='0 0 4.0' dir='0 0 -1'/>
        <camera name='targeting' pos='1 1 2' mode='targetbodycom' target='torso'/>
    -->

        <!--  ================= SWIMMER ================= /-->
        <body name="torso" pos="0 0 0">
          <geom density="1000" fromto="1.5 0 0 0.5 0 0" size="0.1" type="capsule"/>
          <joint axis="1 0 0" name="slider1" pos="0 0 0" type="slide"/>
          <joint axis="0 1 0" name="slider2" pos="0 0 0" type="slide"/>
          <joint axis="0 0 1" name="rot" pos="0 0 0" type="hinge"/>
          <body name="mid" pos="0.5 0 0">
            <geom density="1000" fromto="0 0 0 -1 0 0" size="0.1" type="capsule"/>
            <joint axis="0 0 1" limited="true" name="rot2" pos="0 0 0" range="-100 100" type="hinge"/>
            <body name="back" pos="-1 0 0">
              <geom density="1000" fromto="0 0 0 -1 0 0" size="0.1" type="capsule"/>
              <joint axis="0 0 1" limited="true" name="rot3" pos="0 0 0" range="-100 100" type="hinge"/>
            </body>
          </body>
        </body>
      </worldbody>
      <sensor>
        <!--
      <jointpos joint="slider1" />
      <jointpos joint="slider2" />
      -->
      <jointpos joint="rot" /> <!-- sin -->
      <!-- <jointpos joint="rot" />  cos -->

      <jointpos joint="rot2" />
      <jointpos joint="rot3" />

      <jointvel joint="slider1" />
      <jointvel joint="slider2" />
      <jointvel joint="rot" />
      <jointvel joint="rot2" />
      <jointvel joint="rot3" />
    </sensor>

    <actuator>
      <motor ctrllimited="true" ctrlrange="-1 1" gear="150.0" joint="rot2"/>
      <motor ctrllimited="true" ctrlrange="-1 1" gear="150.0" joint="rot3"/>
    </actuator>
  </mujoco>
