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

#include "ros/ros.h"
#include "std_msgs/Int16.h"
#include 
#include 
#include "std_srvs/Empty.h"
#include 
int main(int argc, char **argv)
{
  ros::init(argc, argv, "robot_global_localization");

  ros::NodeHandle n;
  ros::ServiceClient client = n.serviceClient("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服务,自主定位





你可能感兴趣的:(※【ROS】)