ros学习pcl 详细笔记

主要参考为roswiki上的内容,这里根据我的学习路线进行了一个系统的整合与思考。

pcl

http://wiki.ros.org/pcl

PCL Overview

http://wiki.ros.org/pcl/Overview

数据类型

三种

sensor_msgs::PointCloud — ROS message (deprecated)
sensor_msgs::PointCloud2 — ROS message

pcl::PCLPointCloud2 — PCL data structure mostly for compatibility with ROS (I think)

pcl::PointCloud — standard PCL data structure

http://docs.ros.org/en/jade/api/sensor_msgs/html/msg/PointCloud2.html
此消息包含N维点的集合,其中可能包含法线、强度等附加信息。点数据存储为二进制blob,其布局由“字段”数组的内容描述。
点云数据可以是2d(类似图像)或1d(无序)组织的。组织为2d图像的点云可能由立体或飞行时间等相机深度传感器产生。be produced by camera depth sensors such as stereo or time-of-flight.激光时间测距原理
传感器数据采集时间和坐标帧ID(对于3d点)。

横向纵向分辨率
fileds表达类型

大小端 先存高字节还是低字节
单点的字节数据步长
每个点除了rgb 还有xyz,然后依次排列
offset 从点结构起点的偏移量

https://docs.ros.org/en/groovy/api/pcl/html/classpcl_1_1PointCloud.html
此类的结构与PointCloud2消息类型类似,包括一个标头。在message类和point cloud模板类之间进行转换非常简单(见下文),PCL库中的大多数方法都接受这两种类型的对象。尽管如此,在点云处理节点中使用该模板类还是比使用消息对象更好,原因之一是您可以将单个点作为对象使用,而不必使用它们的原始数据。

Determining the point type for a given point cloud message

https://www.jianshu.com/p/aa94d9b43ee8

#include<pcl/point_cloud.h>
#include<pcl/point_types.h>
#include<pcl/visualization/pcl_visualizer.h> //cout endl

#include <pcl/common/file_io.h>

点云格式之间的转换以及讲到的注意点

注意:应停止使用旧的PointCloud消息类型。为了完整起见,我们将在下面总结所有三种点云类型的订阅和发布操作。

他这里讲到了三种数据的发布和订阅
当使用sensor_msgs::PointCloud2订阅服务器订阅pcl::PointCloud主题时(或者是发布器),两种类型的sensor_msgs::PointCloud2和pcl::PointCloud之间的转换(反序列化/反操作)由订阅服务器动态完成。
The publisher takes care of the conversion (serialization) between sensor_msgs::PointCloud2 and pcl::PointCloud where needed.
发布者负责传感器_msgs::PointCloud2和pcl::PointCloud之间的转换(序列化)。

pcl/tutorials

  1. http://wiki.ros.org/pcl/Tutorials
catkin_create_pkg my_pcl_tutorial pcl_conversions pcl_ros roscpp sensor_msgs 

package.xml

<build_depend>libpcl-all-dev</build_depend>
<exec_depend>libpcl-all</exec_depend>

However, you should also note that pcl::PCLPointCloud2 is an important and useful type as well: you can directly subscribe to nodes using that type and it will be automatically serialized to/from the sensor_msgs type

他这里用了一个例子,用的该格式进行了一个简单的VoxelGrid filter滤波
http://wiki.ros.org/pcl/Tutorials/hydro?action=AttachFile&do=view&target=example_voxelgrid_pcl_types.cpp

框架

他这里用了个初始框架,初始化ros并且创建了1个发布器和订阅器

sensor_msgs/PointCloud2

该格式是ros的应用,例子里用的3d网格缩减采样
https://pointclouds.org/documentation/tutorials/

因为我们在上面的代码片段中使用了ROS订阅者和发布者,所以我们可以忽略使用PCD格式加载和保存点云数据。因此,本教程中唯一相关的部分仍然是创建PCL对象、传递输入数据并执行实际计算的第20-24行:
https://blog.csdn.net/guiwukejiBGG/article/details/83476544
constptr 常量指针
*a 代表存储单元中的数据
pcl::PCLPointCloud2 * 声明为指针变量
cloud = new pcl::PCLPointCloud2; 创建一个新的

他这里cb函数接收到sensor msgs的数据,将ros的数据格式转化为pcl中的,针对pcl的数据格式进行处理。处理完后在转化为ros中的数据格式。

pcl/PointCloud< T >

这是pcl自己的格式
出于模块化和效率的原因,该格式以点类型为模板,PCL提供了一个与SSE对齐的模板化通用类型列表。
在下面的示例中,我们估计场景中发现的最大平面的平面系数。

他这里给到了一个平面模型分割的案例。

Notice that we added two conversion steps: from sensor_msgs/PointCloud2 to pcl/PointCloud and from pcl::ModelCoefficients to pcl_msgs::ModelCoefficients. We also changed the variable that we publish from output to coefficients.
他例子是提取了一个平面

document

https://pointclouds.org/documentation/tutorials/
https://docs.ros.org/en/api/pcl_ros/html/ https://pcl.readthedocs.io/projects/tutorials/en/latest/index.html
http://wiki.ros.org/pcl_ros

perception_pcl

pcl ros 接口仓库。
PCL-ROS is the preferred bridge for 3D applications involving n-D Point Clouds and 3D geometry processing in ROS.
This is a metapackage.

pcl ros

ros nodelets

https://wiki.ros.org/pcl_ros/Tutorials

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值