walking机器人入门教程-cartographer算法建图
walking机器人入门教程-cartographer算法建图
说明:
- 介绍如何进行cartographer算法建图
相关设备
- walking机器人套件:采购地址
步骤:
- 启动底盘
ros2 launch walking_bringup robot.launch.py
- 启动cartographer(针对雷达S1的启动方法)
#先启动雷达S1
ros2 launch walking_bringup laser.launch.py
#再另开终端启动建图
ros2 launch walking_slam cartographer.launch.py use_laser:=false
- 启动cartographer(针对其他雷达的启动方法)
ros2 launch walking_slam cartographer.launch.py
效果图:
启动键盘控制,移动小车继续建图
ros2 launch walking_teleop keyboard.launch.py
- 完成的效果图:
- 新开终端,保存地图:
ros2 run nav2_map_server map_saver_cli -f ~/map/cartographer --ros-args -p save_map_timeout:=10000.00
或
ros2 launch walking_slam save_map.launch.py map:=${HOME}/map/cartographer
- 执行结果
$ ros2 launch walking_slam save_map.launch.py map:=${HOME}/map/cartographer
[INFO] [launch]: All log files can be found below /home/ubuntu/.ros/log/2022-01-19-17-00-56-917469-WALKING-96371
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [map_saver_cli-1]: process started with pid [96374]
[map_saver_cli-1] [INFO] [1642582857.357923726] [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] [1642582857.358343128] [map_saver]: Creating
[map_saver_cli-1] [INFO] [1642582857.360160078] [map_saver]: Saving map from 'map' topic to '/home/ubuntu/map/cartographer' file
[map_saver_cli-1] [WARN] [1642582857.360218103] [map_saver]: Free threshold unspecified. Setting it to default value: 0.250000
[map_saver_cli-1] [WARN] [1642582857.360238783] [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 253 X 227 map @ 0.05 m/pix
[map_saver_cli-1] [INFO] [map_io]: Writing map occupancy data to /home/ubuntu/map/cartographer.pgm
[map_saver_cli-1] [INFO] [map_io]: Writing map metadata to /home/ubuntu/map/cartographer.yaml
[map_saver_cli-1] [INFO] [map_io]: Map saved
[map_saver_cli-1] [INFO] [1642582857.461209460] [map_saver]: Map saved successfully
[map_saver_cli-1] [INFO] [1642582857.461347405] [map_saver]: Destroying
[INFO] [map_saver_cli-1]: process has finished cleanly [pid 96374]
- 保存在用户根目录的map目录下/home/ubuntu/map/,名称为map。实际保存文件为cartographer .pgm和cartographer .yaml
- 新开终端,打开保存的地图:
eog ~/map/cartographer.pgm
- 效果图:
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号