# How to add a table surface to the ur5 urdf model

Hi all,

I need some help for customizing a urdf file based on urdf available from standard repositories. I have a ur5 robotic arm. For this arm, we have urdf and xacro available in ur_description package of universal_robot repository. Basically, our ur5 robotic arm is mounted on a surface. I want to have a "plane surface ( table ) beneath the base of the robotic arm" modeled in the urdf. This way I can include it in collision checking while generating initial configuration based on MSA ( moveit setup assistant). I took some help from similar issues posted here and here. My initial try for creating xacro called first.xacro looks as follows.

<?xml version="1.0" ?>
<robot name="indtech_cell" xmlns:xacro="http://ros.org/wiki/xacro">
<xacro:include filename="$(find ur_description)/urdf/ur5_robot.urdf.xacro" /> <link name="table"> <visual> <geometry> <box size="2 1.5 0.05"/> </geometry> <material name="white"> <color rgba="1 1 1 1"/> </material> </visual> <collision> <geometry> <box size="2 1.5 0.05"/> </geometry> </collision> </link> <joint name="world_to_table" type="fixed"> <parent link="world"/> <child link="table"/> <origin xyz="0 0 1" rpy="0 0 0"/> </joint> <joint name="table_to_robot" type="fixed"> <parent link="table"/> <child link="base_link"/> <origin xyz="0 0 0" rpy="0 0 0"/> </joint> </robot>  However, when I run the following sequence of commands. xacro src/indtech_pkg/config/first.xacro > src/indtech_pkg/config/first.urdf check_urdf src/indtech_pkg/config/first.urdf  I receive the following output. ---------- Successfully Parsed XML --------------- root Link: world has 2 child(ren) child(1): base_link child(1): base child(2): shoulder_link child(1): upper_arm_link child(1): forearm_link child(1): wrist_1_link child(1): wrist_2_link child(1): wrist_3_link child(1): ee_link child(2): tool0 child(2): table child(1): base_link child(1): base child(2): shoulder_link child(1): upper_arm_link child(1): forearm_link child(1): wrist_1_link child(1): wrist_2_link child(1): wrist_3_link child(1): ee_link child(2): tool0  My thinking was that, it should be the root element world and then the only child should be the second child tree given above. When, I try to input first.xacro within MSA though, it loads correctly, and it shows the following. which is ok, My main objective here is to include the table as part of MSA collision checking, so that, when using OMPL planners, we do not receive any plans where the robotic arm is going under the surface of the table. Please can you share your help, suggestion in this regards. thanks, Zahid edit retag close merge delete ## 1 Answer Sort by » oldest newest most voted With some edits I have the following workspace.xacro file for my workspace ( ur5 robotic arm and table surface). <?xml version="1.0" ?> <robot name="ur5" xmlns:xacro="http://ros.org/wiki/xacro"> <xacro:include filename="$(find ur_description)/urdf/ur5.urdf.xacro" />
<xacro:ur5_robot prefix="" joint_limited="true"/>

<visual>
<geometry>
<box size="2 1.5 0.05"/>
</geometry>
<material name="white">
<color rgba="1 1 1 1"/>
</material>
</visual>
<collision>
<geometry>
<box size="2 1.5 0.05"/>
</geometry>
</collision>

<joint name="world_to_table" type="fixed">
<origin xyz="0 0 1" rpy="0 0 0"/>
</joint>

<joint name="table_to_robot" type="fixed">
<origin xyz="0 0 0" rpy="0 0 0"/>
</joint>

</robot>


With this edit, I now have a single link tree, which seems to be correct.

xacro workspace.xacro > workspace.urdf
check_urdf workspace.urdf

robot name is: ur5
---------- Successfully Parsed XML ---------------
root Link: world has 1 child(ren)
child(1):  table
child(1):  base
child(2):  tool0


Is this sufficient to add a collision surface in this way? The main objective is to limit the movements of the robotic arm within the space above this surface.

thanks,

Zahid

more

You shouldn't add answers to questions. But adding boxes to limit the workspace of the robot is fine. See here for another example of UR5s in a scene.

( 2022-02-05 20:14:59 -0500 )edit

Hi @fvd, thanks for the comment. Is it necessary to create mesh files (.stl) for the table and use that in the urdf of the workcell. Or for a simple purpose (constraining the workspace ), is the above way of creating a flat surface (table) beneath the ur5 robotic arm is correct? In my tests, I noticed that for some goal poses, the robotic arm ur5 was still going down the table surface. thanks,

( 2022-02-15 13:21:31 -0500 )edit