How to cancel goals from within an action server?
An action server exposes the hook cancel_all_goals()
to clients can clear any running actions. However, how would you do this from within the server itself? I can't find any equivalent method in the SimpleActionServer instance.
I'm trying to write an action server that manages several different "classes" of pre-emptivable actions, and the client doesn't need to be aware of any running actions, so to simplify access, I want the server to automatically cancel any actions its running if a client starts a new one.
I tried instantiated a SimpleActionClient inside the server to connect to itself and cancel_all_goals()
the way a client would, but when I do this the call to cancel_all_goals()
hangs indefinitely, even when there are no actions running.
The SimpleActionServer automatically preempts the current goal if a new one arrives. Is this behavior not enough?
No. I have a node with multiple action servers, one for each action, so one needs to preempt any action running on other servers.