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

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

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

说明:

  • 介绍如何通过多线雷达来实现karto算法建图
  • 测试平台: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

  • 安装karto:

sudo apt-get install ros-kinetic-slam-karto
  • 新建turtlebot_karto_2d.launch
roscd roscd pointcloud_to_laserscan/luanch
vim turtlebot_karto_2d.launch 
  • 内容如下:
<launch>
  <node pkg="slam_karto" type="slam_karto" name="slam_karto" output="screen">
    <remap from="scan" to="scan"/>
    <param name="base_frame" value="base_footprint"/>
    <param name="odom_frame" value="odom"/>
    <param name="map_update_interval" value="25"/>
    <param name="resolution" value="0.025"/>
  </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 turtlebot_bringup minimal.launch
  • 主机,新终端,启动雷达
roslaunch rslidar_pointcloud rs_lidar_16.launch
  • 主机,新终端,启动点云转换
roslaunch pointcloud_to_laserscan turtlebot_rslidar.launch 
  • 主机,新终端,启动建图:
roslaunch pointcloud_to_laserscan turtlebot_karto_2d.launch 
  • 从机,新终端,启动键盘:
roslaunch turtlebot_teleop keyboard_teleop.launch 
  • 从机,新终端,打开rviz
roslaunch turtlebot_rviz_launchers view_navigation.launch
  • 效果如下:

请输入图片描述

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

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


标签: ros与slam入门教程