Ask Your Question
0

Second Roscore cannot run even though different ROS_MASTER_URI is set

asked 2019-01-31 09:02:25 -0500

kump gravatar image

updated 2019-01-31 09:19:51 -0500

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
edit retag flag offensive close merge delete

Comments

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.

It is actually possible to use multiple ros_control ..

gvdhoorn gravatar image gvdhoorn  ( 2019-01-31 11:52:30 -0500 )edit

.. controlled robots in a single Gazebo instance.

I can't find the relevant docs/Q&As right now, but it's definitely possible.

gvdhoorn gravatar image gvdhoorn  ( 2019-01-31 11:52:51 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2019-01-31 09:40:43 -0500

alsora gravatar image

The ROS_MASTER_URI environment variable should be used if you want to specify what's the uri of the master such that other nodes can find it.

If you want to run more than one roscore on the same machine you have to use the -p option to specify a different port.

TERMINAL1

roscore

TERMINAL 2

roscore -p <PORT_NUMBER>

edit flag offensive delete link more
1

answered 2019-01-31 09:38:38 -0500

VictorLamoine gravatar image

Duplicate of https://answers.ros.org/question/5753...

Use roscore -p 11312 in the second terminal, you don't need to tweak the ROS_MASTER_URI variable.

edit flag offensive delete link more

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

Stats

Asked: 2019-01-31 09:02:25 -0500

Seen: 698 times

Last updated: Jan 31 '19