Shutdown of SimpleActionServer using rospy
Hi,
I'm trying to implement an actionlib action server in pyhton. But in case of an error the node won't shutdown correctly and runs forever.
Look a this simple code snippet:
#!/usr/bin/env python
import rospy, actionlib
from my_msgs.msg import MyAction
def execute_cb(goal):
x = goal
def initNode():
rospy.init_node('test')
actionserver = actionlib.SimpleActionServer("test_action", MyAction, execute_cb=execute_cb, auto_start = False)
raise KeyError("test")
if __name__ == '__main__':
initNode()
When run, the "test" error is raised as expected. But afterwars the node does not react to CTRL-C.
I assume the action server created a seperate thread, which keeps the process alive. But IMO that should be interruptable by CTRL-C.
I also tried to use actionserver.shutdown() without success.
Did I make a mistake or is this a bug?
Using hydro on Ubunto 13.04