<?xml version="1.0"?>
<robot xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor"
       xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
       xmlns:joint="http://playerstage.sourceforge.net/gazebo/xmlschema/#slider"
       xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface"
       xmlns:xacro="http://ros.org/wiki/xacro">

  <xacro:macro name="pr2_gripper_transmission_v0" params="side screw_reduction gear_ratio theta0 phi0 t0 L0 h a b r">
    <!-- [lr]_gripper_joint is a fictitious joint, used by transmission for controller gap   -->
    <!-- [lr]_gripper_joint is not attached to any link                                      -->
    <!-- [lr]_gripper_joint position is the gap_size                                         -->
    <!-- [lr]_gripper_joint velocity is the gap linear velocity                              -->
    <!-- [lr]_gripper_joint effort   is the gap linear force                                 -->
    <!-- Please refer to function engineering spreadsheet 090224_link_data.xls for           -->
    <!-- the transmission function.                                                          -->
    <!-- Please refer to mechanism_model/src/pr2_gripper_transmission.cpp for implementation.-->
    <!-- gazebo_mimic_pid is for sim only.                                                   -->
    <transmission type="pr2_mechanism_model/PR2GripperTransmission" name="${side}_gripper_trans" >
      <actuator       name="${side}_gripper_motor" />
      <gap_joint      name="${side}_gripper_joint"
                      mechanical_reduction="1.0"
                      screw_reduction="${screw_reduction}"
                      gear_ratio="${gear_ratio}"
                      theta0="${theta0}"
                      phi0="${phi0}"
                      t0="${t0}"
                      L0="${L0}"
                      h="${h}"
                      a="${a}"
                      b="${b}"
                      r="${r}"
                      />
      <!-- if a gazebo joint exists as [l|r]_gripper_joint, use this tag to have
           gripper transmission apply torque directly to prismatic joint
           this should be the default behavior in diamondback, deprecating this flag -->
      <use_simulated_gripper_joint/>
      <!-- set passive joint angles so things look nice in rviz -->
      <passive_joint  name="${side}_gripper_l_finger_joint"     />
      <passive_joint  name="${side}_gripper_r_finger_joint"     />
      <passive_joint  name="${side}_gripper_r_finger_tip_joint" />
      <passive_joint  name="${side}_gripper_l_finger_tip_joint" />
      <!-- screw joint to capture gripper "dynamics" -->
      <simulated_actuated_joint name="${side}_gripper_motor_screw_joint"
                                passive_actuated_joint="${side}_gripper_motor_slider_joint"
                                simulated_reduction="3141.6"   />
    </transmission>
  </xacro:macro>


</robot>
