ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Actionlib: preempt vs cancel

asked 2019-09-18 09:04:20 -0500

ssssss gravatar image


I'm currently trying to understand the Actionlib state machine and am not clear about what "preempt" exactly means in this context.

The wikipage ( describes the "Preemted" state as:

Preempted - Processing of the goal was canceled by either another goal, or a cancel request sent to the action server

For the SimpleActionServer it says here (, that:

New goals preempt previous goals based on the stamp in their GoalID field (later goals preempt earlier ones)

However, here ( it also says about the SimpleActionClient:

For simplicity, the Simple Action Client tracks only one goal at a time. When a user sends a goal with the simple client, it disables all callbacks associated with the previous goal and also stops tracking its state. Note that it does not cancel the previous goal!

The later seems to make a distinction between cancelling and preempting and I am unclear if there is actually a difference or what the SimpleActionServer actually does when a new goal arrives.

For example:

If I have a goal which changes over time, is it enough to simply send the updated goal via the SimpleActionClient to the server or should I actively cancel the previous goal in advance? I don't need any of the previous goals and don't want to have any overhead on the server regarding them. I am simply interested in the most recent goal.

I'd appreciate any kind of information on this topic, thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-09-18 14:07:42 -0500

Hi, to make it really clear:

  • Cancel : Stop processing goal(s)
  • Preempt : Stop processing current goal(s) in favor of new goal(s) given.

Does that make sense?

edit flag offensive delete link more



Cancel : Stop processing goal(s)

I'd add: "stop processing currently active goal(s)*.

The way it's currently phrased makes it sound like the action server will never again accept a new goal, which is not the case.

gvdhoorn gravatar image gvdhoorn  ( 2019-09-19 02:07:10 -0500 )edit

That does make sense now. Thanks for clearing that up!

ssssss gravatar image ssssss  ( 2019-09-23 01:44:13 -0500 )edit

Question Tools

1 follower


Asked: 2019-09-18 09:04:20 -0500

Seen: 3,547 times

Last updated: Sep 18 '19