制作一个送咖啡机器人 -- ORB SLAM2

几个月前在计算所用rplidar做过一个送咖啡机器人。可是运用到室外场景Lidar成本太高,于是转战视觉SLAM。
花了几天时间用gazebo仿真,跑通了ORB SLAM2框架。


解决闭环(上面那个gif图):

Localization mode(拖拽机器人到新位置,ORB SLAM可以实现定位):

完整SLAM过程:


0x01 Quick Start

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 安装 ROS
sudo sh -c 'echo "deb https://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
sudo apt-get update
sudo apt-get install ros-kinetic-desktop-full
sudo rosdep init
rosdep update
# 创建ROS工作空间
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/
catkin_make
# 安装turtlebot
sudo apt-get install ros-kinetic-turtlebot-*
# 使用ROS工作空间
source ~/catkin_ws/devel/setup.bash

0x02 运行demo

  • 仿真(gazebo) roslaunch turtlebot_gazebo turtlebot_world.launch
  • 遥控 roslaunch turtlebot_teleop keyboard_teleop.launch
  • 查看摄像头 rosrun image_view image_view image:=/camera/rgb/image_raw
  • ORB_SLAM rosrun ORB_SLAM2 Mono /home/s1nh/Project/ORB_SLAM2/Vocabulary/ORBvoc.txt /home/s1nh/Workspace/turtlebot/cam_orb_slam.yaml

0x03 相机相关

  • 标定 rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.108 image:=/camera/image_raw camera:=/camera
  • 相机位置 /opt/ros/kinetic/share/turtlebot_description/urdf/turtlebot_properties.urdf.xacro
  • 相机 fov /opt/ros/kinetic/share/turtlebot_description/urdf/turtlebot_gazebo.urdf.xacro

参考教程:

http://wiki.ros.org/cn/ROS/Tutorials
https://www.ncnynl.com/archives/201609/799.html