xArm-Developer / xarm_ros

ROS packages for robotic products from UFACTORY
https://www.ufactory.cc/
BSD 3-Clause "New" or "Revised" License
221 stars 159 forks source link

Using visual and collision models of custom gripper #203

Open Gregor-G opened 1 year ago

Gregor-G commented 1 year ago

Hi, maybe I am wrong but it seems that it is not possible to automatically use collision mesh of the custom end-effector. In the RVIZ I wanted to have both models: precise = visual and simplified = collision. In the xarm_description/meshes I created a custom_directory with visual and collision folders and proper stl files with the same names. I adjusted the demo.launch. As an argument I set add_other_geometry as true and geometry_type as mesh. I recommend to add an information in manual or change the code in file other_geometry.urdf.xacro as follows:

      <visual>
        <origin xyz="${_origin_xyz}" rpy="${_origin_rpy}" />
        <geometry>
          <xacro:if value="${geometry_type == 'mesh'}">
            <xacro:common_link_mesh mesh_filename="other/visual/${_mesh_filename}" use_mesh_path="${use_mesh_path}" />
          </xacro:if>
       ...

and

     <collision>
        <origin xyz="${_origin_xyz}" rpy="${_origin_rpy}" />
        <geometry>
          <xacro:if value="${geometry_type == 'mesh'}">
            <xacro:common_link_mesh mesh_filename="other/collision/${_mesh_filename}" use_mesh_path="${use_mesh_path}" />
          </xacro:if>
       ...
penglongxiang commented 1 year ago

Thanks for your suggestion, we will consider this modification in later commits. In the mean time, you may fork and modify the code to suit your needs.