ROS中PCL的數據類型轉換


1、ROS中的點雲數據類型

sensor_msgs::PointClous
// 包含 x、y 和 z 點(所有浮點數)以及多個通道; 每個通道都有一個字符串名稱和一個浮點值數組
sensor_msgs::PointCloud2
//表示任意 nD(n 維)數據。 點值現在可以是任何原始數據類型(int、float、double 等),並且可以將消息指定為“密集”,具有高度和寬度值

2、點雲轉換

  1. ROS轉PCL數據格式
  • sensor_msgs::PointCloud2轉pcl::PCLPointCloud2
pcl_conversions::toPCL(sensor_msgs::PointCloud2, pcl::PCLPointCloud2);
  • sensor_msgs::PointCloud2轉pcl::PointCloud<pcl::PointXYZ>
pcl::fromROSMsg(sensor_msg::PointCloud2,pcl::PointCloud<pcl::PointXYZ>);

  2.PCL轉ROS數據格式

  • pcl::PointCloud2轉sensor_msgs::PointCloud2
pcl::conversions::fromPCL(pcl::PCLPointCloud2,sensor_msgs::PointCloud2);
  • pcl::PointCloud<pcl::PointXYZ>轉sensor_msgs::PointCloud2
pcl::toROSMsg(pcl::PointCloud<pcl::PointXYZ>,sensor_msgs::PointCloud2);

  3.PCL中數據互轉

  • pcl::PCLPointCloud2轉pcl::PointCloud<pcl::PointXYZ>
pcl::fromPCLPointCloud2(pcl::PCLPointCloud2,pcl::PointCloud<pcl::PointXYZ>);
  • pcl::PointCloud<pcl::PointXYZ>轉pcl::PCLPointCloud2
pcl::toPCLPointCloud2(pcl::PointCloud<pcl::PointXYZ>,pcl::PCLPointCloud2)

參考博客:http://wiki.ros.org/pcl/Overview

     https://blog.csdn.net/u010284636/article/details/79214841


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM