Failed to find match for field 'intensity'.
最近发现订阅的原始点云明明有intensity信息,但是保存下来全是0,且有如上报错。
订阅
//订阅原始点云
front_raw_cloud_sub_ = node.subscribe("/hesai/pandar_points", 100, &Perception::RawCloudCallBack, (Perception *) this);
然后从ros消息类型转pcl,保存
void Perception::RawCloudCallBack(const sensor_msgs::PointCloud2ConstPtr &msg)
{
pcl::PointCloud in_cloud;
pcl::fromROSMsg(*msg, in_cloud);
std::cout << "the front lidar raw cloud size
pcl::io::savePCDFileASCII("/home/chen/Desktop/pcd/test.pcd", in_cloud);
}
打印出来发现强度值是0,但是xyz有值
回过头来看原始点云数据,是存在intensity的,但是还包含其他信息,比如回环ring
rostopic echo /heisai/pandar_points >> test.txt
找到原始的数据类型,用原始数据类型解析保存
直接用ros里面就有的包就可以直接转pcd
rosrun pcl_ros bag_to_pcd 2021-12-12-14-06-27.bag /hesai/pandar_points pcd_savepath
// 2021-12-12-14-06-27.bag为录制的rosbag包
// /hesai/pandar_points 为话题名称
// pcd_savepath 为要保存的文件夹路径
Got 115200 data points in frame PandarSwift on topic /hesai/pandar_points with the following fields: x y z intensity timestamp ring
Data saved to pcd/1564055017.164603000.pcd
如上就可以把所有信息都保存在pcd中