激光SLAM7-基于已知位姿的构图算法

该博客介绍了激光SLAM中如何利用已知位姿信息构建栅格地图,包括覆盖栅格和计数建图两种算法。在覆盖栅格建图部分,详细讲解了理论、代码实现和结果展示;而在计数建图中同样涵盖了理论、代码和结果分析。此外,还提及了TSDF建图的理论基础。
摘要由CSDN通过智能技术生成

1. 通过覆盖栅格建图算法进行栅格地图的构建

1.1 Theory

算法流程
判断是否为free

1.2 code

这里没有判断idx和hitPtIndex是否有效:

//start of TODO 对对应的map的cell信息进行更新.(1,2,3题内容)
GridIndex hitPtIndex = ConvertWorld2GridIndex(world_x, world_y);
std::vector<GridIndex> freeIndexs = TraceLine(robotIndex.x, robotIndex.y, hitPtIndex.x, hitPtIndex.y);
for (const auto& idx : freeIndexs) {
   
    const auto& linIdx = GridIndexToLinearIndex(idx);
    if (pMap[linIdx] == 0) {
   
        continue;
    }

    pMap[linIdx] += mapParams.log_free;
}

const auto& linIdx = GridIndexToLinearIndex(hitPtIndex);
pMap[linIdx] += mapParams.log_occ;
if (pMap[linIdx] > mapParams.log_max) {
   
    pMap[linIdx] = mapParams.log_max;
}
//end of TODO

1.3 result

栅格地图

2. 通过计数建图算法进行栅格地图的构建

2.1 Theory

在这里插入图片描述
在这里插入图片描述

2.2 Code

//start of TODO 对对应的map的cell信息进行更新.(1,2,3题内容)
GridIndex hitPtIndex = ConvertWorld2GridIndex(world_x, world_y);
std::vector<GridIndex> freeIndexs = TraceLine(robotIndex.x, robotIndex.y, hitPtIndex.x, hitPtIndex.y);
for (const auto& idx : freeIndexs) {
   
    if (!isValidGridIndex(idx)) {
   
        continue;
    }
    const auto& linIdx = GridIndexToLinearIndex(idx);
    pMapMisses[linIdx] += 1;
}

if (isValidGridIndex(hitPtIndex)) {
   
    const auto& linIdx = GridIndexToLinearIndex(hitPtIndex);
    pMapHits[linIdx] += 1;
}
//end of TODO
//start of TODO 通过计数建图算法或TSDF算法对栅格进行更新(2,3题内容)
for (uint32_t i = 0; i < mapParams.width * mapParams.height; ++i) {
   
    int visNum = pMapHits[i] + pMapMisses[i];
    if (visNum > 0) {
   
        pMap[i] = pMapHits[i] * 100 / (pMapHits[i] + pMapMisses[i]); 
    }
}
//end of TODO

2.3 Result

Result

3. TSDF建图算法

3.1 Theory

在这里插入图片描述
在这里插入图片描述

Ref

  1. 激光SLAM理论与实践(七)–基于已知定位的建图 ( 有课件)
  2. 激光SLAM理论与实践 - 第六期 第7章 基于已知定位的建图 作业与心得 (作业细节分析的不错)
  3. code
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值