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

How can I check in a launch file if a roscore is already running?

asked 2013-12-16 20:57:27 -0600

etsardou gravatar image

Hi there!

I am implementing a system that has a GUI for visualization. The core system starts with a roslaunch file and the GUI with another one. Ideally the GUI should open and close when wanted.

The problem I'm facing is the following: If I run roslaunch for GUI in console A and then roslaunch for my core application in console B and close the GUI, the roslaunch in console A does not terminate (probably because roscore and rosout are attached to it and other nodes from console B need them).

So is there any way to modify GUI roslaunch to not start a roscore, or even initialize the nodes only if roscore is already active?

Thnx in advance!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2013-12-16 21:20:06 -0600

Tirjen gravatar image

updated 2013-12-16 21:34:29 -0600

I'm not sure to understand your problem, but could't you run the roscore in a terminal A, the GUI in a terminal B and your core application in a terminal C? Moreover (I don't know if this can be useful) you could set the property required="true" for the node that launches the GUI, so that when the GUI is killed, all other nodes started from the same launch file should die.

EDIT:

To make a launch file wait for a roscore you should put --wait in the command line, as described here

edit flag offensive delete link more

Comments

1

Of course I can run GUI after core was created, but in general the whole system is distributed. So GUI can be launched in another PC without knowing if a core exists in the server. Anyway, the real question is about telling a launcher to not begin if a roscore is not already running.

etsardou gravatar image etsardou  ( 2013-12-16 21:26:25 -0600 )edit

See the edit of my answer.

Tirjen gravatar image Tirjen  ( 2013-12-16 21:36:50 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2013-12-16 20:57:27 -0600

Seen: 2,645 times

Last updated: Dec 16 '13