Actionlib client unable to cancel goals

asked 2022-10-19 20:22:11 -0600

ThreeForElvenKings gravatar image

updated 2022-10-19 20:22:49 -0600

Hello, I'm trying out the actionlib SimpleActionClient and SimpleActionServer tutorials in python. Here is a small relevant snippet in my client:

self.client = actionlib.SimpleActionClient(server_node_name, actionlib_tuts.msg.fibonacciAction)
some code
finished_before_timeout = self.client.wait_for_result()
if not finished_before_timeout:
    rospy.logerr("Sent cancel")

In my server, I have if self._as.is_preempt_requested(): inside my execute_cb loop

Now, after sending a goal from the client, when I interrupt it with ctrl+c, the if statement in the server is not getting triggered. The client prints out Sent cancel, but the server does not catch it.

How do I cancel a goal using SimpleActionClient. I also tried cancel_goal instead of cancel_all_goals I feel like I'm missing something important here.


edit retag flag offensive close merge delete


Can you please share the server and client as a minimal reproducible example?

ravijoshi gravatar image ravijoshi  ( 2022-10-21 02:43:56 -0600 )edit