#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服务,自主定位
ros下机器人自主定位服务的调用
最新推荐文章于 2024-04-02 19:47:06 发布