<?xml version="1.0"?>
<robot xmlns:xacro="http://ros.org/wiki/xacro">

  <!-- from mimic_joint_gazebo_tutorial by @mintar, refer: https://github.com/mintar/mimic_joint_gazebo_tutorial -->
  <xacro:macro name="mimic_joint_plugin_gazebo" params="name_prefix following_joint mimic_joint has_pid:=false multiplier:=1.0 offset:=0 sensitiveness:=0.0 max_effort:=1.0">
    <gazebo>
      <plugin name="${name_prefix}mimic_joint_plugin" filename="libgazebo_mimic_joint_plugin.so">
        <joint>${following_joint}</joint>
        <mimicJoint>${mimic_joint}</mimicJoint>
        <xacro:if value="${has_pid}">                     <!-- if set to true, PID parameters from "/gazebo_ros_control/pid_gains/${mimic_joint}" are loaded -->
          <hasPID />
        </xacro:if>
        <multiplier>${multiplier}</multiplier>
        <offset>${offset}</offset>
        <sensitiveness>${sensitiveness}</sensitiveness>   <!-- if absolute difference between setpoint and process value is below this threshold, do nothing; 0.0 = disable [rad] -->
        <maxEffort>${max_effort}</maxEffort>              <!-- only taken into account if has_pid:=true [Nm] -->
      </plugin>
    </gazebo>
  </xacro:macro>

  <xacro:macro name="xarm_gripper_gazebo" params="prefix">

    <gazebo reference="${prefix}xarm_gripper_base_link">
      <selfCollide>false</selfCollide>
    </gazebo>

    <gazebo reference="${prefix}left_outer_knuckle">
      <selfCollide>false</selfCollide>
    </gazebo>

    <gazebo reference="${prefix}left_finger">
      <selfCollide>false</selfCollide>
    </gazebo>

    <gazebo reference="${prefix}left_inner_knuckle">
      <selfCollide>false</selfCollide>
    </gazebo>

    <gazebo reference="${prefix}right_outer_knuckle">
      <selfCollide>false</selfCollide>
    </gazebo>

    <gazebo reference="${prefix}right_finger">
      <selfCollide>false</selfCollide>
    </gazebo>

    <gazebo reference="${prefix}right_inner_knuckle">
      <selfCollide>false</selfCollide>
    </gazebo>

  </xacro:macro>

</robot>