launch multiple Rviz instances on the same machine
Hi,
Is it possible to launch multiple independent Rviz instances on the same machine?
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
Hi,
Is it possible to launch multiple independent Rviz instances on the same machine?
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).
EDIT
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:
<launch>
<node name="rviz_instance1" pkg="rviz" type="rviz">
<env name="ROS_MASTER_URI" value="http://localhost:11311" />
</node>
<node name="rviz_instance2" pkg="rviz" type="rviz">
<env name="ROS_MASTER_URI" value="http://localhost:11312" />
</node>
</launch>
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:
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.
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.
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.
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?
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.
Asked: 2016-04-25 21:17:47 -0500
Seen: 1,801 times
Last updated: Apr 26 '16