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

Kill/shutdown other nodes

asked 2012-12-28 00:50:18 -0600

Alexey Ozhigov gravatar image

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?

edit retag flag offensive close merge delete

Comments

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?

yigit gravatar image yigit  ( 2012-12-28 03:45:06 -0600 )edit

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.

Alexey Ozhigov gravatar image Alexey Ozhigov  ( 2012-12-28 04:42:47 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
5

answered 2012-12-28 05:25:50 -0600

SL Remy gravatar image

In the roslaunch xml include the option required="true" as shown here.

edit flag offensive delete link more

Comments

Good answer. I didn't know about that option.

joq gravatar image joq  ( 2012-12-28 11:02:15 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2012-12-28 00:50:18 -0600

Seen: 3,819 times

Last updated: Dec 28 '12