30 #ifndef REALTIME_TOOLS__REALTIME_SERVER_GOAL_HANDLE_H 31 #define REALTIME_TOOLS__REALTIME_SERVER_GOAL_HANDLE_H 42 template <
class Action>
63 RealtimeServerGoalHandle(GoalHandle &gh,
const ResultPtr &preallocated_result = ResultPtr((Result*)NULL),
const FeedbackPtr &preallocated_feedback = FeedbackPtr((Feedback*)NULL))
68 preallocated_result_(preallocated_result),
69 preallocated_feedback_(preallocated_feedback)
71 if (!preallocated_result_)
72 preallocated_result_.reset(
new Result);
73 if (!preallocated_feedback_)
74 preallocated_feedback_.reset(
new Feedback);
77 void setAborted(ResultConstPtr result = ResultConstPtr((Result*)NULL))
79 if (!req_succeed_ && !req_abort_ && !req_cancel_)
86 void setCanceled(ResultConstPtr result = ResultConstPtr((Result*)NULL))
88 if (!req_succeed_ && !req_abort_ && !req_cancel_)
95 void setSucceeded(ResultConstPtr result = ResultConstPtr((Result*)NULL))
97 if (!req_succeed_ && !req_abort_ && !req_cancel_)
104 void setFeedback(FeedbackConstPtr feedback = FeedbackConstPtr((Feedback*)NULL))
106 req_feedback_ = feedback;
116 using namespace actionlib_msgs;
120 if (req_abort_ && (gs.status == GoalStatus::ACTIVE ||
121 gs.status == GoalStatus::PREEMPTING))
128 else if (req_cancel_ && gs.status == GoalStatus::PREEMPTING)
135 else if (req_succeed_ && (gs.status == GoalStatus::ACTIVE ||
136 gs.status == GoalStatus::PREEMPTING))
143 if (req_feedback_ && gs.status == GoalStatus::ACTIVE)
153 #endif // header guard void publishFeedback(const Feedback &feedback)
boost::shared_ptr< const Goal > getGoal() const
actionlib_msgs::GoalStatus getGoalStatus() const
void setCanceled(const Result &result=Result(), const std::string &text=std::string(""))
void setSucceeded(const Result &result=Result(), const std::string &text=std::string(""))
void setAborted(const Result &result=Result(), const std::string &text=std::string(""))