当前位置: 移动技术网 > 科技>操作系统>Linux > Velodyne VLP-16 gmapping 建图

Velodyne VLP-16 gmapping 建图

2018年12月06日  | 移动技术网科技  | 我要评论

1. 测试环境

ubuntu 16.04 x64、ros kinetic、velodyne vlp-16、roboware studio

2. 安装 ros 功能包

sudo apt-get install ros-kinetic-velodyne       
sudo apt-get install ros-kinetic-gmapping           
sudo apt-get install ros-kinetic-laser-scan-matcher     

3. 连接激光雷达

网线直连本机与激光雷达,已知 velodyne vlp-16 的 ip 地址为 192.168.1.201,配置本机地址为 192.168.1.77,打开浏览器输入 192.168.1.201 查看激光雷达的配置文件,确保其 host (destination) 的 ip 地址与本机相同。

4. 创建 ros 工程

打开 roboware studio,新建工作区 catkin_ws,然后在终端执行:

cd catkin_ws/src
git clone https://github.com/ros-drivers/velodyne.git

接下来采用 catkin_make 构建整个项目,最后在 .bashrc 文件末尾添加:

source /current_path/catkin_ws/devel/setup.bash

其中,current_path 根据自身工作目录而定

5. 把 velodyne vlp-16.xml 转换成 vlp-16.yaml 文件

rosrun velodyne_pointcloud gen_calibration.py /current_path/vlp-16.xml  

6. 创建地图

(1) 在 ubuntu 系统中打开一个终端,输入以下命令运行 ros 节点管理器:

roscore

(2) 在 ubuntu 系统中打开一个终端,运行 vlp16_points.launch:

roslaunch velodyne_pointcloud vlp16_points.launch calibration:=/current_path/vlp-16.yaml

(3) 在 ubuntu 系统中打开一个终端,输入以下命令发布 tf 变换 base_link->velodyne:

rosrun tf static_transform_publisher 0 0 0 0 0 0 base_link velodyne 0

(4) 在 ubuntu 系统中打开一个终端,启动 slam_gmapping:

rosrun gmapping slam_gmapping

(5) 在 ubuntu 系统中打开一个终端,启动 laser_scan_matcher_node,并指定 fixed_frame 为 odom:

rosrun laser_scan_matcher laser_scan_matcher_node _fixed_frame:=odom

上述过程中,gmapping 提供 map->odom 之间的 tf 变换,laser_scan_matcher 提供 odom->base_link 之间的 tf 变换,static_transform_publisher 提供 base_link->velodyne 之间的 tf 变换。

7. 实时显示地图创建过程

在 ubuntu 系统中打开一个终端,执行命令:

rosrun rviz rviz

然后在 rviz 中点击 add -> by topic,添加 map、laserscan 或 pointcloud2 等,实时显示获取到的结果。

本文链接:,转载请注明出处。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网