Stopping the process launched by a launch file

asked 2021-08-14 04:56:20 -0600

Kansai gravatar image

If I have a launch file like

<launch>
<node type= "processor.py" name="processor" pkg="whatever" output="screen" cwd="node">

</launch>

and I run it, and at some point processor.py finishes its processing, is there a way for the program to finish automatically?

Right now, it just finishes and announces that "process has finished cleanly" but I still have to Ctrl-C to finish all

Take into account that I plan to add some rosbag record in that launch file in the future as well

edit retag flag offensive close merge delete

Comments

1

Please see #q124721 and #q12751 (and others).

gvdhoorn gravatar image gvdhoorn  ( 2021-08-14 06:36:44 -0600 )edit

Reopened because I don't think those answers will help if the ros node has shutdown, but the python process has not exited.

Please clarify which process is not exiting: processor.py or roslaunch? Use ps -ef at command prompt to determine this. After your node says "finished", is the node still shown by rosnode list?

If it is process.py that lives on, is your code explicitly starting additional threads?

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-08-15 09:18:37 -0600 )edit

The OP writes:

Right now, it just finishes and announces that "process has finished cleanly" but I still have to Ctrl-C to finish all

that implies processor.py exits, but roslaunch waits around, which it does, unless you make processor required. Which is what the linked Q&As explain.

Reopened because I don't think those answers will help if the ros node has shutdown, but the python process has not exited.

There is only one process in roslaunch terminology, which would be processor.py.

Unless I'm completely misinterpreting OP's description, (s)he describes roslaunch sitting there, waiting for SIGINT.

gvdhoorn gravatar image gvdhoorn  ( 2021-08-15 10:55:05 -0600 )edit