ORB_SLAM2系列之二:ORB_SLAM2跑单目SLAM
2017-11-29 22:33
295 查看
接上一篇ORB_SLAM2系列之一:Ubuntu 14.04 ROS indigo下编译安装ORB_SLAM2,ORB_SLAM2提供了单目,双目和rgbd接口,这里我们先来尝试运行下最简单的单目SLAM(MonoSLAM)。
解决:
现在
其中,build.sh内容如下:
完成DBow2,g2o,ORB-SLAM的编译,解压DBow2字典文件.ORB-SLAM2启动时,也需要载入这个100多M的文件,比较耗时。
2.用电脑自带的摄像头跑orb_slam2:https://zhuanlan.zhihu.com/p/29629824
3.ORB-SLAM跑通笔记本摄像头:http://www.cnblogs.com/shang-slam/p/6733322.html
4.在ROS中使用usb摄像头跑ORB SLAM2:http://blog.csdn.net/Goding_learning/article/details/52950993
链接库
首先需要解决个错误:error while loading shared libraries: libGLEW.so.2.1: cannot open shared obj
解决:
ln -s /usr/lib64/libGLEW.so.2.1 /usr/lib/libGLEW.so.2.1
准备工作空间
依次执行以下命令:mkdir -p /home/catkin_ws/src cd /home/catkin_ws/src/ catkin_init_workspace cd .. && catkin_make echo "source /home/catkin_ws/devel/setup.bash" >> ~/.bashrc chmod 777 catkin_ws/ source /home/catkin_ws/devel/setup.bash source ~/.bashrc
现在
/home/catkin_ws目录就是你设定的ROS的工作空间,以后需要其他的库都克隆到
/home/catkin_ws/src目录下,然后回退到目录
/home/catkin_ws/下,执行
catkin_make进行编译。
编译ORB-SLAM2,DBow2和g2o
将ORB-SLAM2克隆到ROS的工作路径/home/catkin_ws/下。DBow和g2o这两个库在ORB-SLAM2的Thirdparty目录中,下载ORB-SLAM2源代码后,使用提供的脚本
build.sh即可将它们一并编译了。
cd /home/catkin_ws/src git clone https://github.com/raulmur/ORB_SLAM2.git cd ORB_SLAM2 ./build.sh cd ../.. source devel/setup.bash rospack profile
其中,build.sh内容如下:
echo "Configuring and building Thirdparty/DBoW2 ..." cd Thirdparty/DBoW2 mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release make -j cd ../../g2o echo "Configuring and building Thirdparty/g2o ..." mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release make -j cd ../../../ echo "Uncompress vocabulary ..." cd Vocabulary tar -xf ORBvoc.txt.tar.gz cd .. echo "Configuring and building ORB_SLAM2 ..." mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release make -j
完成DBow2,g2o,ORB-SLAM的编译,解压DBow2字典文件.ORB-SLAM2启动时,也需要载入这个100多M的文件,比较耗时。
笔记本摄像头驱动安装
如果你使用笔记本自带的摄像头,可以使用博世公司的 “usb_cam”:A ROS Driver for V4L USB Cameras。相似地,将usb_cam克隆到ROS的工作路径/home/catkin_ws/下。
cd /home/catkin_ws/src/ git clone https://github.com/bosch-ros-pkg/usb_cam.git cd ../.. catkin_make source devel/setup.bash rospack profile
设定相机参数
#/home/research/ORB_SLAM2/Examples/Monocular/my.yaml %YAML:1.0 #-------------------------------------------------------------------------------------------- # Camera Parameters. Adjust them! #-------------------------------------------------------------------------------------------- # Camera calibration and distortion parameters (OpenCV) Camera.fx: 517.306408 Camera.fy: 516.469215 Camera.cx: 318.643040 Camera.cy: 255.313989 Camera.k1: 0.262383 Camera.k2: -0.953104 Camera.p1: -0.005358 Camera.p2: 0.002628 Camera.k3: 1.163314 Camera.width: 640 Camera.height: 480 # Camera frames per second Camera.fps: 30.0 # Color order of the images (0: BGR, 1: RGB. It is ignored if images are grayscale) Camera.RGB: 1 #-------------------------------------------------------------------------------------------- # ORB Parameters #-------------------------------------------------------------------------------------------- # ORB Extractor: Number of features per image ORBextractor.nFeatures: 1000 # ORB Extractor: Scale factor between levels in the scale pyramid ORBextractor.scaleFactor: 1.2 # ORB Extractor: Number of levels in the scale pyramid ORBextractor.nLevels: 8 # ORB Extractor: Fast threshold # Image is divided in a grid. At each cell FAST are extracted imposing a minimum response. # Firstly we impose iniThFAST. If no corners are detected we impose a lower value minThFAST # You can lower these values if your images have low contrast ORBextractor.iniThFAST: 20 ORBextractor.minThFAST: 7 #-------------------------------------------------------------------------------------------- # Viewer Parameters #-------------------------------------------------------------------------------------------- Viewer.KeyFrameSize: 0.05 Viewer.KeyFrameLineWidth: 1 Viewer.GraphLineWidth: 0.9 Viewer.PointSize:2 Viewer.CameraSize: 0.08 Viewer.CameraLineWidth: 3 Viewer.ViewpointX: 0 Viewer.ViewpointY: -0.7 Viewer.ViewpointZ: -1.8 Viewer.ViewpointF: 500
运行
rosrun ORB_SLAM2 Mono /home/catkin_ws/src/ORB_SLAM2/Vocabulary/ORBvoc.txt /home/research/ORB_SLAM2/Examples/Monocular/my.yaml
参考
1.使用自己笔记本摄像头运行orbslam2:http://blog.csdn.net/qq_18661939/article/details/518291572.用电脑自带的摄像头跑orb_slam2:https://zhuanlan.zhihu.com/p/29629824
3.ORB-SLAM跑通笔记本摄像头:http://www.cnblogs.com/shang-slam/p/6733322.html
4.在ROS中使用usb摄像头跑ORB SLAM2:http://blog.csdn.net/Goding_learning/article/details/52950993
相关文章推荐
- ORB_SLAM2系列之四:利用华硕Xtion Pro Live跑ORB_SLAM2
- ORB_SLAM2系列之一:Ubuntu 14.04 ROS indigo下编译安装ORB_SLAM2
- ORB_SLAM2系列之三:ORB_SLAM2跑RGBD SLAM数据集
- ORB_SLAM2学习记录1-ORB_SLAM2的安装与运行
- SSM框架实战系列之二_Maven之一
- BizTalk学习笔记系列之二:实例说明如何使用BizTalk
- WCF面向服务应用程序系列之二:契约设计(ExplicitContract)
- 跟我一起来学ORACLE开发系列之二:常用Linux命令基础
- Web Service 开发系列文章之二(一些SOAP相关的内容)
- ORB-SLAM2源码详解
- 活动目录系列之二:额外域控的搭建
- 《视觉SLAM十四讲》学习系列(1)—经典视觉SLAM框架
- 活动目录系列之二:单域环境的实现(单站点)
- 疯狂代码,大型网站架构系列之二,底层架构概论
- JAVA/JSP学习系列之二(Tomcat安装)
- 笨鸟先飞学编程系列之二 基础代码的编写
- 核心黑客系列之二Russell King
- 白话经典算法系列之二 直接插入排序的三种实现
- 敏捷开发与中医理论系列之二:古法教学(软件教育,松结对编程,师徒制度)