# What exactly does root link mean, and why cannot ROS find it when I try to view a URDF file in RViz?

Hello, a complete beginner here. Apologies if the question seems rather trivial. I am trying to visualize a robot body in Rviz. Presently, there is a box link in the urdf for the body. When I open the file using Rviz with just the code for the box in the file, it works just fine. However, the moment I define the properties for a cylinder, it throws this error:

[ERROR] [1579466774.521440249]: Failed to find root link: Two root links found: [base] and [wheel]
[robot_state_publisher-3] process has died [pid 5100, exit code 1, cmd /home/raghav/simulation_ws/devel/lib/robot_state_publisher/state_publisher __name:=robot_state_publisher __log:=/home/raghav/.ros/log/ba7ca4e2-3afc-11ea-bcfb-0800279ea8aa/robot_state_publisher-3.log].
log file: /home/raghav/.ros/log/ba7ca4e2-3afc-11ea-bcfb-0800279ea8aa/robot_state_publisher-3*.log
[ERROR] [1579466775.761866608]: Failed to find root link: Two root links found: [base] and [wheel]


Running ROS melodic on Ubunutu 18.04 as a virtual machine.

Any help would be much appreciated!

Thanks

Raghav

edit retag close merge delete

Running ROS melodic on Ubunutu 18.04 as a virtual machine.

this is not the cause of your current problem, but be aware that VMs are not going to give you the performance of a native install. Especially RViz (and other graphical tools, such as Gazebo) have been known to not be too stable when run in VMs.

Something to keep in mind.

( 2020-01-20 02:29:32 -0600 )edit

Sort by » oldest newest most voted

URDF models the kinematic structure as a tree.

By definition trees can only have one root, which simply means they have a single element which is their "starting point".

However, the moment I define the properties for a cylinder, it throws this error:

[ERROR] [1579466774.521440249]: Failed to find root link: Two root links found: [base] and [wheel]


If we take a close look at this error message (and keep in mind that you "define the properties for a cylinder", by which you most likely mean you add a cylinder), we see that the URDF you've created now contains two roots, and thus two trees: one starts with the link for the box (ie: base) and the other starts with the link for the cylinder you just added (ie: wheel).

As we know URDF only supports trees, this is illegal and thus you are presented with an error message.

In essence, your model description is incomplete: there is no information in your .urdf which tells the parser how base and wheel are to be connected to each other. If we add this information, we end up with either base or wheel becoming the root, and everything would be OK again.

The way to add this relationship between base and wheel would be do define a joint, which makes one of these two the parent and the other the child.

Adding a joint declares the relationship between the box and the cylinder and because one is the parent and the other the child, also provides the parser with the information on who is going to be the root (ie: the parent).

more