<?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">

  <xacro:include filename="$(find pmb2_description)/urdf/sensors/sick_tim551_laser.gazebo.xacro" />

  <xacro:macro name="sick_tim551_laser" params="name parent *origin ros_topic update_rate min_angle max_angle">

     <link name="${name}_link" type="laser">
      <inertial>
        <origin xyz="-0.02559000000 -0.00056000000 -0.05732000000" rpy="0 0 0"/>
        <mass value="0.28922000000"/>
        <inertia ixx="0.00002628919" ixy="0.00000024298" ixz="-0.00000368129"
                 iyy="0.00003374542" iyz="-0.00000001330"
                 izz="0.00005832599"/>
      </inertial>
      <visual>
        <origin xyz="0 0 0" rpy="0 0 0" />
        <geometry>
          <mesh filename="package://pmb2_description/meshes/sensors/sick_tim551.stl"/>
        </geometry>
        <material name="DarkGrey"/>
      </visual>
    </link>

    <joint name="${name}_joint" type="fixed">
      <axis xyz="0 1 0"/>
      <xacro:insert_block name="origin"/>
      <parent link="${parent}_link"/>
      <child  link="${name}_link"/>
    </joint>

    <!-- gazebo extensions -->
    <xacro:sick_tim551_laser_gazebo name="${name}" ros_topic="${ros_topic}" update_rate="${update_rate}" min_angle="${min_angle}" max_angle="${max_angle}" />

  </xacro:macro>

</robot>
