SC-Lego-LOAM建图与ndt_localization的实车实现

使用Lego-LOAM和NDT进行机器人建图与定位:步骤与参数调整,

参考:https://blog.youkuaiyun.com/weixin_44303829/article/details/121524380
https://github.com/AbangLZU/SC-LeGO-LOAM.git
https://github.com/AbangLZU/ndt_localizer.git

将建图和定位分别使用lego-loam和ndt来进行,实车上的效果非常不错,所以在这里好好学习一下原理和代码:

使用sc-lego-loam建图

git clone https://github.com/AbangLZU/SC-LeGO-LOAM.git

以上是git链接,直接编译即可。

catkin_make

修改成自己的雷达和imu的接口:

将原本的这两行注释或者直接修改——utility.h文件

// extern const string pointCloudTopic = "/os1_points";
// extern const string imuTopic = "/imu/data";

修改为自己的雷达和IMU的Topic

extern const string pointCloudTopic = "/velodyne_points";
extern const string imuTopic = "/imu/data";

以及雷达的一些参数:

# 注释
// Ouster OS1-64
//extern const int N_SCAN = 64;
//extern const int Horizon_SCAN = 1024;
//extern const float ang_res_x = 360.0/float(Horizon_SCAN);
//extern const float ang_res_y = 33.2/float(N_SCAN-1);
//extern const float ang_bottom = 16.6+0.1;
//extern const int groundScanInd = 15;
       
# 添加
// VLP-16
extern const int N_SCAN = 16;
extern const int Horizon_SCAN = 1800;
extern const float ang_res_x = 0.2;
extern const float ang_res_y = 2.0;
extern const float ang_bottom = 15.0+0.1;
extern const int groundScanInd = 7;
       
# 对于64线的VLP雷达,添加:
extern const int N_SCAN = 64;
extern const int Horizon_SCAN = 2083;
extern const float ang_res_x = 360.0/float(Horizon_SCAN);
extern const float ang_res_y = 26.8/float(N_SCAN-1);
extern const float ang_bottom = 24.8;
extern const int groundScanInd = 55;

编译然后运行即可:

roslaunch lego-loam run.launch

#播放bag包

rosbag play --clock ***.bag

播放完后ctrl+c结束后就能在map文件夹中自动保存地图的pcd文件。

使用ndt定位

git clone https://github.com/AbangLZU/ndt_localizer.git

同样github上直接git,接下来修改相关的接口:
将之前生成的pcd文件复制到ndt_localizer文件下的map文件夹里,对launch文件进行修改:

map_loader.launch

ndt_localizer.launch

将urdf注释掉:

pointsdownsample.launch

将雷达话题改为/velodyne_points;leaf_size改为1.0(如果采用的是16线的激光雷达,那么降采样的 leaf_size 控制在1 - 2 m 较为合适,当采用的激光雷达为 32 线及以上 , 可以将 leaf size 设置为 2 - 3 m )

<!-- <arg name="points_topic" default="/apollo/sensor/velodyne32/PointCloud2/fusion" /> -->
<arg name="points_topic" default="/velodyne_points" />
<arg name="output_log" default="false" />
<arg name="leaf_size" default="1.0" />

然后编译后就能运行了:

roslaunch ndt_localizer ndt_localizer.launch

当然这里是需要提供初始位姿的:
再选择rviz里面的 2D Pose Estimate,选定车辆的初始姿态(一切使用预先构建的地图进行配准定位的方法都需要提供初始姿态,在工业界的实践中,这一初始姿态通常是通过 gnss 获得,本文中我们简化这一步,在 Rviz 中手动指定初始姿态, Rviz 中设定的初始姿态通常会被默认发送至 /initialpose topic 上)
所建的地图:(转为栅格地图)
请添加图片描述

### SC-LEGO-LOAM Evo GitHub Project Documentation SC-LeGO-LOAM 是由 KAIST 开源的一个激光雷达里程计和框架,它结合了 Scan Context 和 LeGO-LOAM 的优点[^3]。SC-LeGO-LOAM 主要用于处理 LiDAR 数据并实现高效的 SLAM 功能。而 SC-LeGO-LOAM Evo 则是对该框架的一种改进版本或者特定应用扩展。 以下是关于 SC-LeGO-LOAM Evo 可能涉及的内容及其相关文档说明: #### 1. **项目背景** SC-LeGO-LOAM Evo 很可能是基于原始 SC-LeGO-LOAM 进一步优化后的版本,可能针对某些硬件设备(如 Ouster 或 Velodyne 激光雷达)进行了适配,并增强了算法性能。其核心功能仍然围绕着 LOAM 家族的核心思想展开——通过特征提取、匹配以及姿态估计完成时定位[^2]。 #### 2. **安装指南** 对于 SC-LeGO-LOAM Evo 的安装过程,可以参考以下步骤: - 修改 `utility.h` 文件中的雷达参数以适应所使用的传感器型号。 - 如果需要运行际机器人上的系统,则可以在配置文件中调整 RVIZ 显示设置,例如注释掉不必要的可视化话题[^4]。 #### 3. **代码结构分析** 类似于其他 LOAM 类型的项目,SC-LeGO-LOAM Evo 的主要模块通常包括以下几个部分: - **Feature Extraction**: 提取边缘和平面点作为关键特征[^1]。 - **Pose Estimation**: 使用 ICP (Iterative Closest Point) 方法或其他优化技术来计算当前帧的姿态变化。 - **Global Map Management**: 构全局地并通过回环检测消除累计误差。 #### 4. **依赖项** 为了成功编译和部署 SC-LeGO-LOAM Evo,需确保满足以下依赖条件: - ROS (Robot Operating System): 推荐使用 Melodic 或 Noetic 版本。 - PCL (Point Cloud Library): 处理三维点云数据的关键库。 - Eigen: 数学运算支持。 如果遇到任何依赖缺失的情况,请按照官方文档指示逐一解决。 #### 5. **测试环境搭** 议在 Ubuntu 虚拟机或真物理机器上创独立的工作空间来进行调试。具体操作如下所示: ```bash mkdir -p ~/sc_lego_loam_ws/src && cd ~/sc_lego_loam_ws/src git clone https://github.com/YourRepoNameHere/sc-lego-loam-evo.git . cd .. catkin_make source devel/setup.bash roslaunch sc_lego_loam system_real_robot.launch ``` 上述命令假设您已经克隆了正确的仓库地址;请替换为际项目的 URL。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

白云千载尽

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值