Public Member Functions | Public Attributes | List of all members
actionlib.simple_action_server.SimpleActionServer Class Reference

The SimpleActionServer implements a singe 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. More...

Inheritance diagram for actionlib.simple_action_server.SimpleActionServer:
Inheritance graph
[legend]

Public Member Functions

def __del__ (self)
 
def __init__ (self, name, ActionSpec, execute_cb=None, auto_start=True)
 Constructor for a SimpleActionServer. More...
 
def accept_new_goal (self)
 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. More...
 
def executeLoop (self)
 Called from a separate thread to call blocking execute calls. More...
 
def get_default_result (self)
 
def internal_goal_callback (self, goal)
 Callback for when the ActionServer receives a new goal and passes it on. More...
 
def internal_preempt_callback (self, preempt)
 Callback for when the ActionServer receives a new preempt and passes it on. More...
 
def is_active (self)
 Allows polling implementations to query about the status of the current goal. More...
 
def is_new_goal_available (self)
 Allows polling implementations to query about the availability of a new goal. More...
 
def is_preempt_requested (self)
 Allows polling implementations to query about preempt requests. More...
 
def publish_feedback (self, feedback)
 Publishes feedback for a given goal. More...
 
def register_goal_callback (self, cb)
 Allows users to register a callback to be invoked when a new goal is available. More...
 
def register_preempt_callback (self, cb)
 Allows users to register a callback to be invoked when a new preempt request is available. More...
 
def set_aborted (self, result=None, text="")
 Sets the status of the active goal to aborted. More...
 
def set_preempted (self, result=None, text="")
 Sets the status of the active goal to preempted. More...
 
def set_succeeded (self, result=None, text="")
 Sets the status of the active goal to succeeded. More...
 
def start (self)
 Explicitly start the action server, used it auto_start is set to false. More...
 

Public Attributes

 action_server
 
 current_goal
 
 execute_callback
 
 execute_condition
 
 execute_thread
 
 goal_callback
 
 lock
 
 need_to_terminate
 
 new_goal
 
 new_goal_preempt_request
 
 next_goal
 
 preempt_callback
 
 preempt_request
 
 terminate_mutex
 

Detailed Description

The SimpleActionServer implements a singe 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.

Definition at line 54 of file simple_action_server.py.

Constructor & Destructor Documentation

◆ __init__()

def actionlib.simple_action_server.SimpleActionServer.__init__ (   self,
  name,
  ActionSpec,
  execute_cb = None,
  auto_start = True 
)

Constructor for a SimpleActionServer.

Parameters
nameA name for the action server
execute_cbOptional callback that gets called in a separate thread whenever a new goal is received, allowing users to have blocking callbacks. Adding an execute callback also deactivates the goalCallback.
auto_startA boolean value that tells the ActionServer whether or not to start publishing as soon as it comes up. THIS SHOULD ALWAYS BE SET TO FALSE TO AVOID RACE CONDITIONS and start() should be called after construction of the server.

Definition at line 61 of file simple_action_server.py.

◆ __del__()

def actionlib.simple_action_server.SimpleActionServer.__del__ (   self)

Definition at line 94 of file simple_action_server.py.

Member Function Documentation

◆ accept_new_goal()

def actionlib.simple_action_server.SimpleActionServer.accept_new_goal (   self)

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 invocation of a goal callback and the acceptNewGoal call will not trigger a preempt callback. This means, isPreemptRequested 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 shared_ptr to the new goal.

Definition at line 111 of file simple_action_server.py.

◆ executeLoop()

def actionlib.simple_action_server.SimpleActionServer.executeLoop (   self)

Called from a separate thread to call blocking execute calls.

Definition at line 264 of file simple_action_server.py.

◆ get_default_result()

def actionlib.simple_action_server.SimpleActionServer.get_default_result (   self)

Definition at line 176 of file simple_action_server.py.

◆ internal_goal_callback()

def actionlib.simple_action_server.SimpleActionServer.internal_goal_callback (   self,
  goal 
)

Callback for when the ActionServer receives a new goal and passes it on.

Definition at line 206 of file simple_action_server.py.

◆ internal_preempt_callback()

def actionlib.simple_action_server.SimpleActionServer.internal_preempt_callback (   self,
  preempt 
)

Callback for when the ActionServer receives a new preempt and passes it on.

Definition at line 246 of file simple_action_server.py.

◆ is_active()

def actionlib.simple_action_server.SimpleActionServer.is_active (   self)

Allows polling implementations to query about the status of the current goal.

Returns
True if a goal is active, false otherwise

Definition at line 148 of file simple_action_server.py.

◆ is_new_goal_available()

def actionlib.simple_action_server.SimpleActionServer.is_new_goal_available (   self)

Allows polling implementations to query about the availability of a new goal.

Returns
True if a new goal is available, false otherwise

Definition at line 138 of file simple_action_server.py.

◆ is_preempt_requested()

def actionlib.simple_action_server.SimpleActionServer.is_preempt_requested (   self)

Allows polling implementations to query about preempt requests.

Returns
True if a preempt is requested, false otherwise

Definition at line 143 of file simple_action_server.py.

◆ publish_feedback()

def actionlib.simple_action_server.SimpleActionServer.publish_feedback (   self,
  feedback 
)

Publishes feedback for a given goal.

Parameters
feedbackShared pointer to the feedback to publish

Definition at line 173 of file simple_action_server.py.

◆ register_goal_callback()

def actionlib.simple_action_server.SimpleActionServer.register_goal_callback (   self,
  cb 
)

Allows users to register a callback to be invoked when a new goal is available.

Parameters
cbThe callback to be invoked

Definition at line 190 of file simple_action_server.py.

◆ register_preempt_callback()

def actionlib.simple_action_server.SimpleActionServer.register_preempt_callback (   self,
  cb 
)

Allows users to register a callback to be invoked when a new preempt request is available.

Parameters
cbThe callback to be invoked

Definition at line 198 of file simple_action_server.py.

◆ set_aborted()

def actionlib.simple_action_server.SimpleActionServer.set_aborted (   self,
  result = None,
  text = "" 
)

Sets the status of the active goal to aborted.

Parameters
resultAn optional result to send back to any clients of the goal

Definition at line 165 of file simple_action_server.py.

◆ set_preempted()

def actionlib.simple_action_server.SimpleActionServer.set_preempted (   self,
  result = None,
  text = "" 
)

Sets the status of the active goal to preempted.

Parameters
resultAn optional result to send back to any clients of the goal

Definition at line 181 of file simple_action_server.py.

◆ set_succeeded()

def actionlib.simple_action_server.SimpleActionServer.set_succeeded (   self,
  result = None,
  text = "" 
)

Sets the status of the active goal to succeeded.

Parameters
resultAn optional result to send back to any clients of the goal

Definition at line 157 of file simple_action_server.py.

◆ start()

def actionlib.simple_action_server.SimpleActionServer.start (   self)

Explicitly start the action server, used it auto_start is set to false.

Definition at line 202 of file simple_action_server.py.

Member Data Documentation

◆ action_server

actionlib.simple_action_server.SimpleActionServer.action_server

Definition at line 92 of file simple_action_server.py.

◆ current_goal

actionlib.simple_action_server.SimpleActionServer.current_goal

Definition at line 82 of file simple_action_server.py.

◆ execute_callback

actionlib.simple_action_server.SimpleActionServer.execute_callback

Definition at line 67 of file simple_action_server.py.

◆ execute_condition

actionlib.simple_action_server.SimpleActionServer.execute_condition

Definition at line 80 of file simple_action_server.py.

◆ execute_thread

actionlib.simple_action_server.SimpleActionServer.execute_thread

Definition at line 86 of file simple_action_server.py.

◆ goal_callback

actionlib.simple_action_server.SimpleActionServer.goal_callback

Definition at line 68 of file simple_action_server.py.

◆ lock

actionlib.simple_action_server.SimpleActionServer.lock

Definition at line 78 of file simple_action_server.py.

◆ need_to_terminate

actionlib.simple_action_server.SimpleActionServer.need_to_terminate

Definition at line 71 of file simple_action_server.py.

◆ new_goal

actionlib.simple_action_server.SimpleActionServer.new_goal

Definition at line 63 of file simple_action_server.py.

◆ new_goal_preempt_request

actionlib.simple_action_server.SimpleActionServer.new_goal_preempt_request

Definition at line 65 of file simple_action_server.py.

◆ next_goal

actionlib.simple_action_server.SimpleActionServer.next_goal

Definition at line 83 of file simple_action_server.py.

◆ preempt_callback

actionlib.simple_action_server.SimpleActionServer.preempt_callback

Definition at line 69 of file simple_action_server.py.

◆ preempt_request

actionlib.simple_action_server.SimpleActionServer.preempt_request

Definition at line 64 of file simple_action_server.py.

◆ terminate_mutex

actionlib.simple_action_server.SimpleActionServer.terminate_mutex

Definition at line 72 of file simple_action_server.py.


The documentation for this class was generated from the following file:


actionlib
Author(s): Eitan Marder-Eppstein, Vijay Pradeep, Mikael Arguedas
autogenerated on Fri May 19 2023 02:36:55