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

Exit code of roslaunch shutdown on node death

asked 2015-10-14 07:36:43 -0600

SR gravatar image

When I kill the process tree of roslaunch I get an exit code of 0 indicating success, which is what I would expect.

However, when I run roslaunch and manually kill one of the nodes that have the required=true attribute in the launch file it causes roslaunch to shutdown. In this case roslaunch returns 0 as well although an error occurred. Is there a safe way to determine if the shutdown reason was "good"?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2015-10-14 09:38:58 -0600

updated 2015-10-14 10:12:39 -0600

From this answer:

Btw, this behavior and the meaning of the numbers isn't specific to roslaunch; roslaunch is just reporting back the exit code that the process gave when it died.

So, if you have manually killed ROS-node with SIGINT (which corresponds to Ctrl-C), then most probably it was handled by roscpp signal handler that eventually made ros::ok() to return false and thus you program have terminated normally. (I assume you are handling messages with either while(ros::ok()){ros::spinOnce();} or just ros::spin())

Thus, sending a different signal, e.g. pkill -SIGTERM your_node, should change the exit code.

EDIT

Sorry, I am wrong. It doesn't work as expected. It looks like a bug or just a missed feature in roslaunch.

edit flag offensive delete link more

Comments

Thanks for your confirmation. I killed one required node (out of many) with kill <pid>. I am not sure how roslaunch forwards the kill message when itself is being killed (which would be the good case). But if only one required node is killed it should report an error instead.

SR gravatar image SR  ( 2015-10-14 11:06:45 -0600 )edit

I would suggest to open an issue on GitHub here, so to officially confirm the bug and/or make a feature request.

Boris gravatar image Boris  ( 2015-10-15 16:14:53 -0600 )edit
1

I faced the same issue and I believe it is an important feature missing in roslaunch. I submitted a feature request/but report here: https://github.com/ros/ros_comm/issue...

sd1074 gravatar image sd1074  ( 2016-10-28 19:18:24 -0600 )edit

Question Tools

3 followers

Stats

Asked: 2015-10-14 07:36:43 -0600

Seen: 7,588 times

Last updated: Oct 28 '16