ros下机器人自主定位服务的调用

来源:互联网 发布:智能马桶 知乎 编辑:程序博客网 时间:2024/04/28 17:07
#include "ros/ros.h"#include "std_msgs/Int16.h"#include <move_base_msgs/MoveBaseAction.h>#include <actionlib/client/simple_action_client.h>#include "std_srvs/Empty.h"#include <cstdlib>int main(int argc, char **argv){  ros::init(argc, argv, "robot_global_localization");  ros::NodeHandle n;  ros::ServiceClient client = n.serviceClient<std_srvs::Empty>("global_localization");  std_srvs::Empty srv;     if (client.call(srv))//服务调用  {      ROS_INFO("  Successful call");  }  else  {    ROS_ERROR("Failed to call service global_location");    return 1;  }  return 0;}调用/global_localization服务,自主定位

0 0