< >
Home » Ailibot仿真机器人入门教程 » Ailibot仿真入门教程-建图-cartographer 自定位

Ailibot仿真入门教程-建图-cartographer 自定位

文章说明

  • 介绍如何在在gazebo仿真环境下使用Ailibot进行cartographer pure localization 自定位

操作步骤

cartographer建图
  • 启动gazebo且加载模型
$ roslaunch ailibot_gazebo test_world.launch
  • 运行cartographer建图程序
$ roslaunch ailibot_slam cartographer.launch
  • 启动Rviz
$ roslaunch ailibot_rviz view_slam_cartographer.launch
  • 启动键盘控制
$ roslaunch ailibot_teleop keyboard.launch
  • 移动小车进行建图

  • 保存为pbstream格式的地图

$ rosservice call /finish_trajectory 0
//若根目录下没有map文件夹,则需要重新创建map文件夹
$ mkdir ~/map && cd ~/map 
$ rosservice call /write_state "{filename: '${HOME}/map/cartographer-localization.pbstream'}"
cartographer pure localization 自定位
  • 保存完地图后中止以上所有命令,再重启启动gazebo且加载模型
$ roslaunch ailibot_gazebo test_world.launch
  • 运行cartographer_localization程序
$ roslaunch ailibot_slam cartographer_localization.launch load_state_filename:=${HOME}/map/cartographer-localization.pbstream
  • 启动Rviz
$ roslaunch ailibot_rviz view_slam_cartographer.launch
  • 启动键盘控制
$ roslaunch ailibot_teleop keyboard.launch
  • 可以尝试将小车搬离到其他地方,再移动一下小车,可以发现小车的位置已匹配到地图上的相应位置

演示视频

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

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


标签: none