Ask Your Question
0

Shutdown of SimpleActionServer using rospy

asked 2014-07-10 04:42:59 -0500

Michael Stoll gravatar image

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-06-26 09:11:45 -0500

nilot gravatar image

Add rospy.spin() after initNode()

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-07-10 04:42:59 -0500

Seen: 210 times

Last updated: Jun 26 '19