ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Multiple Goal Buttons in RVIZ?

asked 2012-04-10 03:20:20 -0500

JBuesch gravatar image

updated 2014-04-20 14:09:44 -0500

ngrennan gravatar image

Hi everyone,

I have to control more than one robot at a time. The robots are administered by a central ROS server and can be displayed and controlled using ROS RVIZ at the same time. Every robot runs in a distinct name space such that same topics (like 'move_base/simple_goal') of different robots do not collide.

I was now looking for multiple navigation goal buttons in the tool panel of RVIZ, one for each robot. Currently I have to change the goal topic of the tool each time I intend to give the next robot a moving command. That is not very sophisticated and annoying.

Is there a simple way to have multiple buttons on the toolbar with the same functionality? So far I found nothing that would help.

PS: I am not interested in running ROS cores on each robot and/or opening different instances of RVIZ, just in case someone is about to suggest anything like this ;)

Really appreciate any help and thanks in advance. J.Buesch

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted

answered 2012-07-30 04:23:40 -0500

Jakub gravatar image

You have to hack rviz source and recompile it. Do as follows:

roscd rviz
cd src/rviz

Edit the file visualization_manager.cpp and go to line 215. You will see there:

createTool< InteractionTool >("Interact", "i" );
createTool< GoalTool >("2D Nav Goal", "g");

Copy the GoalTool line as many times as you need. Syntax:

createTool< TypeOfTheTool >("Label on the button", "shortcut_key");

Save and rosmake rviz. (If you've got precompiled packages remember to delete ROS_NOBUILD before rosmake.)

Now you free to add lines in rviz configuration files .vcg for each tool:

Tool\ Label\ on\ the\ buttonTopic=/robot_n/move_base_simple/goal

Have fun.

edit flag offensive delete link more


Would it really be that simple? :) Thanks for the accurate hints!

JBuesch gravatar image JBuesch  ( 2012-08-03 10:52:49 -0500 )edit

I was curious: is it possible to add another kind of button or shortcut key? example to stop refreshing the point cloud stream. Something close to RGBDSlam actually, but I want to show also the urdf model of my robot.

Brioche gravatar image Brioche  ( 2012-10-01 19:40:24 -0500 )edit

For new tools more hacking is required. You have to check out the source code of already existing tools in rviz/src/rviz/tools. All new tools must derive from Tool class (tools.h, tools.cpp). Once done, the above solution would be valid for new tools.

Jakub gravatar image Jakub  ( 2012-10-01 22:22:08 -0500 )edit

answered 2017-08-10 14:56:35 -0500

jayess gravatar image

updated 2017-08-10 15:01:19 -0500

There's an even simpler way than anyone else has described (except for @joq's answer) that doesn't require any hacking or coding whatsoever. You can add multiple instances of the same tool by using a custom (or modifying the default) .rviz configuration file.

Under the Tools section add:

- Class: rviz/SetGoal
  Topic: /name1/move_base_simple/goal
- Class: rviz/SetGoal
  Topic: /name2/move_base_simple/goal

where name1 and name2 are the names of your robots.

edit flag offensive delete link more

answered 2012-08-03 05:24:33 -0500

dgossow gravatar image

A clean solution would probably be to create an Interactive Marker server that supplies this functionality (e.g. a huge flat box marker that you can click on).

This would also allow you to customize the functionality to your specific application.

edit flag offensive delete link more


Yes, sounds like a reasonable approach.. More generic than hacking the sources.. When I placed the question my environment was not able to use interactive markers, but fortunately that has changed now.

JBuesch gravatar image JBuesch  ( 2012-08-03 10:49:59 -0500 )edit

I think that this approach is better than the accepted answer as it can be used without hacking.

jayess gravatar image jayess  ( 2017-07-26 13:54:29 -0500 )edit

answered 2012-04-10 05:40:12 -0500

joq gravatar image

A simple solution might be running a separate rviz node for setting each goal.

Not very elegant, but it should work.

edit flag offensive delete link more


Well, thanks for your idea, but that is why I mentioned not being interested in several rviz windows. If it is only possible with that kind of hack then I find it more elegant to simple change the tool's topic. But again, thanks for your suggestion. :)

JBuesch gravatar image JBuesch  ( 2012-10-11 00:14:46 -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



Asked: 2012-04-10 03:20:20 -0500

Seen: 3,329 times

Last updated: Aug 10 '17