< >
Home » walking机器人入门教程#视频版 » walking机器人入门教程-gmapping算法建图

walking机器人入门教程-gmapping算法建图

walking机器人入门教程-gmapping算法建图

说明:

  • 介绍如何进行gmapping算法建图

相关设备

步骤:

  • 启动底盘
ros2 launch walking_bringup robot.launch.py 
  • 启动gmapping(针对雷达S1的启动方法)
#先启动雷达S1
ros2 launch walking_bringup laser.launch.py 
#再另开终端启动建图      
ros2 launch walking_slam slam_toolbox.launch.py use_laser:=false
  • 启动gmapping(针对其他雷达的启动方法)
ros2 launch walking_slam gmapping.launch.py 
  • 效果图:

请输入图片描述

  • 启动键盘控制,移动小车继续建图
ros2 launch walking_teleop keyboard.launch.py  
  • 效果图:
    请输入图片描述
  • 新开终端,保存地图:
ros2 run nav2_map_server map_saver_cli -f ~/map/gmapping --ros-args -p save_map_timeout:=10000.00
或
ros2 launch walking_slam save_map.launch.py  map:=${HOME}/map/gmapping
  • 执行效果
$ ros2 launch walking_slam save_map.launch.py  map:=${HOME}/map/gmapping
[INFO] [launch]: All log files can be found below /home/ubuntu/.ros/log/2022-01-19-17-06-54-171664-WALKING-97663
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [map_saver_cli-1]: process started with pid [97665]
[map_saver_cli-1] [INFO] [1642583214.601260398] [map_saver]: 
[map_saver_cli-1]   map_saver lifecycle node launched. 
[map_saver_cli-1]   Waiting on external lifecycle transitions to activate
[map_saver_cli-1]   See https://design.ros2.org/articles/node_lifecycle.html for more information.
[map_saver_cli-1] [INFO] [1642583214.601445499] [map_saver]: Creating
[map_saver_cli-1] [INFO] [1642583214.602590778] [map_saver]: Saving map from 'map' topic to '/home/ubuntu/map/gmapping' file
[map_saver_cli-1] [WARN] [1642583214.602645143] [map_saver]: Free threshold unspecified. Setting it to default value: 0.250000
[map_saver_cli-1] [WARN] [1642583214.602670448] [map_saver]: Occupied threshold unspecified. Setting it to default value: 0.650000
[map_saver_cli-1] [WARN] [map_io]: Image format unspecified. Setting it to: pgm
[map_saver_cli-1] [INFO] [map_io]: Received a 384 X 384 map @ 0.05 m/pix
[map_saver_cli-1] [INFO] [map_io]: Writing map occupancy data to /home/ubuntu/map/gmapping.pgm
[map_saver_cli-1] [INFO] [map_io]: Writing map metadata to /home/ubuntu/map/gmapping.yaml
[map_saver_cli-1] [INFO] [map_io]: Map saved
[map_saver_cli-1] [INFO] [1642583214.755152615] [map_saver]: Map saved successfully
[map_saver_cli-1] [INFO] [1642583214.755299597] [map_saver]: Destroying
[INFO] [map_saver_cli-1]: process has finished cleanly [pid 97665]
  • 保存在用户根目录的map目录下/home/ubuntu/map/,名称为map。实际保存文件为gmapping.pgm和gmapping.yaml
  • 新开终端,打开保存的地图:
eog ~/map/gmapping.pgm
  • 效果图:
    请输入图片描述

演示视频

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

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


标签: walking机器人入门程