测评活动分享

在点云PCL公众号相机测评活动的支持下,首先拿到了小觅相机,所以这篇文章将对小觅MYNTEYE-S1030-IR在ORB-SLAM2和RTAB-Map两种SLAM方案下的效果进行测评,为了增强对比效果会和我自制双目摄像头进行对比。同时这还是一篇干货满满的技术文章,我会写下详细的实验环境搭建步骤,相信你会学到很多东西!下面开始快乐的学习旅程吧!

首先介绍一下这次我们的测评相机:MYNTEYE-S1030-IR标准版

实物拍摄

MYNTEYE-S1030 IMU 坐标系统为右手系,坐标轴方向如下:

作者自制的双目是两个普通的广角摄像头,然后固定在一起,并标定参数,实物如图:

ORB_SLAM2

ORB_SLAM2(Oriented FAST and Rotated BRIEF Simultaneous Localization and Mapping)是一套基于单目、双目以及RGB-D的完整方案,可以实现地图重建、回环检测以及重新定位的功能。后端主要采用BA优化方法,内部包含了一个轻量级的定位模型,实现利用VO 追踪未建图区域和与地图点匹配实现零漂移定位。

RTAB-Map

RTAB-Ma(Real-Time Appearance-Based Mapping )用于外观的实时建图,是一个通过内存管理方法实现回环检测的开源库。从限制地图的大小以使得回环检测始终在固定的时间限制内处理,从而满足长期和大规模环境在线建图要求。

实验部分

作者做了两组对比实验,分别是:在MYNTEYE-S1030-IR和自制的Stereo上跑ORB-SLAM2。在MYNTEYE-S1030-IR和自制的Stereo上跑RTAB-Map。

ORB-SLAM实验环境

操作系统是:Ubuntu 16.04

ROS版本是:kinetic

下面开始第一组的第一个实验:在MYNTEYE-S1030-IR上跑ORB-SLAM2

开始安装MYNT-EYE-S-SDK

  • mkdir -p ~/ROS_WORKSPACE/mynt_eye_sdk/src
  • cd ROS_WORKSPACE/mynt_eye_sdk/src
  • git clone https://github.com/slightech/MYNT-EYE-S-SDK.git
  • cd MYNT-EYE-S-SDK
  • make ros
  • catkin_make
  • echo "source ~/projects/MYNT-EYE-S-SDK-ros-ws/devel/setup.bash" >> ~/.bashrc
  • source ~/.bashrc

测试一下是否安装成功

$ roslaunch mynt_eye_ros_wrapper mynteye.launch

查看一下摄像头参数,这里保存一下,后面会用到哦!

这是右面摄像头输出图片的参数:

$ rostopic echo /camera/left/camera_info

这是右面摄像头输出图片的参数:

$ rostopic echo /camera/right/camera_info

开始安装MYNT-EYE-ORB-SLAM2

  • sudo apt-get install cmake
  • sudo apt-get install git
  • sudo apt-get install libgoogle-glog-dev
  • 安装Pangolin、OPENCV、EIGEN3、
  • githttps://github.com/slightech/MYNT-EYE-ORB-SLAM2-Sample.git
  • exportROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:~/projects/MYNT-EYE-ORB-SLAM2-Sample
  • chmod +x build.sh
  • ./build.sh
  • chmod +x build_ros.sh
  • ./build_ros.sh

在/config/mynteye_stereo.yaml文件中更新相机参数,就是上面输出的那些参数啦!

好了到了激动人心的时刻了,下面就来测试一下MYNTEYE-S1030-IR 跑ORB-SLAM2的效果吧!

启动相机

$roslaunchmynt_eye_ros_wrapper mynteye.launch

启动ORB_SLAM2

$ rosrunORB_SLAM2mynteye_s_stereo ~/MYNT-EYE-ORB-SLAM2-Sample/Vocabulary/ORBvoc.txt ~/MYNT-EYE-ORB-SLAM2-Sample/config/mynteye_s_stereo.yaml false /camera/left_rect/image_rect /camera/right_rect/image_rect

运行结果视频:

总结:MYNTEYE-S1030-IR发布的图片不是彩色的,点云不是很稠密,但是距离比较准确,点云图很漂亮,可以看到ORB_SLAM2的回环检测确实很强大。

自制的双目

首先自己的相机不需要安装驱动了,但是需要标定,获取内外参,还要安装ORB_SLAM2。

标定步骤如下

先安装依赖:

  • sudo apt-get install libglew-dev
  • sudo apt-get install git
  • sudo apt-get install cmake
  • sudo apt-get install libblas-dev liblapack-dev
  • sudo apt-get install libboost-dev libboost-thread-dev libboost-filesystem-dev
  • sudo apt-get install libpython2.7-dev
  • sudo apt-get install build-essential
  • sudo apt-get install cmake git libgtk2.0-dev pkg-configlibavcodec-dev libavformat-dev libswscale-dev
  • sudoapt-getinstalllibsqlite3-devlibpcl-dev libopencv-dev libproj-dev libqt5svg5-dev
  • 再安装 Pangolin:
  • gitclonehttps://github.com/stevenlovegrove/Pangolin.git
  • cd Pangolin
  • mkdir build
  • cd build
  • cmake -DCPP11_NO_BOOST=1 …
  • make -j8

安装Eigen3

sudo apt-get install libeigen3-dev

安装OpenCV

先安装opencv的依赖

  • sudo apt-get install cmake git libgtk2.0-dev pkg-configlibavcodec-dev libavformat-dev libswscale-dev

我装的是3.2.0下载完后解压,进入OpenCV文件夹进行编译安装

  • mkdir release
  • cd release
  • cmake -D CMAKE_BUILD_TYPE=RELEASE -D
  • CMAKE_INSTALL_PREFIX=/usr/local ..
  • make
  • sudo make install

mkdir -p orb-slam2-ws/src

编译 ORB-SLAM2:

  • mkdir -p orb-slam2-ws/src
  • cd orb-slam2-ws/
  • catkin_make
  • echo“source~/projects/orb-slam2-ws/devel/setup.bash” >> ~/.bashrc
  • source ~/.bashrc
  • cd orb-slam2-ws/src
  • gitclonehttps://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2
  • cd ORB_SLAM2
  • chmod +x build.sh
  • ./build.sh

将ORB_SLAM2安装路径加入环境变量

  • exportROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/(user)/orb-slam2-ws/src/ORB_SLAM2/Examples/ROS

先找到这两个文件

libboost_system.so

libboost_filesystem.so

然后复制到ORB_SLAM2/lib下,然后将路径加到ORBSLAM2/Examples/ROS/ORBSLAM2下Cmakelists.txt文件中,

  • ${PROJECT_SOURCE_DIR}/../../../lib/libboost_filesystem.so
  • ${PROJECT_SOURCE_DIR}/../../../lib/libboost_system.so
  • chmod +x build_ROS.sh
  • ./build_ROS.sh

编译好ORB_SLAM2,接下来我们就要标定双目了。

用这个启动文件启动双目。

https://github.com/2017qiuju/ROS_notes/blob/master/stereo_usb_cam_stream_publisher.launch

roslaunch stereo_usb_cam_stream_publisher.launch camera_info:=ture

运行ROS的标定程序

rosrun camera_calibration cameracalibrator.py

--size8x6

--square0.0513

right:=/camera/right/image_raw left:=/camera/left/image_raw right_camera:=/camera/right left_camera:=/camera/left

--no-service-check

--approximate=0.1

打开文件:ORB_SLAM2/Examples/ROS/ORB_SLAM2/src/ros_stereo.cc

做如下更改,然后重新编译。

ORB_SLAM2默认接收的话题:

message_filters::Subscriber<sensor_msgs::Image> left_sub(nh, “/camera/left/image_raw”, 1);

message_filters::Subscriber<sensor_msgs::Image> right_sub(nh, “camera/right/image_raw”, 1);

改成现在启动文件发布的话题

message_filters::Subscriber<sensor_msgs::Image> left_sub(nh, "/camera/left/image_rect_color", 1);

message_filters::Subscriber<sensor_msgs::Image> right_sub(nh, "/camera/right/image_rect_color", 1);

将摄像头参数写入这个文件

/home/q/packages/ORB_SLAM2/Examples/Stereo/my_EuRoC.yaml

启动摄像头

roslaunch stereo_usb_cam_stream_publisher.launch camera_info:=true

stereo_image_proc

将两个摄像头的图片处理

ROS_NAMESPACE=camerarosrunstereo_image_procstereo_image_proc _approximate_sync:=true

坐标系转换

rosrun tf static_transform_publisher 0 0 0 -1.5707963267948966 0 -1.5707963267948966 base_link camera_link 100

启动ORB_SLAM2

rosrunORB_SLAM2Stereo/home/q/packages/ORB_SLAM2/Vocabulary/ORBvoc.txt /home/q/packages/ORB_SLAM2/Examples/Stereo/my_EuRoC.yaml false

运行结果视频:

这是自制双目跑的ORB-SLAM2截图

这是MYNTEYE-S1030-IR跑的ORB-SLAM2截图

总结:自制双目和MYNTEYE-S1030-IR相比,点云不是很规整,测距不是很准,路径还可以。

RTAB-Map实验

RTAB-Map是具有实时约束的全局闭环检测的RGB-D SLAM方法,可用于生成环境的3D点云或创建用于导航的2D网格图

它的代码库有两个:

https://github.com/introlab/rtabmap_ros.git

http://introlab.github.io/rtabmap

安装步骤如下:

  • sudo apt-get install ros-kinetic-move-base-msgs
  • mkdir -p rtabmap_ros_ws/src
  • gitclonehttps://github.com/introlab/rtabmap_ros.git src/rtabmap_ros
  • cd src
  • catkin_init_workspace
  • cd ~
  • git clone https://github.com/introlab/rtabmap.git rtabmap
  • cd rtabmap/build
  • cmake -DWITH_G2O=OFF -DWITH_GTSAM=OFF -DCMAKE_INSTALL_PREFIX=~/projects/rtabmap_ros_ws/devel ..
  • make -j4
  • make install
  • catkin_make -j4
  • echo "source ~/catkin_ws/devel/setup.bash " >> ~/.bashrc
  • source ~/.bashrc

装好之后就来测试 一下MYNTEYE-S1030-IR 和 RTAB-Map吧!

先启动相机

roslaunch mynt_eye_ros_wrapper mynteye.launch

进行坐标转换

rosrun tf static_transform_publisher 0 0 0 -1.5707963267948966 0 -1.5707963267948966 base_link camera_link 100

最后启动rtabmap_ros

roslaunch rtabmap_ros stereo_mapping.launch stereo_namespace:="/camera" rtabmap_args:="delete_db_on_start--Odom/Strategy 5 --OdomORBSLAM2/VocPath "/home/q/packages/ORB_SLAM2/Vocabulary/ORBvoc.txt"" left_image_topic:=/camera/left_rect/image_rect right_image_topic:=/camera/right_rect/image_rect left_camera_info_topic:=/camera/left/camera_info right_camera_info_topic:=/camera/right/camera_info /rtabmap/odom_info:=/camera/left/camera_info stereo:=trueframe_id:=base_link approx_sync:=false

运行结果视频

总结:它的点云依然很稀疏,最后的三维图依然很漂亮,路径也很规整。

自制的双目跑RTAB-Map

前面已经把环境都配置好了,现在我们直接运行程序

启动双目

roslaunch stereo_usb_cam_stream_publisher.launch camera_info:=true

图像处理

ROS_NAMESPACE=camera rosrun stereo_image_proc stereo_image_proc _approximate_sync:=true

坐标转换

rosrun tf static_transform_publisher 0 0 0 -1.5707963267948966 0 -1.5707963267948966 base_link camera_link 100

启动 rtabmap_ros

roslaunch rtabmap_ros stereo_mapping.launch stereo_namespace:="/camera" rtabmap_args:="--delete_db_on_start --Odom/Strategy 5 --OdomORBSLAM2/VocPath "/home/q/packages/ORB_SLAM2/Vocabulary/ORBvoc.txt"" left_image_topic:=/camera/left/image_rect_color right_image_topic:=/camera/right/image_rect_color left_camera_info_topic:=/camera/left/camera_info right_camera_info_topic:=/camera/right/camera_info /rtabmap/odom_info:=/camera/left/camera_info stereo:=trueframe_id:=base_link approx_sync:=true

运行视频链接:

http://cache.tv.qq.com/win/play.html?cid=&vid=b0918d9fude

这是自制双目跑rtabmap_ros 的建图结果:

这是S1030-IR跑rtabmap_ros 的建图结果:

总结:自制双目发布的图像是彩色的,rtabmap_ros 的三维图就具备彩色信息,这一点比MYNTEYE-S1030-IR标准版好一些,但是这两个开源项目都没有使用到小觅相机的IMU信息,所以这里只是单纯的从图像信息对两款相机测试两个开源项目的效果,并记录测试步骤,有兴趣的小伙伴可以根据这个教程学习。

原文发布于微信公众号 - 点云PCL(dianyunPCL)

原文发表时间:2019-08-26

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

扫码关注云+社区

领取腾讯云代金券