37 #ifndef ACTIONLIB__SERVER__SIMPLE_ACTION_SERVER_H_ 38 #define ACTIONLIB__SERVER__SIMPLE_ACTION_SERVER_H_ 40 #include <boost/thread/condition.hpp> 59 template<
class ActionSpec>
77 SimpleActionServer(std::string name, ExecuteCallback execute_callback,
bool auto_start);
124 ExecuteCallback execute_callback = NULL);
165 void setSucceeded(
const Result & result = Result(),
const std::string & text = std::string(
""));
172 void setAborted(
const Result & result = Result(),
const std::string & text = std::string(
""));
192 void setPreempted(
const Result & result = Result(),
const std::string & text = std::string(
""));
257 #endif // ACTIONLIB__SERVER__SIMPLE_ACTION_SERVER_H_ 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...
void publishFeedback(const FeedbackConstPtr &feedback)
Publishes feedback for a given goal.
boost::condition execute_condition_
boost::function< void()> goal_callback_
void preemptCallback(GoalHandle preempt)
Callback for when the ActionServer receives a new preempt and passes it on.
void goalCallback(GoalHandle goal)
Callback for when the ActionServer receives a new goal and passes it on.
ACTION_DEFINITION(ActionSpec)
void executeLoop()
Called from a separate thread to call blocking execute calls.
SimpleActionServer(std::string name, ExecuteCallback execute_callback, bool auto_start)
Constructor for a SimpleActionServer.
boost::mutex terminate_mutex_
boost::thread * execute_thread_
bool isActive()
Allows polling implementations to query about the status of the current goal.
void setSucceeded(const Result &result=Result(), const std::string &text=std::string(""))
Sets the status of the active goal to succeeded.
void shutdown()
Explicitly shutdown the action server.
boost::function< void(const GoalConstPtr &)> ExecuteCallback
void start()
Explicitly start the action server, used it auto_start is set to false.
void setPreempted(const Result &result=Result(), const std::string &text=std::string(""))
Sets the status of the active goal to preempted.
boost::function< void()> preempt_callback_
void registerPreemptCallback(boost::function< void()> cb)
Allows users to register a callback to be invoked when a new preempt request is available.
bool new_goal_preempt_request_
bool isPreemptRequested()
Allows polling implementations to query about preempt requests.
Encapsulates a state machine for a given goal that the user can trigger transitions on...
ExecuteCallback execute_callback_
void setAborted(const Result &result=Result(), const std::string &text=std::string(""))
Sets the status of the active goal to aborted.
ActionServer< ActionSpec >::GoalHandle GoalHandle
boost::shared_ptr< ActionServer< ActionSpec > > as_
void registerGoalCallback(boost::function< void()> cb)
Allows users to register a callback to be invoked when a new goal is available.
boost::recursive_mutex lock_
bool isNewGoalAvailable()
Allows polling implementations to query about the availability of a new goal.