Ask Your Question

How to put more than one URDF model into RVIZ

asked 2011-10-24 21:54:59 -0500

ZdenekM gravatar image

updated 2011-10-25 23:46:27 -0500


I would like to have more URDF models (next to robot's one) displayed in RVIZ (for example ipa-kitchen,cup, table...). How to do it correctly? Models have often same named links (dummy_link)...

This is my current solution, but there are some errors in RVIZ as you can see...

This is my launch file:

Model looks good in RVIZ, but there are errors in robot model.

image description

As you can see, there are /world_tf/xx transforms and also xx ones. Why?

There is screenshot of rxgraph:

image description

Output of roswtf:

Found 2 warning(s).
Warnings are things that may be just fine, but are sometimes at fault

WARNING The following node subscriptions are unconnected:
 * /gazebo:
   * /gazebo/set_model_state
   * /gazebo/set_link_state

WARNING These nodes have died:
 * world/spawn_urdf_world-2

Found 7 error(s).

ERROR Communication with [/rviz] raised an error: 
ERROR Communication with [/rosout] raised an error: 
ERROR Communication with [/rxconsole_1319534397534378303] raised an error: 
ERROR Communication with [/world/joint_state_publisher] raised an error: 
ERROR Communication with [/gazebo] raised an error: 
ERROR Communication with [/world/robot_state_publisher] raised an error: 
ERROR The following nodes should be connected but aren't:
 * /world/joint_state_publisher->/world/robot_state_publisher (/world/joint_states)
 * /gazebo->/rviz (/tf)
 * /gazebo->/world/robot_state_publisher (/clock)
 * /gazebo->/world/joint_state_publisher (/clock)
 * /rosout->/rxconsole_1319534397534378303 (/rosout_agg)
 * /gazebo->/rviz (/clock)
 * /gazebo->/gazebo (/clock)
 * /world/robot_state_publisher->/rviz (/tf)

Am I completely wrong with using join_state_publisher and robot_state_publisher (for fixed joints) or is there just some small mistake? Thanks a lot for any useful advice. Cheers :-)

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2012-07-31 12:48:39 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Model looks good in RVIZ, but there are errors in robot model.

In fact there is no error in the model. There is only status info that model has errors.

When rviz starts, it parses robot_description without tf_prefix therefore showing model error of not transformed links. When the tf_prefix is entered (either manually or via .vcg configuration) there is update of links transformations, but status is not cleared from the previous error state. The new correct info is added to previous one, but to global status is left as Error.

Simple patch to robot_model_display.cpp cures this out.

*** /opt/ros/fuerte/stacks/visualization/rviz/src/rviz/default_plugin/robot_model_display.cpp     2012-08-01 00:39:38.876030807 +0200
--- /opt/ros/fuerte/stacks/visualization/rviz/src/rviz/default_plugin/robot_model_display.cpp     2012-08-01 00:39:47.564200799 +0200
*** 137,142 ****
--- 137,144 ----

  void RobotModelDisplay::setTFPrefix(const std::string& prefix)
+   clearStatuses();
    tf_prefix_ = prefix;


I'll try to issue a ticket for this.

edit flag offensive delete link more


Fixed in latest version of rviz. I just kicked off a new Fuerte release (visualization-1.8.14). It should be available in the next day or so. Thanks for the patch!

hersh gravatar image hersh  ( 2012-08-01 13:26:41 -0500 )edit

answered 2011-10-24 23:43:19 -0500

DimitriProsser gravatar image

updated 2011-10-27 08:02:06 -0500

I think the problem is that gazebo is in an entirely different namespace than the rest of your nodes (particularly robot_state_publisher). Try setting them all to use the same namespace and see if that helps.

EDIT: When I'm launching multiple objects at the same time, I like to use xacro to define the objects that I want to create. So instead of the urdf containing link names, I can parameterize all of the link names so that I can launch as many as I want simultaneously. For example, instead of using:

<link name="dummy_link" />

I would use:

<link name="${name}_dummy_link" />

so that to add a new object, I just need to pass it a unique "name" variable.

Xacro might be the solution you're looking for. If it isn't, I might be interpreting your problem incorrectly and I can amend my answer.

EDIT: For multiple objects, you will end up with separate tf trees. The way to get around this is to make sure that all objects share one (and only one) tf frame. (I use the "/world" frame).

edit flag offensive delete link more


Well, thanks for hint! I removed world namespace and it's ok. But what should I do to put more models into RVIZ? They usually have same names of links... For example dummy_link. Can I handle this with just tf prefixes?
ZdenekM gravatar image ZdenekM  ( 2011-10-25 01:31:27 -0500 )edit
Ok means that one model is Ok without namespaces :-) But what can I do to visualize more models in RVIZ?
ZdenekM gravatar image ZdenekM  ( 2011-10-25 23:48:03 -0500 )edit
Yes, this is comfortable way how to do it. But if I want to put already made objects into simulation (things from cob packages and so on) it's not very practical to change their definition. And next - there are tf_prefixes which can be used for this and I'm curious about how to use it... :-)
ZdenekM gravatar image ZdenekM  ( 2011-10-26 20:08:31 -0500 )edit
I tried version of launch file without namespaces, just tf_prefixes. It works better (there is no error and all looks ok), but just for one model. For two objects there are two separate tf trees and no transformation between them.
ZdenekM gravatar image ZdenekM  ( 2011-10-26 20:15:35 -0500 )edit
Another question - can be the xacro parametrized from launch file? It would be nice to define "name" parameter from it.
ZdenekM gravatar image ZdenekM  ( 2011-10-26 21:12:25 -0500 )edit
This looks like it's enough for it's own question. Please promote it as such so others can find it too.
tfoote gravatar image tfoote  ( 2011-10-28 08:51:41 -0500 )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

1 follower


Asked: 2011-10-24 21:54:59 -0500

Seen: 3,912 times

Last updated: Jul 31 '12