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 等,实时显示获取到的结果。

本文链接:https://www.cnblogs.com/lightweh/p/10076294.html,转载请注明出处。

内容来源于网络如有侵权请私信删除
你还没有登录,请先登录注册
  • 还没有人评论,欢迎说说您的想法!