#include <simple_action_server.h>
Public Types | |
typedef boost::function< void(const GoalConstPtr &)> | ExecuteCallback |
typedef ActionServer< ActionSpec >::GoalHandle | GoalHandle |
Public Member Functions | |
boost::shared_ptr< const Goal > | 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 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. More... | |
bool | isActive () |
Allows polling implementations to query about the status of the current goal. More... | |
bool | isNewGoalAvailable () |
Allows polling implementations to query about the availability of a new goal. More... | |
bool | isPreemptRequested () |
Allows polling implementations to query about preempt requests. More... | |
void | publishFeedback (const Feedback &feedback) |
Publishes feedback for a given goal. More... | |
void | publishFeedback (const FeedbackConstPtr &feedback) |
Publishes feedback for a given goal. More... | |
void | registerGoalCallback (boost::function< void()> cb) |
Allows users to register a callback to be invoked when a new goal is available. More... | |
void | registerPreemptCallback (boost::function< void()> cb) |
Allows users to register a callback to be invoked when a new preempt request is available. More... | |
void | setAborted (const Result &result=Result(), const std::string &text=std::string("")) |
Sets the status of the active goal to aborted. More... | |
void | setPreempted (const Result &result=Result(), const std::string &text=std::string("")) |
Sets the status of the active goal to preempted. More... | |
void | setSucceeded (const Result &result=Result(), const std::string &text=std::string("")) |
Sets the status of the active goal to succeeded. More... | |
void | shutdown () |
Explicitly shutdown the action server. More... | |
SimpleActionServer (ros::NodeHandle n, std::string name, bool auto_start) | |
Constructor for a SimpleActionServer. More... | |
SimpleActionServer (ros::NodeHandle n, std::string name, ExecuteCallback execute_callback, bool auto_start) | |
Constructor for a SimpleActionServer. More... | |
ROS_DEPRECATED | SimpleActionServer (ros::NodeHandle n, std::string name, ExecuteCallback execute_callback=NULL) |
Constructor for a SimpleActionServer. More... | |
SimpleActionServer (std::string name, bool auto_start) | |
Constructor for a SimpleActionServer. More... | |
SimpleActionServer (std::string name, ExecuteCallback execute_callback, bool auto_start) | |
Constructor for a SimpleActionServer. More... | |
ROS_DEPRECATED | SimpleActionServer (std::string name, ExecuteCallback execute_callback=NULL) |
DEPRECATED: Constructor for a SimpleActionServer. More... | |
void | start () |
Explicitly start the action server, used it auto_start is set to false. More... | |
~SimpleActionServer () | |
Private Member Functions | |
void | executeLoop () |
Called from a separate thread to call blocking execute calls. More... | |
void | goalCallback (GoalHandle goal) |
Callback for when the ActionServer receives a new goal and passes it on. More... | |
void | preemptCallback (GoalHandle preempt) |
Callback for when the ActionServer receives a new preempt and passes it on. More... | |
Private Attributes | |
boost::shared_ptr< ActionServer< ActionSpec > > | as_ |
GoalHandle | current_goal_ |
ExecuteCallback | execute_callback_ |
boost::condition | execute_condition_ |
boost::thread * | execute_thread_ |
boost::function< void()> | goal_callback_ |
boost::recursive_mutex | lock_ |
ros::NodeHandle | n_ |
bool | need_to_terminate_ |
bool | new_goal_ |
bool | new_goal_preempt_request_ |
GoalHandle | next_goal_ |
boost::function< void()> | preempt_callback_ |
bool | preempt_request_ |
boost::mutex | terminate_mutex_ |
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 changed automatically to reflect this.
Definition at line 95 of file simple_action_server.h.
typedef boost::function<void (const GoalConstPtr &)> actionlib::SimpleActionServer< ActionSpec >::ExecuteCallback |
Definition at line 102 of file simple_action_server.h.
typedef ActionServer<ActionSpec>::GoalHandle actionlib::SimpleActionServer< ActionSpec >::GoalHandle |
Definition at line 101 of file simple_action_server.h.
actionlib::SimpleActionServer< ActionSpec >::SimpleActionServer | ( | std::string | name, |
ExecuteCallback | execute_callback, | ||
bool | auto_start | ||
) |
Constructor for a SimpleActionServer.
name | A name for the action server |
execute_callback | Optional 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_start | A 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 82 of file simple_action_server_imp.h.
actionlib::SimpleActionServer< ActionSpec >::SimpleActionServer | ( | std::string | name, |
bool | auto_start | ||
) |
Constructor for a SimpleActionServer.
name | A name for the action server |
auto_start | A 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 100 of file simple_action_server_imp.h.
actionlib::SimpleActionServer< ActionSpec >::SimpleActionServer | ( | std::string | name, |
ExecuteCallback | execute_callback = NULL |
||
) |
DEPRECATED: Constructor for a SimpleActionServer.
name | A name for the action server |
execute_callback | Optional 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. |
Definition at line 116 of file simple_action_server_imp.h.
actionlib::SimpleActionServer< ActionSpec >::SimpleActionServer | ( | ros::NodeHandle | n, |
std::string | name, | ||
ExecuteCallback | execute_callback, | ||
bool | auto_start | ||
) |
Constructor for a SimpleActionServer.
n | A NodeHandle to create a namespace under |
name | A name for the action server |
execute_callback | Optional 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_start | A 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 134 of file simple_action_server_imp.h.
actionlib::SimpleActionServer< ActionSpec >::SimpleActionServer | ( | ros::NodeHandle | n, |
std::string | name, | ||
bool | auto_start | ||
) |
Constructor for a SimpleActionServer.
n | A NodeHandle to create a namespace under |
name | A name for the action server |
auto_start | A 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 152 of file simple_action_server_imp.h.
actionlib::SimpleActionServer< ActionSpec >::SimpleActionServer | ( | ros::NodeHandle | n, |
std::string | name, | ||
ExecuteCallback | execute_callback = NULL |
||
) |
Constructor for a SimpleActionServer.
n | A NodeHandle to create a namespace under |
name | A name for the action server |
execute_callback | Optional 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. |
Definition at line 169 of file simple_action_server_imp.h.
actionlib::SimpleActionServer< ActionSpec >::~SimpleActionServer |
Definition at line 186 of file simple_action_server_imp.h.
boost::shared_ptr< const typename SimpleActionServer< ActionSpec >::Goal > actionlib::SimpleActionServer< ActionSpec >::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 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.
Definition at line 213 of file simple_action_server_imp.h.
|
private |
Called from a separate thread to call blocking execute calls.
Definition at line 396 of file simple_action_server_imp.h.
|
private |
Callback for when the ActionServer receives a new goal and passes it on.
Definition at line 328 of file simple_action_server_imp.h.
bool actionlib::SimpleActionServer< ActionSpec >::isActive |
Allows polling implementations to query about the status of the current goal.
Definition at line 263 of file simple_action_server_imp.h.
bool actionlib::SimpleActionServer< ActionSpec >::isNewGoalAvailable |
Allows polling implementations to query about the availability of a new goal.
Definition at line 250 of file simple_action_server_imp.h.
bool actionlib::SimpleActionServer< ActionSpec >::isPreemptRequested |
Allows polling implementations to query about preempt requests.
Definition at line 257 of file simple_action_server_imp.h.
|
private |
Callback for when the ActionServer receives a new preempt and passes it on.
Definition at line 373 of file simple_action_server_imp.h.
void actionlib::SimpleActionServer< ActionSpec >::publishFeedback | ( | const Feedback & | feedback | ) |
Publishes feedback for a given goal.
feedback | The feedback to publish |
Definition at line 322 of file simple_action_server_imp.h.
void actionlib::SimpleActionServer< ActionSpec >::publishFeedback | ( | const FeedbackConstPtr & | feedback | ) |
Publishes feedback for a given goal.
feedback | Shared pointer to the feedback to publish |
Definition at line 316 of file simple_action_server_imp.h.
void actionlib::SimpleActionServer< ActionSpec >::registerGoalCallback | ( | boost::function< void()> | cb | ) |
Allows users to register a callback to be invoked when a new goal is available.
cb | The callback to be invoked |
Definition at line 298 of file simple_action_server_imp.h.
void actionlib::SimpleActionServer< ActionSpec >::registerPreemptCallback | ( | boost::function< void()> | cb | ) |
Allows users to register a callback to be invoked when a new preempt request is available.
cb | The callback to be invoked |
Definition at line 310 of file simple_action_server_imp.h.
void actionlib::SimpleActionServer< ActionSpec >::setAborted | ( | const Result & | result = Result() , |
const std::string & | text = std::string("") |
||
) |
Sets the status of the active goal to aborted.
result | An optional result to send back to any clients of the goal |
result | An optional text message to send back to any clients of the goal |
Definition at line 282 of file simple_action_server_imp.h.
void actionlib::SimpleActionServer< ActionSpec >::setPreempted | ( | const Result & | result = Result() , |
const std::string & | text = std::string("") |
||
) |
Sets the status of the active goal to preempted.
result | An optional result to send back to any clients of the goal |
result | An optional text message to send back to any clients of the goal |
Definition at line 290 of file simple_action_server_imp.h.
void actionlib::SimpleActionServer< ActionSpec >::setSucceeded | ( | const Result & | result = Result() , |
const std::string & | text = std::string("") |
||
) |
Sets the status of the active goal to succeeded.
result | An optional result to send back to any clients of the goal |
result | An optional text message to send back to any clients of the goal |
Definition at line 274 of file simple_action_server_imp.h.
void actionlib::SimpleActionServer< ActionSpec >::shutdown |
Explicitly shutdown the action server.
Definition at line 194 of file simple_action_server_imp.h.
void actionlib::SimpleActionServer< ActionSpec >::start |
Explicitly start the action server, used it auto_start is set to false.
Definition at line 439 of file simple_action_server_imp.h.
|
private |
Definition at line 269 of file simple_action_server.h.
|
private |
Definition at line 271 of file simple_action_server.h.
|
private |
Definition at line 279 of file simple_action_server.h.
|
private |
Definition at line 281 of file simple_action_server.h.
|
private |
Definition at line 282 of file simple_action_server.h.
|
private |
Definition at line 277 of file simple_action_server.h.
|
private |
Definition at line 275 of file simple_action_server.h.
|
private |
Definition at line 267 of file simple_action_server.h.
|
private |
Definition at line 285 of file simple_action_server.h.
|
private |
Definition at line 273 of file simple_action_server.h.
|
private |
Definition at line 273 of file simple_action_server.h.
|
private |
Definition at line 271 of file simple_action_server.h.
|
private |
Definition at line 278 of file simple_action_server.h.
|
private |
Definition at line 273 of file simple_action_server.h.
|
private |
Definition at line 284 of file simple_action_server.h.