Custom SIGINT handler not triggered by roslaunch

asked 2017-04-25 05:29:13 -0600

Paddre gravatar image

updated 2017-04-26 07:51:32 -0600

When I run roslaunch, it starts roscore (obviously) as well as one node. When I try to kill it by pressing CTRL+C, I get the following output:

[robot1-1] killing on exit

shutting down processing monitor...

... shutting down processing monitor complete

where robot1 is the node's name.

Here is the launch config:

<launch>

<node name="robot1" pkg="networking" type="my_node" launch-prefix="sudo -E" output="screen"/>

</launch>

I tried to implement a custom handler and followed the exact same code as in this Tutorial. I even registered the handler for SIGTERM, SIGKILL and SIGINT but I don't get any output from the handler function.

Important: If I run the node manually using rosnode, the function is called properly.

EDIT: As far as I found out, the problem is related to the launch prefix. Roslaunch runs my_node with the prefix sudo -E which is necessary. However, I kill it from within a non-superuser session. This would explain why it works when running the node within a superuser session. Is there a way to get aroud that?

edit retag flag offensive close merge delete

Comments

Does the node in your launchfile have the output=screen attribute set?

gvdhoorn gravatar image gvdhoorn  ( 2017-04-25 07:18:00 -0600 )edit

Yep, it is set and other output is printed

Paddre gravatar image Paddre  ( 2017-04-25 08:01:22 -0600 )edit

I think you'll have to show us what you are doing then. Without the code / a way to reproduce it, it's difficult to help you.

gvdhoorn gravatar image gvdhoorn  ( 2017-04-25 08:12:41 -0600 )edit

I updated my answer as I found out, that the launch prefix might cause a problem. I did not copy the code here as it is really just a copy of the tutorial I linked.

Paddre gravatar image Paddre  ( 2017-04-26 07:46:12 -0600 )edit