目录
前言
论文:https://ieeexplore.ieee.org/abstract/document/8594299
Lego-loam源码地址: https://github.com/RobustFieldAutonomyLab/LeGO-LOAM
文章原理讲解除了看论文,看看这些博客:
其他博客代码理解推荐:https://blog.csdn.net/orange_littlegirl/article/details/95238586
安装编译运行:https://www.cnblogs.com/zhangjcblog/p/10580683.html
代码前期变量定义
首先PointType是带intensity的PointXYZ:
typedef pcl::PointXYZI PointType;
这些参数是根据雷达品牌来定的,比如这是16线、每线1800个点的数据:
// VLP-16
extern const int N_SCAN = 16;
extern const int Horizon_SCAN = 1800;
extern const float ang_res_x = 0.2;//水平上每条线间隔0.2°
extern const float ang_res_y = 2.0;//竖直方向上每条线间隔2°
extern const float ang_bottom = 15.0+0.1;//竖直方向上起始角度是负角度,与水平方向相差15.1°
extern const int groundScanInd = 7;//以多少个扫描圈来表示地面
在点云分割时的必要参数:
extern const float sensorMountAngle = 0.0;
extern const float segmentTheta = 1.0472;//点云分割时的角度跨度上限(π/3)
extern const int segmentValidPointNum = 5;//检查上下左右连续5个点做为分割的特征依据
extern const int segmentValidLineNum = 3;//检查上下左右连续3线做为分割的特征依据
extern const float segmentAlphaX = ang_res_x / 180.0 * M_PI;//转成弧度
extern const float segmentAlphaY = ang_res_y / 180.0 * M_PI;//转成弧度
而 PointTypePose指的是具备姿态角的特定点:
//增加新的PointT类型常规操作
struct PointXYZIRPYT定义点类型结构
{
PCL_ADD_POINT4D // 该点类型有4个元素
PCL_ADD_INTENSITY;
float roll;
float pitch;
float yaw;
double time;
EIGEN_MAKE_ALIGNED_OPERATOR_NEW// 确保new操作符对齐操作
} EIGEN_ALIGN16;// 强制SSE对齐pcl::PointCloud<PointType>::Ptr laserCloudIn;//雷达直接传出的点云
pcl::PointCloud<PointType>::Ptr fullCloud;//投影后的点云
pcl::PointCloud<PointType>::Ptr fullInfoCloud;//整体的点云 其中的intensity保存的是深度值
pcl::PointCloud<PointType>::Ptr groundCloud;//只包含地面点云
pcl::PointCloud<PointType>::Ptr segmentedCloud;//分割后的部分,含地面点云
pcl::PointCloud<PointType>::Ptr segmentedCloudPure;//分割后的部分的几何信息,不含地面点云
pcl::PointCloud<PointType>::Ptr outlierCloud;//在分割时出现的异常