Actionlib client unable to cancel goals

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

ThreeForElvenKings gravatar image

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

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

edit retag flag offensive close merge delete

Comments

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

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