This post addresses the challenges of disabling collisions between specific links in a UR robot simulation, particularly when adding a custom end-effector (EE). The previous post, Add an EE to my Robot, detailed how to integrate a new EE without causing collisions with the robot itself, specifically the flange and last wrist link. While that solution resolved the initial collision issue, it highlighted a problem with implementing the <disable_collisions>
tag within the URDF.
Understanding the <disable_collisions>
Tag in URDF
The <disable_collisions>
tag in a URDF (Unified Robot Description Format) file allows you to selectively disable collision checking between specific pairs of links. This is crucial for scenarios where:
- Attached Objects: You have objects attached to the robot, like tools or sensors, that are physically connected and should not trigger collision events.
- Close Proximity: Certain robot links might operate in close proximity by design and shouldn’t trigger unnecessary collisions.
- Simplified Simulations: Disabling collisions can improve simulation performance, especially in complex environments.
The tag requires specifying the two links involved: link1
and link2
. Correct implementation prevents the physics engine from detecting collisions between these specified links.
Troubleshooting <disable_collisions>
in a UR Macro
The issue encountered stemmed from the ineffectiveness of the <disable_collisions>
tag within a ur_macro.xacro
file for a UR robot. The goal was to disable collisions between a custom welding tool (the EE) and a Zivid camera attached to the robot. Below is the relevant section of the ur_macro.xacro
file, demonstrating the attempted implementation:
<link name="${tf_prefix}tool0">
<xacro:get_visual_params name="tool0" type="visual_offset"/>
<visual>
<origin xyz="0 0 ${visual_params}" rpy="0 0 0"/>
<geometry>
<xacro:get_mesh name="tool0" type="visual"/>
</geometry>
</visual>
<collision>
<origin xyz="0 0 ${visual_params}" rpy="0 0 0"/>
<geometry>
<xacro:get_mesh name="tool0" type="collision"/>
</geometry>
</collision>
</link>
<joint name="${tf_prefix}flange-tool0" type="fixed">
<origin xyz="0 0 0" rpy="${pi/2.0} 0 ${pi/2.0}"/>
<parent link="${tf_prefix}flange"/>
<child link="${tf_prefix}tool0"/>
</joint>
<link name="${tf_prefix}zivid">
<xacro:get_visual_params name="zivid" type="visual_offset"/>
<visual>
<origin xyz="0 0 ${visual_params}" rpy="0 0 0"/>
<geometry>
<xacro:get_mesh name="zivid" type="visual"/>
</geometry>
</visual>
<collision>
<origin xyz="0 0 ${visual_params}" rpy="0 0 0"/>
<geometry>
<xacro:get_mesh name="zivid" type="collision"/>
</geometry>
</collision>
</link>
<joint name="${tf_prefix}zivid-tool0" type="fixed">
<origin xyz="0 0 0" rpy="0 0 0"/>
<parent link="${tf_prefix}tool0"/>
<child link="${tf_prefix}zivid"/>
</joint>
<!-- Attempt to disable collision -->
<disable_collisions link1="${tf_prefix}zivid" link2="${tf_prefix}tool0" />
Potential Causes and Solutions
Several factors can contribute to the <disable_collisions>
tag not working as expected:
- Typographical Errors: Incorrect link names in the tag will prevent it from functioning. Double-check for typos and ensure names match the defined link names precisely.
- Parent-Child Relationships: Disabling collisions between directly connected parent-child links through a fixed joint is often redundant, as some simulators automatically handle this. Try disabling collisions between links that are not directly connected in the kinematic chain. For instance, if the camera is attached to the tool0, try disabling collisions between the camera and a link further up the chain.
- Mesh Complexity: Highly complex collision meshes can sometimes lead to unexpected behavior. Simplifying the collision meshes for the involved links might resolve the issue.
- Simulator Specifics: Certain simulators may have specific requirements or limitations regarding collision disabling. Consult the documentation for your chosen simulator (e.g., Gazebo, PyBullet) for potential workarounds.
Conclusion
Successfully disabling collisions is crucial for accurate and efficient robot simulations. By carefully reviewing the URDF for errors, understanding parent-child relationships, considering mesh complexity, and consulting simulator-specific documentation, you can effectively utilize the <disable_collisions>
tag and ensure your simulations behave as intended. Remember to thoroughly test any changes to verify the desired outcome.