1.引言
通过前面几章,我们在Gazebo下搭建好和仿真环境和机器人模型,这章我们将来实现Gazebo下的机器人gmapping的建图仿真。本文采用的方案是通过将RGB-D相机采集到的深度图像转换为激光雷达数据,然后采用gmapping算法实现建图。(若采用的是激光雷达传感器则直接通过gmapping算法实现建图)
2.准备工作
(1)安装depthimage_to_laserscan功能包,主要功能是将深度图像转化为激光雷达数据。
(2)安装gmapping功能包。
3.建图仿真
在launch文件夹中创建gmapping.launch:
<?xml version="1.0"?>
<launch>
<include file="$(find smartcar)/launch/gazebo.launch">
</include>
<param name="use_sim_time" value="true" />
<!-- Run the depthimage_to_laserscan node -->
<node pkg="depthimage_to_laserscan" type="depthimage_to_laserscan" name="d