<robot xmlns:xacro="http://ros.org/wiki/xacro" name="apartment">


  <link name="apartment_root">
    <origin rpy="0 0 0" xyz="0 0 0"/>
  </link>

  <joint name="middle_of_the_room_joint" type="fixed">
    <origin rpy="0 0 0" xyz="8.85 1.75 0.0"/>
    <parent link="apartment_root"/>
    <child link="middle_of_the_room"/>
  </joint>
  <link name="middle_of_the_room"/>

  <!-- things and stuff -->
    <joint name="walls_joint" type="fixed">
      <origin rpy="0 0 0" xyz="0 0 -0.2"/>
      <parent link="middle_of_the_room"/>
      <child link="walls"/>
    </joint>
    <link name="walls">
      <visual>
        <geometry>
          <mesh filename="package://iai_apartment/meshes/visual/walls.dae"/>
        </geometry>
      </visual>
      <!--collision>
        <geometry>
          <mesh filename="package://iai_apartment/meshes/collision/walls.stl" />
        </geometry>
      </collision-->
    </link>
    <joint name="windows_joint" type="fixed">
      <origin rpy="0 0 0" xyz="0 0 -0.2"/>
      <parent link="middle_of_the_room"/>
      <child link="windows"/>
    </joint>
    <link name="windows">
      <visual>
        <geometry>
          <mesh filename="package://iai_apartment/meshes/visual/windows.dae"/>
        </geometry>
      </visual>
      <!--collision>
        <geometry>
          <mesh filename="package://iai_apartment/meshes/collision/windows.obj"/>
        </geometry>
      </collision-->
    </link>

    <!-- Collision okay Walls -->
    <!-- From the door side being wall 1, turn right and count the walls. -->
      <joint name="wall_coloksu_wall1_joint" type="fixed">
        <origin xyz="0.6 -1.615 1.53" rpy="0 0 -1.57"/>
        <parent link="middle_of_the_room"/>
        <child link="wall_coloksu_wall1"/>
      </joint>
      <link name="wall_coloksu_wall1">
        <collision>
          <origin rpy="0 1.57 0"/>
          <geometry>
            <box size="3.05 18.95 0.003"/>
          </geometry>
        </collision>
      </link>

      <joint name="wall_coloksu_wall2_joint" type="fixed">
        <origin xyz="-8.855 0.782 1.53" rpy="0 0 3.14"/>
        <parent link="middle_of_the_room"/>
        <child link="wall_coloksu_wall2"/>
      </joint>
      <link name="wall_coloksu_wall2">
        <collision>
          <origin rpy="0 1.57 0"/>
          <geometry>
            <box size="3.05 4.808 0.003"/>
          </geometry>
        </collision>
      </link>

      <joint name="wall_coloksu_wall3_joint" type="fixed">
        <origin xyz="0.6 3.180 1.53" rpy="0 0 1.57"/>
        <parent link="middle_of_the_room"/>
        <child link="wall_coloksu_wall3"/>
      </joint>
      <link name="wall_coloksu_wall3">
        <collision>
          <origin rpy="0 1.57 0"/>
          <geometry>
            <box size="3.05 18.95 0.003"/>
          </geometry>
        </collision>
      </link>

      <joint name="wall_coloksu_wall4_joint" type="fixed">
        <origin xyz="10.069 0.782 1.53" rpy="0 0 0"/>
        <parent link="middle_of_the_room"/>
        <child link="wall_coloksu_wall4"/>
      </joint>
      <link name="wall_coloksu_wall4">
        <collision>
          <origin rpy="0 1.57 0"/>
          <geometry>
            <box size="3.05 4.808 0.003"/>
          </geometry>
        </collision>
      </link>

    <joint name="wardrobe_joint" type="fixed">
      <origin rpy="0 0 0" xyz="9.7082 -0.6331 0.0"/>
      <parent link="middle_of_the_room"/>
      <child link="wardrobe"/>
    </joint>
    <link name="wardrobe">
      <visual>
        <geometry>
          <mesh filename="package://iai_apartment/meshes/visual/wardrobe.dae"/>
        </geometry>
      </visual>
      <collision>
        <origin rpy="0 0 0" xyz="-0.2693 -0.4482 0.0750"/>
        <geometry>
          <box size="0.08 0.08 0.15"/>
        </geometry>
      </collision>
      <collision>
        <origin rpy="0 0 0" xyz="0.10603 -0.4482 0.0750"/>
        <geometry>
          <box size="0.08 0.08 0.15"/>
        </geometry>
      </collision>
      <collision>
        <origin rpy="0 0 0" xyz="-0.2693 0.4482 0.0750"/>
        <geometry>
          <box size="0.08 0.08 0.15"/>
        </geometry>
      </collision>
      <collision>
        <origin rpy="0 0 0" xyz="0.10603 0.4482 0.0750"/>
        <geometry>
          <box size="0.08 0.08 0.15"/>
        </geometry>
      </collision>
      <collision>
        <origin rpy="0 0 0" xyz="-0.0805 0.0000 0.16345"/>
        <geometry>
          <box size="0.487 1.0000 0.0269"/>
        </geometry>
      </collision>
      <collision>
        <origin rpy="0 0 0" xyz="-0.0805 0.48965 0.975"/>
        <geometry>
          <box size="0.487 0.0207 1.65"/>
        </geometry>
      </collision>
      <collision>
        <origin rpy="0 0 0" xyz="-0.0896 0.0000 0.975"/>
        <geometry>
          <box size="0.4318 0.018568 1.65"/>
        </geometry>
      </collision>
      <collision>
        <origin rpy="0 0 0" xyz="-0.0805 -0.48965 0.975"/>
        <geometry>
          <box size="0.487 0.0207 1.65"/>
        </geometry>
      </collision>
      <collision>
        <origin rpy="0 0 0" xyz="0.14465 0.0000 0.975"/>
        <geometry>
          <box size="0.0367 1.0000 1.65"/>
        </geometry>
      </collision>
      <collision>
        <origin rpy="0 0 0" xyz="0.14465 0.0000 0.975"/>
        <geometry>
          <box size="0.0367 1.0000 1.65"/>
        </geometry>
      </collision>
      <collision>
        <origin rpy="0 0 0" xyz="-0.0805 0.0000 1.7865"/>
        <geometry>
          <box size="0.487 1.0000 0.027"/>
        </geometry>
      </collision>
      <collision>
        <origin rpy="0 0 0" xyz="-0.08861 -0.244343 0.5727"/>
        <geometry>
          <box size="0.4299 0.469957 0.0118"/>
        </geometry>
      </collision>
      <collision>
        <origin rpy="0 0 0" xyz="-0.08861 -0.244343 0.974836"/>
        <geometry>
          <box size="0.4299 0.469957 0.0118"/>
        </geometry>
      </collision>
      <collision>
        <origin rpy="0 0 0" xyz="-0.08861 -0.244343 1.37686"/>
        <geometry>
          <box size="0.4299 0.469957 0.0118"/>
        </geometry>
      </collision>
      <collision>
        <origin rpy="1.5708 0 0" xyz="-0.086923 0.244373 1.66898"/>
        <geometry>
          <cylinder radius="0.0075" length="0.469897"/>
        </geometry>
      </collision>
    </link>
    <joint name="wardrobe_door_left_joint" type="revolute">
      <origin rpy="0 0 0" xyz="-0.3246 0.5 0.0000"/>
      <parent link="wardrobe"/>
      <child link="wardrobe_door_left"/>
      <axis xyz="0 0 -1"/>
      <limit effort="1000.0" lower="0.0" upper="1.5708" velocity="1.5708"/>
    </joint>
    <link name="wardrobe_door_left">
      <visual>
        <geometry>
          <mesh filename="package://iai_apartment/meshes/visual/wardrobe_door_left.dae"/>
        </geometry>
      </visual>
      <collision>
        <geometry>
          <mesh filename="package://iai_apartment/meshes/collision/wardrobe_door_left.obj"/>
        </geometry>
      </collision>
    </link>
    <joint name="wardrobe_door_right_joint" type="revolute">
      <origin rpy="0 0 0" xyz="-0.3246 -0.5 0.0000"/>
      <parent link="wardrobe"/>
      <child link="wardrobe_door_right"/>
      <axis xyz="0 0 1"/>
      <limit effort="1000.0" lower="0.0" upper="1.5708" velocity="1.5708"/>
    </joint>
    <link name="wardrobe_door_right">
      <visual>
        <geometry>
          <mesh filename="package://iai_apartment/meshes/visual/wardrobe_door_right.dae"/>
        </geometry>
      </visual>
      <collision>
        <geometry>
          <mesh filename="package://iai_apartment/meshes/collision/wardrobe_door_right.obj"/>
        </geometry>
      </collision>
    </link>

    <joint name="armchair_joint" type="fixed">
      <origin rpy="0 0 1.9199" xyz="7.9688 -0.3791 0.0"/>
      <parent link="middle_of_the_room"/>
      <child link="armchair"/>
    </joint>
    <link name="armchair">
      <visual>
        <geometry>
          <mesh filename="package://iai_apartment/meshes/visual/armchair.dae"/>
        </geometry>
      </visual>
      <collision>
        <geometry>
          <mesh filename="package://iai_apartment/meshes/collision/armchair.obj"/>
        </geometry>
      </collision>
    </link>
    <joint name="sofa_joint" type="fixed">
      <origin rpy="0 0 0" xyz="8.1986 2.4096 0.0"/>
      <parent link="middle_of_the_room"/>
      <child link="sofa"/>
    </joint>
    <link name="sofa">
      <visual>
        <geometry>
          <mesh filename="package://iai_apartment/meshes/visual/sofa.dae"/>
        </geometry>
      </visual>
      <collision>
        <geometry>
          <mesh filename="package://iai_apartment/meshes/collision/sofa.obj"/>
        </geometry>
      </collision>
    </link>
    <joint name="coffee_table_joint" type="fixed">
      <origin rpy="0 0 1.5708" xyz="7.8034 1.02957 0.0"/>
      <parent link="middle_of_the_room"/>
      <child link="coffee_table"/>
    </joint>
    <link name="coffee_table">
      <visual>
        <geometry>
          <mesh filename="package://iai_apartment/meshes/visual/coffee_table.dae"/>
        </geometry>
      </visual>
      <collision>
        <origin rpy="0 0 0" xyz="0.0000 0.0000 0.02977"/>
        <geometry>
          <box size="0.58 1.08 0.05954"/>
        </geometry>
      </collision>
      <collision>
        <origin rpy="0 0 0" xyz="-0.022101 0.0000 0.06552"/>
        <geometry>
          <box size="0.6106 0.4 0.01196"/>
        </geometry>
      </collision>
      <collision>
        <origin rpy="0 0 0" xyz="0.0000 0.39975 0.220625"/>
        <geometry>
          <box size="0.7 0.4 0.32"/>
        </geometry>
      </collision>
      <collision>
        <origin rpy="0 0 0" xyz="0.0000 -0.39975 0.220625"/>
        <geometry>
          <box size="0.7 0.4 0.32"/>
        </geometry>
      </collision>
      <collision>
        <origin rpy="0 0 0" xyz="0.316343 0.0000 0.22"/>
        <geometry>
          <box size="0.0673 0.4 0.32"/>
        </geometry>
      </collision>
      <collision>
        <origin rpy="0 0 0" xyz="0.0000 0.0000 0.39"/>
        <geometry>
          <box size="0.7 1.2 0.02"/>
        </geometry>
      </collision>
    </link>
    <joint name="coffee_table_drawer_joint" type="prismatic">
      <parent link="coffee_table"/>
      <child link="coffee_table_drawer"/>
      <axis xyz="-1 0 0"/>
      <limit effort="1000.0" lower="0.0" upper="0.5" velocity="0.5"/>
    </joint>
    <link name="coffee_table_drawer">
      <visual>
        <geometry>
          <mesh filename="package://iai_apartment/meshes/visual/coffee_table_drawer.dae"/>
        </geometry>
      </visual>
      <collision>
        <origin rpy="0 0 0" xyz="-0.338806 0.0000 0.21892"/>
        <geometry>
          <box size="0.0214 0.396 0.31569"/>
        </geometry>
      </collision>
      <collision>
        <origin rpy="0 0 0" xyz="-0.051066 0.0000 0.107979"/>
        <geometry>
          <box size="0.5521 0.3454 0.02144"/>
        </geometry>
      </collision>
      <collision>
        <origin rpy="0 0 0" xyz="0.207974 0.0000 0.238907"/>
        <geometry>
          <box size="0.0214 0.3486 0.2398"/>
        </geometry>
      </collision>
      <collision>
        <origin rpy="0 0 0" xyz="-0.051066 -0.186206 0.226597"/>
        <geometry>
          <box size="0.5521 0.0214 0.26425"/>
        </geometry>
      </collision>
      <collision>
        <origin rpy="0 0 0" xyz="-0.051066 0.186206 0.226597"/>
        <geometry>
          <box size="0.5521 0.0214 0.26425"/>
        </geometry>
      </collision>
    </link>
    <joint name="bedside_table_joint" type="fixed">
      <origin rpy="0 0 0" xyz="7.2110 0.1296 0.0"/>
      <parent link="middle_of_the_room"/>
      <child link="bedside_table"/>
    </joint>
    <link name="bedside_table">
      <visual>
        <geometry>
          <mesh filename="package://iai_apartment/meshes/visual/bedside_table.dae"/>
        </geometry>
      </visual>
      <collision>
        <origin rpy="0 0 0" xyz="0.0000 0.0000 0.230"/>
        <geometry>
          <box size="0.312 0.312 0.460"/>
        </geometry>
      </collision>
    </link>

  <!-- kitchen, kitchen on the walls -->
    <xacro:include filename="$(find iai_apartment)/urdf/kitchen.xarco"/>
    <xacro:kitchen_macro name="kitchen_base" parent="apartment_root">
      <origin xyz="-0.03 0.75 0.005"/>
    </xacro:kitchen_macro>

</robot>
