3 #include <actionlib_tutorials/FibonacciAction.h> 14 actionlib_tutorials::FibonacciResult
result_;
29 void executeCB(
const actionlib_tutorials::FibonacciGoalConstPtr &goal)
36 feedback_.sequence.clear();
37 feedback_.sequence.push_back(0);
38 feedback_.sequence.push_back(1);
41 ROS_INFO(
"%s: Executing, creating fibonacci sequence of order %i with seeds %i, %i", action_name_.c_str(), goal->order, feedback_.sequence[0], feedback_.sequence[1]);
44 for(
int i=1; i<=goal->order; i++)
49 ROS_INFO(
"%s: Preempted", action_name_.c_str());
55 feedback_.sequence.push_back(feedback_.sequence[i] + feedback_.sequence[i-1]);
64 result_.sequence = feedback_.sequence;
65 ROS_INFO(
"%s: Succeeded", action_name_.c_str());
75 int main(
int argc,
char** argv)
void publishFeedback(const FeedbackConstPtr &feedback)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
void setSucceeded(const Result &result=Result(), const std::string &text=std::string(""))
int main(int argc, char **argv)
actionlib::SimpleActionServer< actionlib_tutorials::FibonacciAction > as_
void setPreempted(const Result &result=Result(), const std::string &text=std::string(""))
bool isPreemptRequested()
void executeCB(const actionlib_tutorials::FibonacciGoalConstPtr &goal)
actionlib_tutorials::FibonacciResult result_
FibonacciAction(std::string name)
actionlib_tutorials::FibonacciFeedback feedback_