Second Roscore cannot run even though different ROS_MASTER_URI is set
I want to run two ROS masters on one computer, because I need to run two Gazebo simulations and control the robot in both of them, and it seems, that the package, that provides controllers for robot simulation (gazebo_ros_control) can only launch one node, so when I launch the second simulation on the same ROS core, the controllers of the first simulation stops.
So I launch a roscore in standard ROS_MASTER_URI on one terminal and then attempt to run a ROS core in another terminal, where different ROS_MASTER_URI is set. But it results into an error, claiming that the ROS core can't be launched, because it is already running at the standard ROS_MASTER_URI. I think it should be possible to run two ROS cores on one computer just like this, so what am I missing?
Terminal 1:
$ source ~/catkin_ws/devel/setup.bash
$ export ROS_MASTER_URI=http://localhost:11311
$ roscore
output:
started roslaunch server http://linux-Precision-T1650:44253/
ros_comm version 1.12.14
SUMMARY
========
PARAMETERS
* /rosdistro: kinetic
* /rosversion: 1.12.14
NODES
auto-starting new master
process[master]: started with pid [27762]
ROS_MASTER_URI=http://linux-Precision-T1650:11311/
setting /run_id to f6eefa2c-2565-11e9-b08b-b8ca3aa30f44
process[rosout-1]: started with pid [27776]
started core service [/rosout]
Terminal 2:
$ source ~/catkin_ws/devel/setup.bash
$ export ROS_MASTER_URI=http://localhost:11312
$ roscore
output:
started roslaunch server http://linux-Precision-T1650:45643/
ros_comm version 1.12.14
SUMMARY
========
PARAMETERS
* /rosdistro: kinetic
* /rosversion: 1.12.14
NODES
roscore cannot run as another roscore/master is already running.
Please kill other roscore/master processes before relaunching.
The ROS_MASTER_URI is http://linux-Precision-T1650:11311/
The traceback for the exception was written to the log file
It is actually possible to use multiple
ros_control
.... controlled robots in a single Gazebo instance.
I can't find the relevant docs/Q&As right now, but it's definitely possible.