<?xml version='1.0' encoding='utf-8'?>
<robot xmlns:xacro="http://ros.org/wiki/xacro" name="xarm$(arg dof)">
  <xacro:arg name="prefix" default=""/>
  <xacro:arg name="hw_ns" default="xarm"/>
  <xacro:arg name="limited" default="false"/>
  <xacro:arg name="effort_control" default="false"/>
  <xacro:arg name="velocity_control" default="false"/>
  <xacro:arg name="add_gripper" default="false"/>
  <xacro:arg name="add_vacuum_gripper" default="false"/>
  <xacro:arg name="dof" default="7"/>
  <xacro:arg name="robot_type" default="xarm"/>
  <xacro:arg name="ros2_control_plugin" default="uf_robot_hardware/UFRobotSystemHardware"/>
  <xacro:arg name="ros2_control_params" default="$(find xarm_controller)/config/xarm$(arg dof)_controllers.yaml"/>

  <xacro:arg name="add_realsense_d435i" default="false"/>

  <xacro:arg name="add_other_geometry" default="false"/>
  <xacro:arg name="geometry_type" default="box"/>
  <xacro:arg name="geometry_mass" default="0.1"/>
  <xacro:arg name="geometry_height" default="0.1"/>
  <xacro:arg name="geometry_radius" default="0.1"/>
  <xacro:arg name="geometry_length" default="0.1"/>
  <xacro:arg name="geometry_width" default="0.1"/>
  <xacro:arg name="geometry_mesh_filename" default=""/>
  <xacro:arg name="geometry_mesh_origin_xyz" default="0 0 0"/>
  <xacro:arg name="geometry_mesh_origin_rpy" default="0 0 0"/>
  <xacro:arg name="geometry_mesh_tcp_xyz" default="0 0 0"/>
  <xacro:arg name="geometry_mesh_tcp_rpy" default="0 0 0"/>

  <xacro:arg name="robot_ip" default=""/>
  <xacro:arg name="report_type" default="normal"/>
  <xacro:arg name="baud_checkset" default="true"/>
  <xacro:arg name="default_gripper_baud" default="2000000"/>

  <!-- gazebo_plugin -->
  <xacro:include filename="$(find custom_xarm_description)/urdf/common/common.gazebo.xacro" />
  <xacro:gazebo_ros_control_plugin ros2_control_params="$(arg ros2_control_params)"/>
  
  <!-- load xarm device -->
  <xacro:include filename="$(find custom_xarm_description)/urdf/xarm_device_macro.xacro" />
  <xacro:xarm_device prefix="$(arg prefix)" namespace="$(arg hw_ns)" limited="$(arg limited)" 
    effort_control="$(arg effort_control)" velocity_control="$(arg velocity_control)"
    add_gripper="$(arg add_gripper)" add_vacuum_gripper="$(arg add_vacuum_gripper)" dof="$(arg dof)" 
    ros2_control_plugin="$(arg ros2_control_plugin)" robot_type="$(arg robot_type)" 
    load_gazebo_plugin="false" ros2_control_params="$(arg ros2_control_params)"
    add_realsense_d435i="$(arg add_realsense_d435i)" 
    add_other_geometry="$(arg add_other_geometry)" 
    geometry_type="$(arg geometry_type)" geometry_mass="$(arg geometry_mass)"
    geometry_height="$(arg geometry_height)" geometry_radius="$(arg geometry_radius)"
    geometry_length="$(arg geometry_length)" geometry_width="$(arg geometry_width)"
    geometry_mesh_filename="$(arg geometry_mesh_filename)"
    geometry_mesh_origin_xyz="$(arg geometry_mesh_origin_xyz)" geometry_mesh_origin_rpy="$(arg geometry_mesh_origin_rpy)"
    geometry_mesh_tcp_xyz="$(arg geometry_mesh_tcp_xyz)" geometry_mesh_tcp_rpy="$(arg geometry_mesh_tcp_rpy)"
    robot_ip="$(arg robot_ip)" report_type="$(arg report_type)"
    baud_checkset="$(arg baud_checkset)" default_gripper_baud="$(arg default_gripper_baud)"/>

</robot>
