订阅这个话题的主要目的是提前判断robot是否接近goal 目标的位置,比起订阅pose的坐标做欧式距离计算更有效
#include"ros/ros.h"
#include"nav_msgs/Path.h"
#include <stdio.h>
void PathSub(const nav_msgs::Path& pt)
{
ROS_INFO("%d",pt.poses.size());
}
int main(int argc, char **argv)
{
ros::init(argc, argv, "getPath");
ros::NodeHandle n;
ros::Subscriber mapsub = n.subscribe("/robot3/move_base/NavfnROS/plan",100,PathSub);
ros::spin();
return 0;
}