使用 ROS 或 velodyne 驱动程序从 VLP-16 添加距离场:[x,y,z,distance]

Add distance field : [x,y,z,distance] from VLP-16 using ROS or velodyne driver

Velodyne 激光雷达发布 PointCloud2 消息,其字段包含:

但是,我需要添加距离字段(带距离的输出点),因为我需要这个字段作为研究目的。

是否可以编写一个节点或调整 velodyne 驱动程序以使用该字段输出点?如果是这样,你能告诉我如何实现吗?

非常感谢任何帮助。谢谢:)

最好的解决方案不是更改 velodyne 驱动程序,而是因为您使用的是 ros,所以要利用所有内置的生态系统工具。 例如,velodyne publishes a sensor_msgs/PointCloud2 topic. Then internally, using C++, ROS treats any PointCloud2 msg into any PCL pointcloud type. If you're doing serious processing of pointclouds, don't re-invent the wheel (but worse), try solving the problem with tools from PCL. Use it's pre-built filters (ex ground plane filter) and prebuilt segmentation tools (ex could Euclidean Cluster Extraction solve your problem?). Additionally, some of these PCL tools are pre-wrapped in ros,如果需要,可以从启动文件中使用!

否则,您可以使用 PCL 添加距离参数,方法是在类型为 pcl::PointWithRange or pcl::PointWithViewpoint 的 ros 中选择点云类型。我不认为它会自动计算那个变量,但你可以遍历这些点并自己计算它,它的内存已经被分配和本地化了。