当前位置:网站首页>3 d laser slam: LeGO - LOAM - ground point extracting method and the analysis of the code
3 d laser slam: LeGO - LOAM - ground point extracting method and the analysis of the code
2022-08-02 10:12:00 【HUAWEI CLOUD】
前言
Ground point extraction method
LeGO-LOAMA very important point in the improvement of the mid-front end is to make full use of the ground points,This blog post mainly explains How to do ground point extraction
如下图所示,相邻的两个scan的同一列,hit the ground,form two pointsA和B.
Their vertical height difference is h,This value is ideal(The radar is installed horizontally,The ground is level)接近于0
Poor horizontal distanced
The angle with the horizontal plane is
If it is a ground point,在理想情况下,This corner is close0.
But the radar installation will not be completely horizontal,And the ground is not flat,So this angle will be greater than 0,LeGO-LOAM设置的是10°.
即小于10°is judged to be a ground point
The extraction algorithm of this ground point is a bit too simplistic,It can also be combined with the lidar installation height,Wait for other information to judge.例如下面这种情况,are also judged as ground points:
代码分析
LeGO-LOAMThe code for the ground extraction is in imageProjection.cpp 中 groundRemoval 函数
void groundRemoval(){ size_t lowerInd, upperInd; float diffX, diffY, diffZ, angle;
lowerInd, upperInd 是相邻scanThe index value of the upper point
diffX, diffY, diffZ, angle 是 dx dy dz 水平角
for (size_t j = 0; j < Horizon_SCAN; ++j){//Traverse the points in the horizontal direction 360/0.2 1800个点 for (size_t i = 0; i < groundScanInd; ++i){//groundScanInd 为8 The ground point cannot be on it
嵌套两个for循环, Column to be first,Because you want to calculate the value of the same column
第一行,Traverse the points in the horizontal direction 360/0.2 1800个点
第二行,groundScanInd 为8 The ground point cannot be on it
lowerInd = j + ( i )*Horizon_SCAN;//下面的点 upperInd = j + (i+1)*Horizon_SCAN;//上面的点
Calculate the indices of the two points
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; }
Determine whether two points are valid,Point is invalidintensity为-1
There is one point that is invalid 标志位 至-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 and horizontal angle,就是这个公式
if (abs(angle - sensorMountAngle) <= 10){ groundMat.at<int8_t>(i,j) = 1; groundMat.at<int8_t>(i+1,j) = 1; } } }
sensorMountAngle 是 liadr is the inclination angle from the horizontal plane
Here is the horizontal angle of those two points,和10°做比较,Determine whether it is a ground point
How to make put flag bit 至 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 ,Does not participate in the extraction of subsequent line features and surface features } } }
After judging the ground point,Iterate over each point again,
If past that point is Ground point or invalid point,则把 labelMat The point flag on the -1 .
labelMat 至为 -1 ,Does not participate in the extraction of subsequent line features and surface features
//Ground point visualization if (pubGroundCloud.getNumSubscribers() != 0){//If there is a node to subscribe to this ground pointtopic 再进行发布 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]);//add point to Ground point cloud It will be published later } } } }
Finally, visualize the ground points
If there is a node to subscribe to this ground pointtopic 再进行发布
遍历0-groundScanInd Get every point,Determine if it is a ground point,then add that point to groundCloud 中
It will be published later
Post it here
// 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); }
topicGot the name is/ground_cloud
pubGroundCloud = nh.advertise<sensor_msgs::PointCloud2> ("/ground_cloud", 1);
gazebo测试
The effect is still pretty good,No outliers occurred
But because there is no height to be judged,As mentioned above, there will be a problem in this case
边栏推荐
- 读博一年后对机器学习工程的思考
- 使用较广泛的安全测试工具有哪些?
- The heavyweights are coming!Spoilers for the highlights of the Alibaba Cloud Life Science and Intelligent Computing Summit
- You Only Hypothesize Once: 用旋转等变描述子估计变换做点云配准(已开源)
- yolov7创新点
- Verilog's random number system task----$random
- js防抖函数和函数节流的应用场景
- DirectX修复工具增强版「建议收藏」
- R语言使用ggpubr包的ggtexttable函数可视化表格数据(直接绘制表格图或者在图像中添加表格数据)、设置theme主题参数自定义表格中表头内容的填充色(使用colnames.style参数)
- HikariCP database connection pool, too fast!
猜你喜欢
后管实现面包屑功能
Use the scrapy to climb to save data to mysql to prevent repetition
List-based queuing and calling system
Getting Started with SCM from Scratch (1): Summary of Background Knowledge
QT专题:事件机制event基础篇
为什么要使用BGP?
软件测试H模型
Long battery life or safer?Seal and dark blue SL03 comparison shopping guide
MSYS2 QtCreator Clangd 代码分析找不到 mm_malloc.h的问题补救
【新版干货书】深度伪造 (DeepFakes):创造,检测和影响
随机推荐
重磅大咖来袭!阿里云生命科学与智能计算峰会精彩内容剧透
8月份的.NET Conf 活动 专注于 .NET MAUI
每日一题练习1-15
LayaBox---TypeScript---迭代器和生成器
win10打印服务无法启动(运行时错误automation)
LayaBox---TypeScript---装饰器
Smoothing of time series data in R language: smoothing time series data to remove noise using the dpill function and locpoly function of the KernSmooth package
iNFTnews | Seeing the two sides of the metaverse, what is the true Internet and the Internet of value?
软件测试的基本理论知识(软件测试面试基础知识)
The 17th day of the special assault version of the sword offer
sqlmap安装教程用w+r打开(sqlyog安装步骤)
The ggbarplot function of the R language ggpubr package visualizes the grouped histogram, sets the add parameter to mean_se to visualize the histogram of the mean values of different levels and adds
LayaBox - TypeScript - merge statement
The ggline function of the R language ggpubr package visualizes grouped line graphs, the add parameter is mean_se and dotplot to visualize line graphs of different level averages, and adds error bars
LayaBox---TypeScript---高级类型
STL中list实现
R语言使用zoo包中的rollapply函数以滚动的方式、窗口移动的方式将指定函数应用于时间序列、设置align参数指定结果数据中的时间标签取自窗口中的位置(参数right指定取自窗口的最右侧)
LayaBox---TypeScript---模块解析
R语言ggpubr包的ggline函数可视化分组折线图、add参数为mean_se和dotplot可视化不同水平均值的折线图并为折线图添加误差线(se标准误差)和点阵图、自定义palette设置颜色
零代码工具推荐---HiFlow