消息类型:
ROS中点云的消息类型:
sensor_msgs::PointCloud2
PCL中的点云消息类型:
pcl::PointCloud<T> T是指pcl::PointXYZ等point types.
步骤:
1.rosbag play 包名
2.订阅消息,进入回调函数:
将订阅到的消息转化为pcl的类型,用pcl::fromROSMsg (*input, cloud).input是回调函数参数,是接收.cloud是输出.
将点云转化为PCD文件,用pcl::io::savePCDFileASCII(name,input).生成的pcd文件在bag包所在路径下.
贴上我的源码:
#include <ros/ros.h>
#include <pcl/point_cloud.h>
//msgs type and