localize_client.cpp
Go to the documentation of this file.
1 #include <ros/ros.h>
3 #include <nav2d_navigator/LocalizeAction.h>
4 #include <std_srvs/Trigger.h>
5 
7 
9 
11 
12 bool receiveCommand(std_srvs::Trigger::Request &req, std_srvs::Trigger::Response &res)
13 {
14  nav2d_navigator::LocalizeGoal goal;
15  goal.velocity = 0.5;
16  gLocalizeClient->sendGoal(goal);
17  res.success = true;
18  res.message = "Send LocalizeGoal to Navigator.";
19  return true;
20 }
21 
22 int main(int argc, char **argv)
23 {
24  ros::init(argc, argv, "Localize");
26 
28  gLocalizeClient = new LocalizeClient(NAV_LOCALIZE_ACTION, true);
29  gLocalizeClient->waitForServer();
30 
31  ros::spin();
32 
33  delete gLocalizeClient;
34  return 0;
35 }
bool waitForServer(const ros::Duration &timeout=ros::Duration(0, 0)) const
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
ROSCPP_DECL void spin(Spinner &spinner)
#define NAV_LOCALIZE_ACTION
Definition: commands.h:15
bool receiveCommand(std_srvs::Trigger::Request &req, std_srvs::Trigger::Response &res)
actionlib::SimpleActionClient< nav2d_navigator::LocalizeAction > LocalizeClient
void sendGoal(const Goal &goal, SimpleDoneCallback done_cb=SimpleDoneCallback(), SimpleActiveCallback active_cb=SimpleActiveCallback(), SimpleFeedbackCallback feedback_cb=SimpleFeedbackCallback())
int main(int argc, char **argv)
LocalizeClient * gLocalizeClient
#define NAV_LOCALIZE_SERVICE
Definition: commands.h:9


nav2d_navigator
Author(s): Sebastian Kasperski
autogenerated on Thu Jun 6 2019 19:20:43