Ask Your Question
3

What "escalating to SIGTERM" mean ?

asked 2011-06-14 02:30:05 -0500

Catotaku gravatar image

updated 2014-01-28 17:09:51 -0500

ngrennan gravatar image

Hi everyone !

I have develop my on keyboard to start doing a teleoperation, to read the keys I have created a thread and and i have a ros::rate to publish my data in other frequency. But when I kill all the execution ros send this message :

Failed to call commander_service
[keyboard-2] escalating to SIGTERM

So I have search for an easy example and I found: http://ros.org/wiki/turtlebot_teleop

I have found the keyboard driver and tried and I received the same message.

http://www.ros.org/doc/api/turtlebot_teleop/html/turtlebot__key_8cpp_source.html

In this code I find a this line :

signal(SIGINT,quit);

And I decided to replace the SIGINT with SIGTERM. But I doesn't solve the error, but the function quit is executed.

So do you know why is happening it and how to solve ?

Thanks in advance.

edit retag flag offensive close delete

3 answers

Sort by ยป oldest newest most voted
4

answered 2011-06-14 05:39:34 -0500

dornhege gravatar image

updated 2011-06-14 05:41:48 -0500

ROS automatically installs a signal handler for the application (you can disable that in ros::init afaik) that can be used in the main loop. The default is SIGINT, which corresponds to pressing Ctrl-C on the keyboard.

SIGTERM is the corresponding signal that is sent to the application when you kill it from the command line. I think ros (roslaunch) kills an application as first using SIGINT (nicely) and if the program doesn't react to "escalate" to SIGTERM (killing it - by asking). I'm not sure if SIGKILL is used, that would kill the application immediately.

So probably your program doesn't quit on SIGINT, which might be because of your signal handler. If you only use it to catch Ctrl-C, you can just use while(ros::ok()) ... in your main loop and remove all signal handling on your side. Otherwise you should quit on Ctrl-C (or just accept that it "escalates").

edit flag offensive delete publish link more

Comments

I disable the SIGINT service ros::init_options::NoSigintHandler, and create my signal(SIGINIT,quit) and it do the same. In the same main I have a while(ros::ok()) and it sends the same error. So how I can fix this problem ( it stays like one or to seconds to stop my program). Catotaku ( 2011-06-22 21:08:46 -0500 )edit
Either remove your SIGINT handler (why do you need that) or change the loop condition as something like: while(ros::ok() && !quit), where you set quit to true in your SIGINT handler. dornhege ( 2011-06-22 22:30:59 -0500 )edit
0

answered 2011-06-14 05:41:09 -0500

Lorenz gravatar image

Your node doesn't seem to react on SIGINT, the signal that is sent when you hit CTRL-C to quit. I guess, roslaunch tries to send SIGTERM after some time to force your node to quit.

Does your thread that reads input from the keyboard exit when the ROS node is to shut down? In other words, does the thread's main loop call ros::ok() and does it terminate when it returns false? Is it maybe blocking on the function call to read keyboard input?

edit flag offensive delete publish link more
0

answered 2011-06-28 03:44:52 -0500

Catotaku gravatar image

I will rewrite the question. Because I feel like you doesn't understand my question.

I have develop a keyboard component to read the keyboard and publish a twist message.

I have a boost thread to read the keyboards ( because I want a frequency higher than the publisher ). An I also have one while( ros::ok() ) which publish the data to my teleoperation node.

When I press ^C it throws me this message :

Failed to call commander_service
[keyboard-2] escalating to SIGTERM

So how I can do my keyboard node to close it correctly ? This is not a problem when you use one time, but if you have to stop and start many times you lose a lot of time.

Thanks

edit flag offensive delete publish link more

Comments

The only thing you need to make sure is that your program quits on SIGINT (Ctrl-C). If you have a signal handler on your own, you need to make sure that the main loop ends. As you are dealing with keyboard stuff, maybe you are also capturing the Ctrl-C even if you don't have a signal handler. dornhege ( 2011-06-28 06:46:22 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

Follow
1 follower

Stats

Asked: 2011-06-14 02:30:05 -0500

Seen: 1,462 times

Last updated: Jun 28 '11