Livox_Loam当中的语法知识(自用笔记)

string容器的比较语法

string topic_name
b = topic_name.compare(string a)
if b == 0:相同的字符串
if b > 0:topic_name大于a的长度
if b < 0:topic_name小于a的长度
pcl::PointCloud<pcl::PointXYZ> laserCloudIn //定义PCL的点云格式类
pcl::fromROSMsg(const sensor_msgs::PointCloud2 &, pcl::PointCloud<T> &)//将ros中数据类型的点云信息转换成pcl的点云格式,sensor_msgs::PointCloud2 &填的是用来接收回调函数信息的变量的地址(*变量名字),而后面的变量也是填入指针(或地址),一般来说直接填入前面定义好的PCL的点云格式类的变量名字就行
pcl::removeNaNFromPointCloud(const pcl::PointCloud<PointT> &cloud_in,pcl::PointCloud<PointT> &cloud_out,std::vector<int> &index)//将点云中的无数据点NaN迪纳进行清除,参数列表都是传入地址,第一个为点云的输入,第二个是点云的输出,第三个是包含着空点的点云序列
(点云类实例化的变量名).points.size()//计算点云重点的数量
(点云类实例化的变量名).points[i].x ...//取点云中第i个点的坐标点

定义单个点的pcl数据类型:

pcl::PointXYZ laserCloudIn//定义单个点云点的数据类型

对于单个点来说:

//单个点来说,只可以得到当前的点的数据信息
laserCloudIn.x
laserCloudIn.y
laserCloudIn.z

定义点云集合:

pcl::PointCloud<pcl::PointXYZ> laserCloudIn //定义PCL的点云格式类

这样的话进行索引的时候就可以索引多个点的信息:

pcl::PointCloud<pcl::PointXYZ> laserCloudIn //定义PCL的点云格式类
laserCloudIn.points[i].x
laserCloudIn.points[i].y
laserCloudIn.points[i].z

此时laserCloudIn就包含了点云基本的一些位姿信息,通过:

如果是用容器储存pcl::PointXYZ类型的数据的话,那么有:

std::vector<pcl::PointXYZ> lasercloud

因此,此时对容器进行索引:

lasercloud[i]//表示的就是第i个点所储存的信息
//用容器储存的话,本质就跟直接创建点云集合类似
pcl::PointCloud<pcl::PointXYZ> laserCloudIn //定义PCL的点云格式类
laserCloudIn.points[i] = lasercloud[i]
//定义一个无符号无长度限制的整数a
size_t a;

位运算:位运算(按位与、按位或、异或)_Wanidde的博客-CSDN博客_位与运算

代码中用了很多位运算,讲很多判断条件写成二进制的信息,便于运算

pcl::PointCloud<_>::Ptr 点云库容器中的智能指针 share_ptr

通过.reset()函数可以进行初始化

//代码中,作者定义了下米娜的只能指针
pcl::PointCloud<PointType>::ptr laserCloudCornerArray
//后面再对指针进行初始化的时候是用到了.reset()函数
laserCloudCornerArray[i].reset(new pcl::PointCloud<PointType>())
//reset()括号中的内容就是指针指向的的新的指针类型
//当进行reset之后,原来的内润就会被释放掉

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值