Robotics StackExchange | Archived questions

Actionlib client unable to cancel goals

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
self.client.send_goal(goal)
finished_before_timeout = self.client.wait_for_result()
if not finished_before_timeout:
    self.client.cancel_all_goals()
    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.

Thanks

Asked by ThreeForElvenKings on 2022-10-19 20:22:11 UTC

Comments

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

Asked by ravijoshi on 2022-10-21 02:43:56 UTC

Answers