Class SimpleActionServer
SimpleActionServer The SimpleActionServer implements a single goal policy on top of the ActionServer class.
The specification of the policy is as follows: only one goal can have an active status at a time, new goals preempt previous goals based on the stamp in their GoalID field (later goals preempt earlier ones), an explicit preempt goal preempts all goals with timestamps that are less than or equal to the stamp associated with the preempt, accepting a new goal implies successful preemption of any old goal and the status of the old goal will be change automatically to reflect this.
Methods
SimpleActionServer:start () | Start the action server. |
SimpleActionServer:shutdown () | Shutdown the action server |
SimpleActionServer:acceptNewGoal () | Accepts a new goal when one is available. |
SimpleActionServer:isNewGoalAvailable () | Allows to query about the availability of a new goal. |
SimpleActionServer:isPreemptRequested () | Allows to query about preempt requests. |
SimpleActionServer:isActive () | Allows to query about the status of the current goal. |
SimpleActionServer:setSucceeded (result, text) | Sets the status of the active goal to succeeded. |
SimpleActionServer:setAborted (result, text) | Sets the status of the active goal to aborted. |
SimpleActionServer:publishFeedback (feedback) | Publishes feedback for a given goal. |
SimpleActionServer:setPreempted (result, text) | Sets the status of the active goal to preempted. |
SimpleActionServer:registerGoalCallback (goal_cb) | Allows users to register a callback to be invoked when a new goal is available. |
SimpleActionServer:registerPreemptCallback (preempt_cb) | Allows users to register a callback to be invoked when a new preempt request is available. |
Methods
- SimpleActionServer:start ()
- Start the action server.
- SimpleActionServer:shutdown ()
- Shutdown the action server
- SimpleActionServer:acceptNewGoal ()
-
Accepts a new goal when one is available.
The status of this goal is set to active upon acceptance, and the
status of any previously active goal is set to preempted. Preempts
received for the new goal between checking if isNewGoalAvailable or
invokation of a goal callback and the acceptNewGoal call will not
trigger a preempt callback. This means, isPreemptReqauested should
be called after accepting the goal even for callback-based implementations
to make sure the new goal does not have a pending preempt request.
Returns:
-
A new goal.
- SimpleActionServer:isNewGoalAvailable ()
-
Allows to query about the availability of a new goal.
Returns:
-
true if a new goal is available, false otherwise
- SimpleActionServer:isPreemptRequested ()
-
Allows to query about preempt requests.
Returns:
-
true if a preempt is requested, false otherwise
- SimpleActionServer:isActive ()
-
Allows to query about the status of the current goal.
Returns:
-
true if a goal is active, false otherwise
- SimpleActionServer:setSucceeded (result, text)
-
Sets the status of the active goal to succeeded.
Parameters:
- result An optional result to send back to any clients of the goal
- text An optional text message to send back to any clients of the goal
- SimpleActionServer:setAborted (result, text)
-
Sets the status of the active goal to aborted.
Parameters:
- result An optional result to send back to any clients of the goal
- text An optional text message to send back to any clients of the goal
- SimpleActionServer:publishFeedback (feedback)
-
Publishes feedback for a given goal.
Parameters:
- feedback Feedback object to publish
- SimpleActionServer:setPreempted (result, text)
-
Sets the status of the active goal to preempted.
Parameters:
- result An optional result to send back to any clients of the goal
- text An optional text message to send back to any clients of the goal
- SimpleActionServer:registerGoalCallback (goal_cb)
-
Allows users to register a callback to be invoked when a new goal is available.
Parameters:
- goal_cb The callback to be invoked
- SimpleActionServer:registerPreemptCallback (preempt_cb)
-
Allows users to register a callback to be invoked when a new preempt request is available.
Parameters:
- preempt_cb The callback to be invoked