<?xml version="1.0"?>
<robot name="turtlebot_hardware" xmlns:xacro="http://ros.org/wiki/xacro">
  <property name="M_PI" value="3.14159"/>
  <property name="M_SCALE" value="0.001"/>

  <xacro:macro name="turtlebot_spacer" params="parent number x_loc y_loc z_loc">
    <joint name="spacer_${number}_joint" type="fixed">
      <origin xyz="${x_loc} ${y_loc} ${z_loc}" rpy="0 0 0" />
      <parent link="${parent}"/>
      <child link="spacer_${number}_link" />
    </joint>

    <link name="spacer_${number}_link">
      <inertial>
        <mass value="0.001" />
        <origin xyz="0 0 0" />
        <inertia ixx="0.0001" ixy="0.0" ixz="0.0"
          iyy="0.0001" iyz="0.0"
          izz="0.0001" />
      </inertial>

      <visual>
        <origin xyz=" 0 0 0 " rpy="0 0 0" />
        <geometry>
          <mesh filename="package://turtlebot_description/meshes/stacks/circles/68-02403-125_Spacer.dae" scale="${M_SCALE} ${M_SCALE} ${M_SCALE}"/>
        </geometry>
      </visual>

      <collision>
        <origin xyz="0.0 0.0 0.0" rpy="0 0 0" />
        <geometry>
          <cylinder length="0.003175" radius=".0127"/>
        </geometry>
      </collision>
    </link>
  </xacro:macro>

  <xacro:macro name="turtlebot_standoff_1in" params="parent number x_loc y_loc z_loc">
    <joint name="standoff_1in_${number}_joint" type="fixed">
      <origin xyz="${x_loc} ${y_loc} ${z_loc}" rpy="0 0 0" />
      <parent link="${parent}"/>
      <child link="standoff_1in_${number}_link" />
    </joint>

    <link name="standoff_1in_${number}_link">
      <inertial>
        <mass value="0.001" />
        <origin xyz="0 0 0" />
        <inertia ixx="0.0001" ixy="0.0" ixz="0.0"
          iyy="0.0001" iyz="0.0"
          izz="0.0001" />
      </inertial>

      <visual>
        <origin xyz=" 0 0 0 " rpy="0 0 0" />
        <geometry>
          <mesh filename="package://turtlebot_description/meshes/stacks/circles/68-04552-1000-RA_Turtlebot_M-F_Standoff.dae" scale="${M_SCALE} ${M_SCALE} ${M_SCALE}"/>
        </geometry>
      </visual>

      <collision>
        <origin xyz="0.0 0.0 0.0" rpy="0 0 0" />
        <geometry>
          <cylinder length="0.0381" radius="0.011113"/>
        </geometry>
      </collision>
    </link>
  </xacro:macro>

  <xacro:macro name="turtlebot_standoff_2in" params="parent number x_loc y_loc z_loc">
    <joint name="standoff_2in_${number}_joint" type="fixed">
      <origin xyz="${x_loc} ${y_loc} ${z_loc}" rpy="0 0 0" />
      <parent link="${parent}"/>
      <child link="standoff_2in_${number}_link" />
    </joint>

    <link name="standoff_2in_${number}_link">
      <inertial>
        <mass value="0.001" />
        <origin xyz="0 0 0" />
        <inertia ixx="0.0001" ixy="0.0" ixz="0.0"
          iyy="0.0001" iyz="0.0"
          izz="0.0001" />
      </inertial>

      <visual>
        <origin xyz=" 0 0 0 " rpy="0 0 0" />
        <geometry>
          <mesh filename="package://turtlebot_description/meshes/stacks/circles/68-04552-2000-RA_Turtlebot_M-F_Standoff.dae" scale="${M_SCALE} ${M_SCALE} ${M_SCALE}"/>
        </geometry>
      </visual>

      <collision>
        <origin xyz="0.0 0.0 0.0" rpy="0 0 0" />
        <geometry>
          <cylinder length="0.0635" radius="0.0381"/>
        </geometry>
      </collision>
    </link>
  </xacro:macro>


  <xacro:macro name="turtlebot_standoff_8in" params="parent number x_loc y_loc z_loc">
    <joint name="standoff_8in_${number}_joint" type="fixed">
      <origin xyz="${x_loc} ${y_loc} ${z_loc}" rpy="0 0 0" />
      <parent link="${parent}"/>
      <child link="standoff_8in_${number}_link" />
    </joint>

    <link name="standoff_8in_${number}_link">
      <inertial>
        <mass value="0.001" />
        <origin xyz="0 0 0" />
        <inertia ixx="0.0001" ixy="0.0" ixz="0.0"
          iyy="0.0001" iyz="0.0"
          izz="0.0001" />
      </inertial>

      <visual>
        <origin xyz=" 0 0 0 " rpy="0 0 0" />
        <geometry>
          <mesh filename="package://turtlebot_description/meshes/stacks/circles/68-02421-8000-RA_Turtlebot_F-F_Standoff.dae" scale="${M_SCALE} ${M_SCALE} ${M_SCALE}"/>
        </geometry>
      </visual>

      <collision>
        <origin xyz="0.0 0.0 0.0" rpy="0 0 0" />
        <geometry>
          <cylinder length="0.2032" radius="0.011113"/>
        </geometry>
      </collision>
    </link>
  </xacro:macro>

  <xacro:macro name="turtlebot_standoff_kinect" params="parent number x_loc y_loc z_loc">
    <joint name="standoff_kinect_${number}_joint" type="fixed">
      <origin xyz="${x_loc} ${y_loc} ${z_loc}" rpy="0 0 0" />
      <parent link="${parent}"/>
      <child link="standoff_kinect_${number}_link" />
    </joint>

    <link name="standoff_kinect_${number}_link">
      <inertial>
        <mass value="0.001" />
        <origin xyz="0 0 0" />
        <inertia ixx="0.0001" ixy="0.0" ixz="0.0"
          iyy="0.0001" iyz="0.0"
          izz="0.0001" />
      </inertial>

      <visual>
        <origin xyz=" 0 0 0 " rpy="0 0 0" />
        <geometry>
          <mesh filename="package://turtlebot_description/meshes/stacks/circles/68-04556-RA_Kinect_Standoff_Assy.dae" scale="${M_SCALE} ${M_SCALE} ${M_SCALE}"/>
        </geometry>
      </visual>

      <collision>
        <origin xyz="0.0 0.0 0.0" rpy="0 0 0" />
        <geometry>
          <cylinder length="0.008585" radius="0.001111"/>
        </geometry>
      </collision>
    </link>
  </xacro:macro>

  <xacro:macro name="stack_circles" params="parent">
    <turtlebot_spacer parent="${parent}" number="0" x_loc="-0.00254" y_loc="0.1114679" z_loc="0.062992"/>
    <turtlebot_spacer parent="${parent}" number="1" x_loc="-0.00254" y_loc="-0.1114679" z_loc="0.062992"/>
    <turtlebot_spacer parent="${parent}" number="2" x_loc="-0.07239" y_loc="-0.1114679" z_loc="0.062992"/>
    <turtlebot_spacer parent="${parent}" number="3" x_loc="-0.07239" y_loc="0.1114679" z_loc="0.062992"/>

    <joint name="plate_0_joint" type="fixed">
      <origin xyz="-0.04334 0  0.06775704" rpy="0 0 0" />
      <parent link="${parent}"/>
      <child link="plate_0_link" />
    </joint>


    <link name="plate_0_link">
      <inertial>
        <mass value="0.01" />
        <origin xyz="0 0 0" />
        <inertia ixx="0.01" ixy="0.0" ixz="0.0"
          iyy="0.01" iyz="0.0"
          izz="0.01" />
      </inertial>
  
      <visual>
        <origin xyz=" 0 0 0 " rpy="0 0 0" />
        <geometry>
          <mesh filename="package://turtlebot_description/meshes/stacks/circles/plate_0_logo.dae"/>
        </geometry>
      </visual>

      <collision>
        <origin xyz="0.0 0.0 0.0" rpy="0 0 0" />
        <geometry>
          <box size="0.233502 0.314845 0.006401"/>
        </geometry>
      </collision>
    </link>

    <turtlebot_standoff_2in parent="${parent}" number="0" x_loc="0.0676402" y_loc="0.1314196" z_loc="0.0709803"/>
    <turtlebot_standoff_2in parent="${parent}" number="1" x_loc="0.0676402" y_loc="-0.1314196" z_loc="0.0709803"/>
    <turtlebot_standoff_2in parent="${parent}" number="2" x_loc="-0.052832" y_loc="-0.1314196" z_loc="0.0709803"/>
    <turtlebot_standoff_2in parent="${parent}" number="3" x_loc="-0.052832" y_loc="0.1314196" z_loc="0.0709803"/>

    <joint name="plate_1_joint" type="fixed">
      <origin xyz="0.04068 0 0.05715" rpy="0 0 0" />
      <parent link="plate_0_link"/>
      <child link="plate_1_link" />
    </joint>

    <link name="plate_1_link">
      <inertial>
        <mass value="0.1" />
        <origin xyz="0 0 0" />
        <inertia ixx="0.01" ixy="0.0" ixz="0.0"
          iyy="0.01" iyz="0.0"
          izz="0.01" />
      </inertial>

      <visual>
        <origin xyz=" 0 0 0 " rpy="0 0 0" />
        <geometry>
          <mesh filename="package://turtlebot_description/meshes/stacks/circles/plate_1_logo.dae"/>
        </geometry>
      </visual>

      <collision>
        <origin xyz="0.0 0.0 0.0" rpy="0 0 0" />
        <geometry>
          <box size="0.314856 0.314856 0.006401"/>
        </geometry>
      </collision>
    </link>

    <turtlebot_standoff_2in parent="standoff_2in_0_link" number="4" x_loc="0" y_loc="0" z_loc="0.05715"/>
    <turtlebot_standoff_2in parent="standoff_2in_1_link" number="5" x_loc="0" y_loc="0" z_loc="0.05715"/>
    <turtlebot_standoff_2in parent="standoff_2in_2_link" number="6" x_loc="0" y_loc="0" z_loc="0.05715"/>
    <turtlebot_standoff_2in parent="standoff_2in_3_link" number="7" x_loc="0" y_loc="0" z_loc="0.05715"/>

    <joint name="plate_2_joint" type="fixed">
      <origin xyz="0 0 0.0572008" rpy="0 0 0" />
      <parent link="plate_1_link"/>
      <child link="plate_2_link" />
    </joint>

    <link name="plate_2_link">
      <inertial>
        <mass value="0.01" />
        <origin xyz="0 0 0" />
        <inertia ixx="0.001" ixy="0.0" ixz="0.0"
          iyy="0.001" iyz="0.0"
          izz="0.001" />
      </inertial>

      <visual>
        <origin xyz=" 0 0 0 " rpy="0 0 0" />
        <geometry>
          <mesh filename="package://turtlebot_description/meshes/stacks/circles/plate_1_logo.dae"/>
        </geometry>
      </visual>

      <collision>
        <origin xyz="0.0 0.0 0.0" rpy="0 0 0" />
        <geometry>
          <box size="0.314856 0.314856 0.006401"/>
        </geometry>
      </collision>
    </link>

    <turtlebot_standoff_kinect parent="plate_2_link" number="0" x_loc="-0.1024382" y_loc="0.098" z_loc="0.0032004"/>
    <turtlebot_standoff_kinect parent="plate_2_link" number="1" x_loc="-0.1024382" y_loc="-0.098" z_loc="0.0032004"/>

    <turtlebot_standoff_8in parent="standoff_2in_4_link" number="0" x_loc="0" y_loc="0" z_loc="0.05715"/>
    <turtlebot_standoff_8in parent="standoff_2in_5_link" number="1" x_loc="0" y_loc="0" z_loc="0.05715"/>
    <turtlebot_standoff_8in parent="standoff_2in_6_link" number="2" x_loc="0" y_loc="0" z_loc="0.05715"/>
    <turtlebot_standoff_8in parent="standoff_2in_7_link" number="3" x_loc="0" y_loc="0" z_loc="0.05715"/>

    <joint name="plate_3_joint" type="fixed">
      <origin xyz="-0.01316 0 0.2063496" rpy="0 0 0" />
      <parent link="plate_2_link"/>
      <child link="plate_3_link" />
    </joint>

    <link name="plate_3_link">
      <inertial>
        <mass value="0.01" />
        <origin xyz="0 0 0" />
        <inertia ixx="0.0001" ixy="0.0" ixz="0.0"
          iyy="0.0001" iyz="0.0"
          izz="0.0001" />
      </inertial>
  
      <visual>
        <origin xyz=" 0 0 0 " rpy="0 0 0" />
        <geometry>
          <mesh filename="package://turtlebot_description/meshes/stacks/circles/plate_2_logo.dae"/>
        </geometry>
      </visual>

      <collision>
        <origin xyz="0.0 0.0 0.0" rpy="0 0 0" />
        <geometry>
          <box size="0.288 0.315 0.006401"/>
        </geometry>
      </collision>
    </link>
  </xacro:macro>
</robot>
