Kill/shutdown other nodes
Hi,
I have a launch file that starts several nodes, one of which processes a video file and publishes messages to topics, on per video frame basis. Other nodes listen to those topics and process the received messages. I would like to run this launch file in a script with different video files passed as launch file parameters. The issue is that the listening nodes do not know when the publisher node terminates, and thus roslaunch does not return since listening nodes are still running even though there are going to be no data published on the topics.
I can think of setting timers in the listening nodes and signal_shutdown(.) them if time lapse since last received message exceeds some predefined threshold, but I suppose there may be better solutions. I cannot send shutdown signal from one node to terminate another node within ROS API, right? What options (other than timer) do I have in order to implement that architecture in ROS?
I don't understand the problem very well. If you know the id of the roslaunch process, for example, is killing that process enough for you?
The problem is that if you have a launch file with several nodes, all of which perform some processing of fixed set data of predefined size, all of the nodes should know when the processing task they are running for is finished so that all the nodes terminate. Yes, I am now doing kill by PID.