<robot name = "linkage">
<xacro:include filename="common_materials.xacro"/>
<xacro:include filename="common_colours.xacro"/>

    <!-- links: main serial chain -->
    <link name="base_link">
      <visual>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
          <mesh filename="base_link.stl"/>
        </geometry>
        <xacro:material_fanuc_gray28 />
      </visual>
      <collision>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
          <mesh filename="package://fanuc_lrmate200id_support/meshes/lrmate200id/collision/base_link.stl"/>
        </geometry>
      </collision>
    </link>
    <link name="link_1">
      <visual>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
          <mesh filename="link_1.stl"/>
        </geometry>
        <xacro:material_fanuc_yellow />
      </visual>
      <collision>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
          <mesh filename="package://fanuc_lrmate200id_support/meshes/lrmate200id/collision/link_1.stl"/>
        </geometry>
      </collision>
    </link>
    <link name="link_2">
      <visual>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
          <mesh filename="link_2.stl"/>
        </geometry>
        <xacro:material_fanuc_yellow />
      </visual>
      <collision>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
          <mesh filename="package://fanuc_lrmate200id_support/meshes/lrmate200id/collision/link_2.stl"/>
        </geometry>
      </collision>
    </link>
    <link name="link_3">
      <visual>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
          <mesh filename="link_3.stl"/>
        </geometry>
        <xacro:material_fanuc_yellow />
      </visual>
      <collision>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
          <mesh filename="package://fanuc_lrmate200id_support/meshes/lrmate200id/collision/link_3.stl"/>
        </geometry>
      </collision>
    </link>
    <link name="link_4">
      <visual>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
          <mesh filename="link_4.stl"/>
        </geometry>
        <xacro:material_fanuc_yellow />
      </visual>
      <collision>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
          <mesh filename="package://fanuc_lrmate200id_support/meshes/lrmate200id/collision/link_4.stl"/>
        </geometry>
      </collision>
    </link>
    <link name="link_5">
      <visual>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
          <mesh filename="link_5.stl"/>
        </geometry>
        <xacro:material_fanuc_yellow />
      </visual>
      <collision>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
          <mesh filename="package://fanuc_lrmate200id_support/meshes/lrmate200id/collision/link_5.stl"/>
        </geometry>
      </collision>
    </link>
    <link name="link_6">
      <visual>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
          <mesh filename="link_6.stl"/>
        </geometry>
        <xacro:material_fanuc_black />
      </visual>
      <collision>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
          <mesh filename="package://fanuc_lrmate200id_support/meshes/lrmate200id/collision/link_6.stl"/>
        </geometry>
      </collision>
    </link>

    <!-- joints: main serial chain -->
    <joint name="joint_1" type="revolute">
      <origin xyz="0 0 0.330" rpy="0 0 0" />
      <parent link="base_link" />
      <child link="link_1" />
      <axis xyz="0 0 1" />
      <limit effort="0" lower="-2.965" upper="2.965" velocity="7.85" />
    </joint>
    <joint name="joint_2" type="revolute">
      <origin xyz="0.050 0 0" rpy="0 0 0"/>
      <parent link="link_1" />
      <child link="link_2" />
      <axis xyz="0 1 0" />
      <limit effort="0" lower="-1.745329" upper="2.530727" velocity="6.63" />
    </joint>
    <joint name="joint_3" type="revolute">
      <origin xyz="0 0 0.330" rpy="0 0 0"/>
      <parent link="link_2" />
      <child link="link_3" />
      <axis xyz="0 -1 0" />
      <limit effort="0" lower="-2.450966" upper="4.886922" velocity="9.08" />
    </joint>
    <joint name="joint_4" type="revolute">
      <origin xyz="0 0 0.035" rpy="0 0 0"/>
      <parent link="link_3"/>
      <child link="link_4"/>
      <axis xyz="-1 0 0"/>
      <limit effort="0" lower="-3.315" upper="3.315" velocity="9.60" />
    </joint>
    <joint name="joint_5" type="revolute">
      <origin xyz="0.335 0 0" rpy="0 0 0"/>
      <parent link="link_4"/>
      <child link="link_5"/>
      <axis xyz="0 -1 0"/>
      <limit effort="0" lower="-2.18" upper="2.18" velocity="9.51" />
    </joint>
    <joint name="joint_6" type="revolute">
      <origin xyz="0.080 0 0" rpy="0 0 0"/>
      <parent link="link_5"/>
      <child link="link_6"/>
      <axis xyz="-1 0 0"/>
      <limit effort="0" lower="-6.285" upper="6.285" velocity="17.45" />
    </joint>

    <!-- ROS-Industrial 'base' frame: base_link to Fanuc World Coordinates transform -->
    <link name="base" />
    <joint name="base_link-base" type="fixed">
      <origin xyz="0 0 0.330" rpy="0 0 0"/>
      <parent link="base_link"/>
      <child link="base"/>
    </joint>

    <!-- ROS-Industrial 'flange' frame: attachment point for EEF models -->
    <link name="flange" />
    <joint name="joint_6-flange" type="fixed">
      <origin xyz="0 0 0" rpy="0 0 0" />
      <parent link="link_6" />
      <child link="flange" />
    </joint>

    <!-- ROS-Industrial 'tool0' frame: all-zeros tool frame -->
    <link name="tool0" />
    <joint name="link_6-tool0" type="fixed">
      <origin xyz="0 0 0" rpy="0 0 0" />
      <parent link="link_6" />
      <child link="tool0" />
    </joint>
</robot>
