3D-SLAM入门教程-多线雷达(RSlidar 16)loam_velodyne 3D建图
ROS与SLAM入门教程-多线雷达(RSlidar 16)loam_velodyne 3D建图
说明:
- 介绍如何使用多线雷达(RSlidar 16)结合loam_velodyne算法进行三维建图
- 测试环境:turbot-DL + 多线雷达RSlidar 16
loam_velodyne
loam_velodyne是Loam的velodyne雷达版本,Loam(Laser Odometry and Mapping)是使用3D激光雷达进行状态估计和建图的实时方法。 该程序包含两个并行运行的主线程。 “odometry”线程以更高的帧速率计算激光雷达在两次扫描之间的运动。 它还消除了激光雷达运动引起的点云失真。 “Mapping”线程采用未失真的点云并逐步构建地图,同时以较低的帧速率计算地图上激光雷达的姿势。 激光雷达状态估计是来自两个线程的输出的组合。
我们目前使用多线雷达,所以需要对loam_velodyne改善。
loam_velodyne准备
录制ros包,参考:https://www.ncnynl.com/archives/201810/2759.html
安装loam_velodyne
cd ~/rslidar_ws/src
git clone https://github.com/laboshinl/loam_velodyne.git
cd ..
catkin_make
- 进入launch目录
roscd loam_velodyne/launch/
- 增加loam_rslidar.launch
<launch>
<node pkg="tf" type="static_transform_publisher" name="rslidarlink_broadcaster" args="0.0 0.0 0.42 0.0 0.0 0.0 base_link laser 50"/>
<arg name="rviz" default="false" />
<arg name="scanPeriod" default="0.1" />
<arg name="lidartype" default="VLP-16" /> <!-- options: VLP-16 HDL-32 HDL-64E RS-32 RS-16-->
<node pkg="loam_velodyne" type="multiScanRegistration" name="multiScanRegistration" output="screen">
<param name="lidar" value="$(arg lidartype)" /> <!-- options: VLP-16 HDL-32 HDL-64E RS-32 RS-16 -->
<param name="scanPeriod" value="$(arg scanPeriod)" />
<remap from="/multi_scan_points" to="/rslidar_points" />
<remap from="/imu/data" to="/mobile_base/sensors/imu_data" />
</node>
<node pkg="loam_velodyne" type="laserOdometry" name="laserOdometry" output="screen" respawn="true">
<param name="scanPeriod" value="$(arg scanPeriod)" />
</node>
<node pkg="loam_velodyne" type="laserMapping" name="laserMapping" output="screen">
<param name="scanPeriod" value="$(arg scanPeriod)" />
<remap from="/imu/data" to="/mobile_base/sensors/imu_data" />
</node>
<node pkg="loam_velodyne" type="transformMaintenance" name="transformMaintenance" output="screen">
</node>
<group if="$(arg rviz)">
<node launch-prefix="nice" pkg="rviz" type="rviz" name="rviz" args="-d $(find loam_velodyne)/rviz_cfg/loam_velodyne.rviz" />
</group>
</launch>
根据实际情况,设置雷达的TF,我们放在turtlebot2的顶托盘中心。
使用雷达的3D点云和turtlebot2小车的IMU数据
新件rslidar_rviz.launch
<launch>
<node launch-prefix="nice" pkg="rviz" type="rviz" name="rviz" args="-d $(find loam_velodyne)/rviz_cfg/loam_velodyne.rviz" />
</launch>
loam_velodyne 离线建图
- 新终端,启动roscore
roscore
- 新终端,启动rslidar
roslaunch loam_velodyne loam_rslidar.launch
- 新终端,rosbag包回放
rosbag play 2018-10-16-17-45-53.bag
- 或者选择数据好的时间段
rosbag play -s 50 2018-10-16-17-45-53.bag
- 新终端,运行rviz
roslaunch loam_velodyne rslidar_rviz.launch
loam_velodyne 实时建图
- 新终端,启动底盘
roslaunch turtlebot_bringup minimal.launch
- 新终端,启动rslidar雷达
roslaunch rslidar_pointcloud rs_lidar_16.launch
- 新终端,启动键盘控制
roslaunch turtlebot_teleop keyboard_teleop.launch
- 新终端,启动loam_velodyne建图
roslaunch loam_velodyne loam_rslidar.launch
- 新终端,运行rviz
roslaunch loam_velodyne rslidar_rviz.launch
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号