<?xml version="1.0" encoding="utf-8"?>
<robot xmlns:xacro="http://ros.org/wiki/xacro" name="ur_robotiq_adapter">
  <xacro:macro name="ur_to_robotiq" params="prefix parent child rotation:=^|${0.0}">

    <joint name="${prefix}ur_to_robotiq_joint" type="fixed">
      <!-- The parent link must be read from the robot model it is attached to. -->
      <parent link="${parent}"/>
      <child link="${prefix}ur_to_robotiq_link"/>
      <origin xyz="0 0 0" rpy="0 0 ${rotation}"/>
    </joint>

    <link name="${prefix}ur_to_robotiq_link">
        <visual>
          <origin xyz="0 0 0" rpy="0 0 0" />
          <geometry>
            <mesh filename="package://robotiq_description/meshes/visual/2f_85/ur_to_robotiq_adapter.dae"/>
          </geometry>
        </visual>
        <collision>
          <origin xyz="0 0 0" rpy="0 0 0"/>
          <geometry>
            <mesh filename="package://robotiq_description/meshes/collision/2f_85/ur_to_robotiq_adapter.stl"/>
          </geometry>
        </collision>
        <inertial>
          <mass value="0.01" />
          <origin xyz="0 0 0" />
          <inertia ixx="0.000044" ixy="0.0" ixz="0.0" iyy="0.000027" iyz="0.0" izz="0.000027" />
        </inertial>
    </link>

    <joint name="${prefix}gripper_side_joint" type="fixed">
      <parent link="${prefix}ur_to_robotiq_link"/>
      <child link="${child}"/>
      <!-- <origin xyz="0 0 0.011" rpy="0 ${-pi/2} ${pi/2}"/> -->
      <origin xyz="0 0 0.011" rpy="0 0 0"/>
    </joint>
  </xacro:macro>
</robot>
