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

launch multiple Rviz instances on the same machine

asked 2016-04-25 21:17:47 -0500

blueberry gravatar image


Is it possible to launch multiple independent Rviz instances on the same machine?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-04-25 21:29:39 -0500

updated 2016-04-26 16:44:45 -0500

Yes. Assuming you have enough memory/CPU/GPU power you can start as many rviz instances as you like. The only "gotcha" that I can think of is that each instance should have a unique ROS name (just like every other ROS node). This happens automatically with rosrun and can easily be implemented in roslaunch with the anon substitution arg.

If by "independent" you mean they shouldn't be able to talk to each other via ROS mechanisms. Then, once again, yes. That is possible. You would just need to set the ROS_MASTER_URI different for each instance (and have a corresponding roscore running).


If the second paragraph is really what you want, there are certainly a few ways this could be done, but none of them seem great. If you already had two ros masters running on different ports (could be started with roscore -p see here) then you could use the env tag to set the ROS_MASTER_URI for each rviz instance. For example:

  <node name="rviz_instance1" pkg="rviz" type="rviz">
    <env name="ROS_MASTER_URI" value="http://localhost:11311" />

  <node name="rviz_instance2" pkg="rviz" type="rviz">
    <env name="ROS_MASTER_URI" value="http://localhost:11312" />

I verified this works, but it obviously isn't great as it requires you to manually start one ROS master independently of the call to roslaunch (the second master could get started automatically by roslaunch). Here are a few potential solutions to this problem:

  1. Use a shell script that starts the ROS cores for you. It might be tricky to make sure that they are both up and running before calling roslaunch. You will also need to be careful that everything shuts down properly.

  2. In principle, you could edit the nodes that get started when calling roscore by editing roscore.xml. I don't think this is a great idea though.

edit flag offensive delete link more


Thanks @jarvisschultz, I was able to launch independent Rviz instances by setting different ROS_MASTER_URI and GAZEBO_MASTER_URI in separate terminals. However, when I tried to launch them from one single launch file, one Rviz starts properly, while the other exits on exception.

blueberry gravatar image blueberry  ( 2016-04-26 14:07:33 -0500 )edit

here is my config <node name="rviz2" pkg="rviz" type="rviz" args="-d $(find scene_plugin)/launch/test2.rviz" required="true"/> <node name="rviz3" pkg="rviz" type="rviz" args="-d $(find scene_plugin)/launch/test3.rviz" required="true"/> Do you have any idea why this would happen?

blueberry gravatar image blueberry  ( 2016-04-26 14:08:43 -0500 )edit

There should be nothing wrong with two rviz instances in a single launch file. However if you are trying to launch two rviz instances that talk to different masters, that may take a bit more effort. See my edited answer above.

jarvisschultz gravatar image jarvisschultz  ( 2016-04-26 16:46:59 -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: 2016-04-25 21:17:47 -0500

Seen: 1,455 times

Last updated: Apr 26 '16