当前位置:网站首页>3D激光slam:LeGO-LOAM---地面点提取方法及代码分析
3D激光slam:LeGO-LOAM---地面点提取方法及代码分析
2022-08-02 10:00:00 【华为云】
前言
地面点提取方法
LeGO-LOAM中前端改进中很重要的一点就是充分利用地面点,本片博客主要讲解 如何进行地面点提取
如下图所示,相邻的两个scan的同一列,打在地面上,形成两个点A和B。
它们的垂直高度差为h,这个值在理想情况(雷达水平安装,地面是水平的)接近于0
水平距离差d
和水平面的夹角为
如果为地面点,在理想情况下,这个角点接近0.
但是雷达的安装不会完全水平,并且地面也不是平的,因此这个角度会大于0,LeGO-LOAM设置的是10°。
即小于10°被判断为地面点
这种地面点的提取算法有些过于简单,还可以结合激光雷达安装高度,等其它信息进行判断。例如下面这种情况,也会被判断为地面点:
代码分析
LeGO-LOAM的地面提取的代码在 imageProjection.cpp 中 groundRemoval 函数
void groundRemoval(){ size_t lowerInd, upperInd; float diffX, diffY, diffZ, angle;lowerInd, upperInd 是相邻scan上点的索引值
diffX, diffY, diffZ, angle 是 dx dy dz 水平角
for (size_t j = 0; j < Horizon_SCAN; ++j){//遍历水平方向的点 360/0.2 1800个点 for (size_t i = 0; i < groundScanInd; ++i){//groundScanInd 为8 地面点不能在上面嵌套两个for循环, 列要在前面,因为要计算同一列的值
第一行,遍历水平方向的点 360/0.2 1800个点
第二行,groundScanInd 为8 地面点不能在上面
lowerInd = j + ( i )*Horizon_SCAN;//下面的点 upperInd = j + (i+1)*Horizon_SCAN;//上面的点计算的两个点的索引
Horizon_SCAN为1800,
if (fullCloud->points[lowerInd].intensity == -1 || fullCloud->points[upperInd].intensity == -1){ // no info to check, invalid points groundMat.at<int8_t>(i,j) = -1;//标志位 至-1 continue; } 判断两个点是否有效,点无效的话intensity为-1
有一个点无效的话 标志位 至-1
diffX = fullCloud->points[upperInd].x - fullCloud->points[lowerInd].x;//dx diffY = fullCloud->points[upperInd].y - fullCloud->points[lowerInd].y;//dy diffZ = fullCloud->points[upperInd].z - fullCloud->points[lowerInd].z;//dz angle = atan2(diffZ, sqrt(diffX*diffX + diffY*diffY) ) * 180 / M_PI;//计算水平角度计算 dx dy dz 和水平角,就是这个公式
if (abs(angle - sensorMountAngle) <= 10){ groundMat.at<int8_t>(i,j) = 1; groundMat.at<int8_t>(i+1,j) = 1; } } }sensorMountAngle 是 liadr 是和水平面的倾斜角
这里就是把那两个点的水平角,和10°做比较,判断是不是地面点
如何使把标志位 至 1
for (size_t i = 0; i < N_SCAN; ++i){ for (size_t j = 0; j < Horizon_SCAN; ++j){ if (groundMat.at<int8_t>(i,j) == 1 || rangeMat.at<float>(i,j) == FLT_MAX){ labelMat.at<int>(i,j) = -1;//labelMat 至为 -1 ,不参与后续线特征和面特征的提取 } } }判断完地面点后,再遍历每个点,
如过该点是 地面点或者无效点,则把 labelMat 上的该点标志位至-1 .
labelMat 至为 -1 ,不参与后续线特征和面特征的提取
//地面点可视化 if (pubGroundCloud.getNumSubscribers() != 0){//如果有节点要订阅这个地面点的topic 再进行发布 for (size_t i = 0; i <= groundScanInd; ++i){ for (size_t j = 0; j < Horizon_SCAN; ++j){ if (groundMat.at<int8_t>(i,j) == 1) groundCloud->push_back(fullCloud->points[j + i*Horizon_SCAN]);//把点加在 地面点点云中 之后会发布出去 } } } }最后进行地面点得可视化
如果有节点要订阅这个地面点的topic 再进行发布
遍历0-groundScanInd 上得每个点,判断如果是地面点,则添加该点到 groundCloud 中
之后会被发布出去
发布得在这个地方
// original dense ground cloud if (pubGroundCloud.getNumSubscribers() != 0){ pcl::toROSMsg(*groundCloud, laserCloudTemp); laserCloudTemp.header.stamp = cloudHeader.stamp; laserCloudTemp.header.frame_id = "base_link"; pubGroundCloud.publish(laserCloudTemp); }topic得名称是/ground_cloud
pubGroundCloud = nh.advertise<sensor_msgs::PointCloud2> ("/ground_cloud", 1);gazebo测试


效果还是挺好得,没有出现异常点
但是由于没有加入高度得判断,在前面里说得这种情况则会出现问题

边栏推荐
- 瑞吉外卖项目剩余功能补充
- The k-nearest neighbor method in the notes of Li Hang's "Statistical Learning Methods"
- Naive Bayesian Method of Li Hang's "Statistical Learning Methods" Notes
- 使用较广泛的安全测试工具有哪些?
- 软件测试之发现和解决bug
- The R language uses the rollapply function in the zoo package to apply the specified function to the time series in a rolling manner and the window moves, and set the align parameter to specify that t
- leetcode 62. Unique Paths(独特的路径)
- The perceptron perceptron of Li Hang's "Statistical Learning Methods" notes
- MySql tens of millions of paging optimization, fast insertion method of tens of millions of data
- 记某社区问答
猜你喜欢

iNFTnews | 看见元宇宙的两面,何谓全真互联网和价值互联网?

Linux system uninstall, install, upgrade, migrate clickHouse database

The realization of the list

MySql tens of millions of paging optimization, fast insertion method of tens of millions of data

List-based queuing and calling system

超赞!发现一个APP逆向神器!

Linux系统卸载,安装,升级,迁移clickHouse数据库

适配器模式适配出栈和队列及优先级队列

The perceptron perceptron of Li Hang's "Statistical Learning Methods" notes

npm ERR! 400 Bad Request - PUT xxx - Cannot publish over previously published version “1.0.0“.
随机推荐
Weak yen turns game consoles into "financial products" in Japan: scalpers make big profits
Shell脚本实现多选DNS同时批量解析域名IP地址(新更新)
R语言时间序列数据的平滑:使用KernSmooth包的dpill函数和locpoly函数对时间序列数据进行平滑以消除噪声
typeinfo类型支持库学习
QT专题:事件机制event基础篇
周鸿祎称微软抄袭 360 安全模式后发文否认;英特尔CEO基辛格回应市值被AMD超越:股价下跌是咎由自取|极客头条...
R语言ggpubr包的ggbarplot函数可视化分组柱状图、设置add参数为mean_se可视化不同水平均值的柱状图并为柱状图添加误差线(se标准误差)、position参数自定义分组柱状图分离
One Summer of Open Source | How to Quickly Integrate Log Modules in GO Language Framework
开源一夏 | GO语言框架中如何快速集成日志模块
零代码工具推荐---HiFlow
iNFTnews | Seeing the two sides of the metaverse, what is the true Internet and the Internet of value?
R语言ggplot2可视化:使用ggpubr包的ggbarplot函数可视化堆叠的柱状图(stacked bar plot)、lab.pos参数指定柱状图的数值标签的位置,lab.col参数指定数值标
Spearman's correlation coefficient
R语言ggpubr包的ggline函数可视化分组折线图、add参数为mean_se和dotplot可视化不同水平均值的折线图并为折线图添加误差线(se标准误差)和点阵图、自定义palette设置颜色
LeetCode第三题(Longest Substring Without Repeating Characters)三部曲之一:解题思路
The love-hate relationship between C language volatile keyword, inline assembly volatile and compiler
用汇编实现爱心特效【七夕来袭】
You Only Hypothesize Once: 用旋转等变描述子估计变换做点云配准(已开源)
R language ggplot2 visualization: use the ggtexttable function of the ggpubr package to visualize tabular data (directly draw tabular graphs or add tabular data to images), use tbody_add_border to add
适配器模式适配出栈和队列及优先级队列