<?xml version="1.0"?>
<!--

  Copyright (c) 2021 PAL Robotics S.L. All rights reserved.
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
      http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

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

  <xacro:arg name="laser_model" default="sick-571"/> <!-- false, hokuyo, sick-551, sick-561, sick-571-->
  <xacro:arg name="rgbd_sensors" default="false"/> <!-- false, true-->
  <xacro:property name="laser_model" value="$(arg laser_model)" />
  <xacro:property name="rgbd_sensors" value="$(arg rgbd_sensors)"/>
  <xacro:if value="${laser_model not in ['false', False, 'sick-551', 'sick-561', 'sick-571', 'hokuyo']}">
    <xacro:wrong_laser_model/>
  </xacro:if>
  <xacro:arg name="multiple" default="false"/>
  <xacro:arg name="namespace" default=""/>
  <xacro:property name="is_multiple" value="$(arg multiple)" />
  <xacro:property name="nsp" value="$(arg namespace)" />
  <!-- The following included files set up definitions of parts of the robot body -->
  <!-- Base -->
  <xacro:include filename="$(find pmb2_description)/urdf/base/base_sensors.urdf.xacro" />

  <!-- Generic simulator_gazebo plugins -->
  <xacro:include filename="$(find pmb2_description)/gazebo/gazebo.urdf.xacro" />
  <!-- Materials for visualization -->
  <xacro:include filename="$(find pmb2_description)/urdf/materials.urdf.xacro" />

  <!-- Now we can start using the macros included above to define the actual robot -->
  <xacro:base_sensors name="base" laser_model="$(arg laser_model)" sonars="true"/>

  <!-- RGBD Sensors -->
  <xacro:if value="${rgbd_sensors}">
    <xacro:include filename="$(find pmb2_description)/urdf/cameras_add_on/cameras_add_on.urdf.xacro" />
    <xacro:cameras_add_on name="cameras_add_on" parent="base_link"/>
  </xacro:if>
</robot>
