< >
Home » ROS与SLAM入门教程 » ROS与SLAM入门教程-多线激光雷达(rs-lidar-16)hector构建地图

ROS与SLAM入门教程-多线激光雷达(rs-lidar-16)hector构建地图

ROS与SLAM入门教程-多线激光雷达(rs-lidar-16)hector构建地图

说明:

  • 介绍如何通过多线雷达来实现hector算法建图
  • 测试平台:turbot-DL + 多线雷达rslidar-16

准备:

  • 设置rs-lidar-16雷达,请参考:https://www.ncnynl.com/archives/201807/2552.html

  • 配置激光雷达3D点云数据转换为2D激光数据,参考:https://www.ncnynl.com/archives/201807/2554.html

  • 安装hector:

sudo apt-get install ros-kinetic-hector-slam 
  • 新建turtlebot_hector_2d.launch
roscd roscd pointcloud_to_laserscan/luanch
vim turtlebot_hector_2d.launch 
  • 内容如下:
<launch>

<node pkg="hector_mapping" type="hector_mapping" name="hector_mapping" output="screen">
<!-- Frame names -->
<param name="pub_map_odom_transform" value="true"/>
<param name="map_frame" value="map" />

<param name="scan_topic"  value="scan" />
<param name="base_frame" value="base_footprint" />
<param name="odom_frame" value="odom" />

<!-- Tf use -->
<param name="use_tf_scan_transformation" value="true"/>
<param name="use_tf_pose_start_estimate" value="false"/>

<!-- Map size / start point -->
<param name="map_resolution" value="0.05"/>
<param name="map_size" value="800"/>
<param name="map_start_x" value="0.5"/>
<param name="map_start_y" value="0.5" />
<param name="laser_z_min_value" value = "-1.0" />
<param name="laser_z_max_value" value = "1.0" />
<param name="map_multi_res_levels" value="2" />

<param name="map_pub_period" value="2" />
<param name="laser_min_dist" value="0.15" />
<param name="laser_max_dist" value="5.8" />
<param name="output_timing" value="false" />
<param name="pub_map_scanmatch_transform" value="true" />
<!--<param name="tf_map_scanmatch_transform_frame_name" value="scanmatcher_frame" />-->

<!-- Map update parameters -->
<param name="update_factor_free" value="0.4"/>
<param name="update_factor_occupied" value="0.7" />
<param name="map_update_distance_thresh" value="0.2"/>
<param name="map_update_angle_thresh" value="0.06" />

<!-- Advertising config -->
<param name="advertise_map_service" value="true"/>
<param name="scan_subscriber_queue_size" value="5"/>
</node>


</launch>
  • 新建turtlebot_rslidar.launch
roscd pointcloud_to_laserscan/luanch
vim turtlebot_rslidar.launch 
  • 内容如下:
<?xml version="1.0"?>
<launch>

    <!-- run pointcloud_to_laserscan node -->
    <node pkg="pointcloud_to_laserscan" type="pointcloud_to_laserscan_node" name="pointcloud_to_laserscan">

        <remap from="cloud_in" to="/rslidar_points"/>
        <remap from="scan" to="/scan"/>
        <rosparam>
            # target_frame: rslidar # Leave disabled to output scan in pointcloud frame
            transform_tolerance: 0.01
            min_height: -0.4
            max_height: 1.0

            angle_min: -3.1415926 # -M_PI
            angle_max: 3.1415926 # M_PI
            angle_increment: 0.003 # 0.17degree
            scan_time: 0.1
            range_min: 0.2
            range_max: 100
            use_inf: true
            inf_epsilon: 1.0

            # Concurrency level, affects number of pointclouds queued for processing and number of threads used
            # 0 : Detect number of cores
            # 1 : Single threaded
            # 2->inf : Parallelism level
            concurrency_level: 1
        </rosparam>

    </node>
    <node pkg="tf" type="static_transform_publisher" name="base_to_laser" args="0.0 0.0 0.18 0 0.0 0.0 base_link laser 100"/>    
</launch>

测试:

  • 主机,新终端,启动雷达
roslaunch rslidar_pointcloud rs_lidar_16.launch
  • 主机,新终端,启动点云转换
roslaunch pointcloud_to_laserscan turtlebot_rslidar.launch 
  • 主机,新终端,启动建图:
roslaunch pointcloud_to_laserscan turtlebot_hector_2d.launch 
  • 从机,新终端,启动键盘:
roslaunch turtlebot_teleop keyboard_teleop.launch 
  • 从机,新终端,打开rviz
roslaunch turtlebot_rviz_launchers view_navigation.launch
  • 效果如下:

请输入图片描述

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: ros与slam入门教程