【cartographer源码分析】系列的第三部分【sensor源码分析】。
现总结sensor文件夹涉及到的主要功能:
【1】sensor/point_cloud.h:
- 点云数据是指在一个三维坐标系统中的一组向量的集合。
- cartographer的PointCloud是由Vector3f组成的vector即std::vector
- PointCloudWithIntensities则是由点云和光线强度组成的struct类。
- point_cloud.h主要定义了跟点云相关的处理操作。包括4个函数
- PointCloud TransformPointCloud(const PointCloud& point_cloud, const transform::Rigid3f& transform);根据三维网格参数转换点云
- PointCloud Crop(const PointCloud& point_cloud, float min_z, float max_z);去掉z轴区域外的点云,返回一个新的点云
- proto::PointCloud ToProto(const PointCloud& point_cloud);序列化
- PointCloud ToPointCloud(const proto::PointCloud& proto);反序列化
【2】sensor/compressed_point_cloud.h
- CompressedPointCloud点云压缩类,压缩ponits以减少存储空间,压缩后有精度损失。方法:按照block分组。提供5个函数:
- CompressedPointCloud(const PointCloud& point_cloud) 使用点云数据初始化,并将点云压缩到 std::vector point_data_中,num_points_为点云数量
- PointCloud Decompress() const;返回解压缩的点云
- bool empty() const; 点云是否为空
- size_t size() const; 点云数量
- ConstIterator begin() const;访问点云block的迭代器
- ConstIterator end() const;点云block的尾后迭代器