Rosanswers logo


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

The wikipage (http://wiki.ros.org/actionlib/DetailedDescription) 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 (http://wiki.ros.org/actionlib#Using_the_ActionClient), that:

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

However, here (http://wiki.ros.org/actionlib/DetailedDescription) 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!

Originally posted by ssssss on ROS Answers with karma: 33 on 2019-09-18

Post score: 3


1 Answer 1


Rosanswers logo

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?

Originally posted by stevemacenski with karma: 8272 on 2019-09-18

This answer was ACCEPTED on the original site

Post score: 8

Original comments

Comment by gvdhoorn on 2019-09-19:\

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.

Comment by ssssss on 2019-09-23:
That does make sense now. Thanks for clearing that up!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.