Ask Your Question

Gazebo sim UR10e plus Robotiq gripper

asked 2021-07-01 09:18:49 -0600

nndei gravatar image

Dear All,

I am trying to create a Gazebo simulation of an assembled robot comprised of the Universal Robots UR10e arm and an attached Robotiq 3-fingers gripper. I am using the ros-industrial packages for both: UR10e, Robotiq.

I have created a package for my custom solution, called cobot_description and there I have a urdf folder containing my custom urdf file. I have asked for help in a previous question in order to create such URDF and now it spawns nicely in RViz (I am using Visual Studio Code's ROS extension to see it inside of an RViz windows in Visual Studio).

I have now moved ahead trying to create the Gazebo Sim for the robot. To that end, I have created a new package in the same directory of the previously introduced cobot description one, called cobot_gazebo. Here, I have created a launch folder, where I have created a file called cobot_empty_world.launch which is intended to spawn my assembled robot in Gazebo.

The following is the code I have written to spawn it:

<?xml version="1.0"?>
  <!-- Args copied from ur10e.launch -->
  <arg name="limited" default="false"  doc="If true, limits joint range [-PI, PI] on all joints." />
  <arg name="paused" default="false" doc="Starts gazebo in paused mode" />
  <arg name="gui" default="true" doc="Starts gazebo gui" />

  <!-- Startup of empty Gazebo world -->
  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" default="worlds/"/>
    <arg name="paused" value="$(arg paused)"/>
    <arg name="gui" value="$(arg gui)"/>

  <!-- Upload the ur10e + robotiq to param server --> 
  <include file="$(find cobot_description)/launch/ur10e_robotiq_upload.launch">

  <!-- push robot_description to factory and spawn robot in gazebo -->
  <node name="spawn_gazebo_model" pkg="gazebo_ros" type="spawn_model" args="-urdf -param robot_description -model robot -z 0.1" respawn="false" output="screen" />

  <!-- At this point, the Robotiq launch file ends, while the ur10e continues with controllers -->

  <!-- Code from ur10e.launch -->
  <include file="$(find ur_e_gazebo)/launch/controller_utils.launch"/>
  <!-- start this controller -->
  <rosparam file="$(find ur_e_gazebo)/controller/arm_controller_ur10e.yaml" command="load"/>
  <node name="arm_controller_spawner" pkg="controller_manager" type="controller_manager" args="spawn arm_controller" respawn="false" output="screen"/>
  <!-- load other controllers -->
  <node name="ros_control_controller_manager" pkg="controller_manager" type="controller_manager" respawn="false" output="screen" args="load joint_group_position_controller" />


As you can tell from the code, I have copied its structure from the same-purpose files in the UR and Robotiq packages. I have copied the content of the UR10e file which includes, as commented, some controllers.

The file I am calling to upload the robot to the param server is simply this:

<?xml version="1.0"?>
   <param name="robot_description" command="$(find xacro)/ '$(find cobot_description)/urdf/ur10e_robotiq.urdf.xacro'" />

Issue: when launching the cobot_empty_world.launch file, I get the following error:

[ERROR] [1625147930.347361207]: Failed to find root link: Two root links ...
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2021-07-20 07:53:15 -0600

nndei gravatar image

The issue was in the URDF being faulty. There, I called the UR10e file both outside and inside the macro, causing problems with the URDF.

edit flag offensive delete link more

answered 2021-07-04 18:08:43 -0600

cambel07 gravatar image
Failed to find root link: Two root links found: [robot_base_link] and [world]

With Gazebo, you can not have multiple root links in your URDF, as the error message is saying. Now, the problem is that you are using the file ur10e_robot.urdf.xacro which already defines a root link world for the robot, but this root link does not support the prefix argument as you can see here

To solve your problem, you could not refer to the ur10e_robot.urdf.xacro directly, but just copy its content to your URDF and with an updated definition of the world link, like this:

<joint name="world_joint" type="fixed">
  <parent link="world" />
  <child link = "{prefix}robot_base_link" />
  <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0" />
edit flag offensive delete link more


Dear @cambel07, thank you for your answer.

I had not thought about this, and I have tried it just now. Your solution still raises an error, specifically:

Failed to build tree: child link [{prefix}robot_base_link] of joint [world_joint] not found

I have also tried using {prefix}base_link and robot_base_link (tried these two for fun) but these also do not work. The first one raises an error equal to the one above (child link name adjusted), while the second option raises an error equal to the one in the original post, that is:

Failed to find root link: Two root links found: [base_link] and [world]

Even if I have called the child robot_base_link and not base_link...

Anyway, I believe your solution may be right, but it fails to find {prefix} because it is present in the instantiation of the ur10e_robot xacro, but maybe it isn't globally available and therefore the ...(more)

nndei gravatar image nndei  ( 2021-07-05 03:40:35 -0600 )edit

I think it is exactly as you say, I mentioned {prefix}robot_base_link above because that is the convention that you seem to be using, but if you do not define it as a macro at that level, then you can just replace it directly with the value it is expecting robot_base_link

cambel07 gravatar image cambel07  ( 2021-07-05 09:46:01 -0600 )edit

Thank you for your reply.

However, calling robot_base_link results in the error I stated above:

Failed to find root link: Two root links found: [base_link] and [world]

Once again, it is weird that it outputs [base_link] instead of the whole [robot_base_link]. I don't know what I should do, honestly.


nndei gravatar image nndei  ( 2021-07-05 12:42:08 -0600 )edit

Well it seems you are getting confused with the use of {prefix}, unless you are going to have several robots, you can try not defining any prefix at all, not for the robot, not for the gripper. That may make things easier to track for you.

cambel07 gravatar image cambel07  ( 2021-07-05 20:45:35 -0600 )edit

Dear cambel07, thank you for your reply.

I will try avoiding the prefix, but I added it for a future need of including a left and a right UR10e with corresponding grippers.

I was wondering if the issue might be another one. Indeed, if we consider the error stating that it fails to find a root, why would a UR10e spawn normally but have issues when attaching a gripper on its end effector? Wouldn’t it be because the gripper has a base link that is connected to world too? I haven’t found it in the files, though. I just don’t understand why this custom solution has issues just because I try to join two components… there must be a problem in the hierarchy, but wouldn’t it be solved when I create a joint between the end effector and the first link of the gripper?


nndei gravatar image nndei  ( 2021-07-06 02:33:48 -0600 )edit

If you can provide access to your files I may have a look. Otherwise, you can check my approach to having dual robots with grippers in gazebo here

  • Make sure that you are defining the root link, as in the example above, and that the macros for the robot and gripper don't define it. Make sure you connect properly the root link of the gripper with the end effector link of your robot, otherwise your problem may be a lingering link on the gripper.
cambel07 gravatar image cambel07  ( 2021-07-08 23:49:34 -0600 )edit

Sure! Thank you.

I will check your code in a moment. Meanwhile, I have uploaded my cobot folder in this repo. Please also download the robotiq and universal robots repos from the links in my first post here.



nndei gravatar image nndei  ( 2021-07-09 02:35:38 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2021-07-01 09:18:49 -0600

Seen: 152 times

Last updated: Jul 20