<?xml version="1.0" encoding="utf-8"?>

<mujoco>

  <worldbody>
    <light diffuse=".8 .8 .8" dir="0 -.15 -1" directional="false" pos="1 1 4.0" specular="0.3 0.3 0.3" castshadow="false"/>
    <light diffuse=".8 .8 .8" dir="0 -.15 -1" directional="false" pos="-3. -3. 4.0" specular="0.3 0.3 0.3" castshadow="false"/>
  </worldbody>

  <asset>

    <mesh name="base" file="jaco_arm/base.stl" />
    <mesh name="shoulder" file="jaco_arm/shoulder.stl" />
    <mesh name="arm" file="jaco_arm/arm.stl" />
    <mesh name="arm_half_1" file="jaco_arm/arm_half_1.stl" />
    <mesh name="arm_half_2" file="jaco_arm/arm_half_2.stl" />
    <mesh name="forearm" file="jaco_arm/forearm.stl" />
    <mesh name="wrist_spherical_1" file="jaco_arm/wrist_spherical_1.stl" />
    <mesh name="wrist_spherical_2" file="jaco_arm/wrist_spherical_2.stl" />
    <mesh name="hand_3finger" file="jaco_arm/hand_3finger.stl" />
    <mesh name="finger_proximal" file="jaco_arm/finger_proximal.stl" />
    <mesh name="finger_distal" file="jaco_arm/finger_distal.stl" />

    <mesh name="mug_mesh" file="objects/mug.stl" scale="0.0006 0.0006 0.0006"/>

    <texture type="skybox" builtin="gradient" rgb1=".50 .495 .48" rgb2=".50 .495 .48" width="32" height="32"></texture>
    <texture file="marble.png" name="marble" />
    <texture file="navy_blue.png" name="navy_blue" />
    <texture file="wood_light.png" name="table_texture" type="2d"/>
    <texture file="wood_light.png" name="wood_texture"/>
    <texture file="tennis.png" name="tennis_green"/>

    <material name="marble" shininess="0.3" rgba="0.9 0.9 0.9 1" specular="1" texture="marble"/>
    <material name="navy_blue" shininess="0.3" rgba="0.9 0.9 0.9 1" specular="1" texture="navy_blue"/>
    <material name="tennis_green" shininess="0.3" rgba="0.9 0.9 0.9 1" specular="1" texture="tennis_green"/>
    <material name="wood_material" rgba="1 1 1 1" shininess="0.1" specular="0.4" texture="wood_texture" />
    <material name="table_material" rgba="1 1 1 1" shininess="0.1" specular="0.4" texture="table_texture" />

    <material name="MatViz" specular="1" shininess=".1" reflectance="0.5" rgba=".07 .07 .1 1"/>

  </asset>

  <default>
    <geom contype='1' conaffinity='1' condim='3' margin="0.001" />

    <!-- damping=10 keeps joints from shaking with position controllers! -->

    <joint limited="false" damping="10" armature=".01"/>

    <default class ="vizNcoll">
      <geom material="MatViz" type="mesh" condim="3" contype="1" conaffinity="1" margin="0.001"/>
      <joint pos="0 0 0" type="hinge"/>
    </default>
    <default class ="ground">
      <geom type="plane" margin="0.001" contype="1" />
    </default>
  </default>

  <asset>
    <texture name="wood" file="../textures/wood.png" type="cube"/>
    <material shininess=".1" name="wood" texture="wood" specular="0.4"/>

    <texture name="real_door" file="../textures/real_door.png" type="cube"/>
    <material shininess=".1" name="real_door" texture="real_door" specular=".4"/>

    <texture name="darkwood" file="../textures/darkwood.png" type="cube"/>
    <material shininess=".1" name="darkwood" texture="darkwood" specular="0.4"/>

    <texture name="granite" file="../textures/granite.png" type="2d"/>
    <material shininess=".1" name="granite" texture="granite" specular="0.4"/>

    <texture name="light_wood" file="../textures/light_wood.png" type="cube"/>
    <material shininess=".1" name="light_wood" texture="light_wood" specular="0.4"/>

    <texture name="light_wood_v2" file="../textures/light_wood_v2.png" type="cube"/>
    <material shininess=".1" name="light_wood_v2" texture="light_wood_v2" specular="0.4"/>

    <texture name="light_wood_v3" file="../textures/light_wood_v3.png" type="2d"/>
    <material shininess=".1" name="light_wood_v3" texture="light_wood_v3" specular="0.4"/>

    <texture builtin="gradient" height="256" rgb1=".9 .9 1." rgb2=".2 .3 .4" type="skybox" width="256"/>
  </asset>

  <visual>
    <headlight ambient="0.5 0.5 0.5" />
  </visual>

  <size njmax="800" nconmax="200" />
  <compiler angle="radian" meshdir="../meshes" texturedir="../textures" discardvisual='true' coordinate='local'/>

  <!-- <compiler inertiafromgeom="auto" angle="radian" coordinate="local" eulerseq="XYZ" meshdir="../meshes" texturedir="../textures"/>-->
  <!-- <option integrator="RK4" solver="PGS" timestep="0.001" gravity="0 0 -9.8" iterations="50"/> -->

  <!-- <optionfor iterations="50" integrator="Euler" timestep="0.002" cone="elliptic" /> -->
  <option integrator="RK4" solver="PGS" timestep="0.001" gravity="0 0 -9.8" iterations="50"/>

  <default>
    <!-- <joint limited="true" damping="1" stiffness="0" armature=".1" user="0"/> -->
    <geom solref="0.02 1" solimp="1 1 0" />
    <motor ctrllimited="true" ctrlrange="-1 1"/>
    <position ctrllimited="true"/>

  </default>

  <equality>
    <weld body1="mocap" body2="jaco_link_7" solref="0.02 1"></weld>
  </equality>

</mujoco>
