ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

roscore is called even though it is already running

asked 2020-07-12 03:21:53 -0500

Kansai gravatar image

I am working with ROS in a container. On one terminal I call docker run and the container with ROS gets executed and I got a bash. In that I call roscore

In another terminal I call docker exec and I join the container and there I can rosrun my nodes without problem. I usually do it twice or thrice to have several terminal to run nodes. They all use the roscore that got executed in the first terminal (they don't run of course if roscore is not executed)

Today I am trying roslaunch. I put several nodes in my launch file but when I call the file with roslaunch teleopbot key_to_twistramp.launch I can see that roscore is executed again in the terminal. So roslaunch completely ignores the roscore that is running in the other terminal

Why is this so? I thought it would skip the roscore since it is already running there. It is actually no much problem since my nodes get executed but I am wondering why


for reference the first roscore

 roscore
... logging to /root/.ros/log/e453a93e-c416-11ea-9aad-0242ac110002/roslaunch-2205bc4dcd80-7257.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://2205bc4dcd80:34499/
ros_comm version 1.12.14


SUMMARY
========

PARAMETERS
 * /rosdistro: kinetic
 * /rosversion: 1.12.14

NODES

auto-starting new master
process[master]: started with pid [7267]
ROS_MASTER_URI=http://2205bc4dcd80:11311/

setting /run_id to e453a93e-c416-11ea-9aad-0242ac110002
process[rosout-1]: started with pid [7280]
started core service [/rosout]
^C[rosout-1] killing on exit
[master] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done

When I launch

roslaunch teleopbot key_to_twistramp.launch 
... logging to /root/.ros/log/e453a93e-c416-11ea-9aad-0242ac110002/roslaunch-2205bc4dcd80-7297.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://2205bc4dcd80:46339/

SUMMARY
========

PARAMETERS
 * /keys_to_twist/angular_accel: 1.1
 * /keys_to_twist/angular_scale: 0.1
 * /keys_to_twist/linear_accel: 1.1
 * /keys_to_twist/linear_scale: 0.8
 * /rosdistro: kinetic
 * /rosversion: 1.12.14

NODES
  /
    key_publisher (teleopbot/key_publisher.py)
    keys_to_twist (teleopbot/keys_to_twist_with_ramps.py)

ROS_MASTER_URI=http://localhost:11311

process[key_publisher-1]: started with pid [7314]
Publishing keystrokes. Press Ctrl-C to exit...
process[keys_to_twist-2]: started with pid [7315]
linear scale 0.8
angular scale 0.1
linear accel 1.1
angular accel 1.1
[keys_to_twist-2] killing on exit
[key_publisher-1] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2020-07-12 18:58:32 -0500

Geoff gravatar image

Are you referring to these two lines in the two outputs?

started roslaunch server http://2205bc4dcd80:34499/

and

started roslaunch server http://2205bc4dcd80:46339/

These are not the roscore process. They are XML-RPC servers used by roslaunch.

This is where roscore is started in your first output:

auto-starting new master
process[master]: started with pid [7267]
ROS_MASTER_URI=http://2205bc4dcd80:11311/

In your second output, only this is printed:

ROS_MASTER_URI=http://localhost:11311

That's because roslaunch has found the existing roscore instance and is using it. You would have to set a new ROS_MASTER_URI value (e.g. to a different port) in your new terminal to make it start a new roscore, but since you just want the one you can continue on as you are.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2020-07-12 03:21:53 -0500

Seen: 873 times

Last updated: Jul 12 '20