fibonacci_class_client.cpp
Go to the documentation of this file.
1 #include <ros/ros.h>
3 #include <actionlib_tutorials/FibonacciAction.h>
4 
5 using namespace actionlib_tutorials;
7 
8 class MyNode
9 {
10 public:
11  MyNode() : ac("fibonacci", true)
12  {
13  ROS_INFO("Waiting for action server to start.");
14  ac.waitForServer();
15  ROS_INFO("Action server started, sending goal.");
16  }
17 
18  void doStuff(int order)
19  {
20  FibonacciGoal goal;
21  goal.order = order;
22 
23  // Need boost::bind to pass in the 'this' pointer
24  ac.sendGoal(goal,
25  boost::bind(&MyNode::doneCb, this, _1, _2),
28 
29  }
30 
32  const FibonacciResultConstPtr& result)
33  {
34  ROS_INFO("Finished in state [%s]", state.toString().c_str());
35  ROS_INFO("Answer: %i", result->sequence.back());
36  ros::shutdown();
37  }
38 
39 private:
41 };
42 
43 int main (int argc, char **argv)
44 {
45  ros::init(argc, argv, "test_fibonacci_class_client");
46  MyNode my_node;
47  my_node.doStuff(10);
48  ros::spin();
49  return 0;
50 }
int main(int argc, char **argv)
actionlib::SimpleActionClient< FibonacciAction > Client
boost::function< void(const FeedbackConstPtr &feedback)> SimpleFeedbackCallback
void doStuff(int order)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
std::string toString() const
void doneCb(const actionlib::SimpleClientGoalState &state, const FibonacciResultConstPtr &result)
#define ROS_INFO(...)
ROSCPP_DECL void spin()
ROSCPP_DECL void shutdown()


actionlib_tutorials
Author(s): Melonee Wise
autogenerated on Sat Apr 4 2020 03:47:16