ORB_SLAM2系列之二:ORB_SLAM2跑单目SLAM
来源:互联网 发布:淘宝网打不开商品强细 编辑:程序博客网 时间:2024/06/07 17:54
接上一篇ORB_SLAM2系列之一:Ubuntu 14.04 ROS indigo下编译安装ORB_SLAM2,ORB_SLAM2提供了单目,双目和rgbd接口,这里我们先来尝试运行下最简单的单目SLAM(MonoSLAM)。
链接库
首先需要解决个错误:
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/srccd /home/catkin_ws/src/catkin_init_workspacecd .. && catkin_makeecho "source /home/catkin_ws/devel/setup.bash" >> ~/.bashrcchmod 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/srcgit clone https://github.com/raulmur/ORB_SLAM2.gitcd ORB_SLAM2./build.shcd ../..source devel/setup.bashrospack profile
其中,build.sh内容如下:
echo "Configuring and building Thirdparty/DBoW2 ..."cd Thirdparty/DBoW2mkdir buildcd buildcmake .. -DCMAKE_BUILD_TYPE=Releasemake -jcd ../../g2oecho "Configuring and building Thirdparty/g2o ..."mkdir buildcd buildcmake .. -DCMAKE_BUILD_TYPE=Releasemake -jcd ../../../echo "Uncompress vocabulary ..."cd Vocabularytar -xf ORBvoc.txt.tar.gzcd ..echo "Configuring and building ORB_SLAM2 ..."mkdir buildcd buildcmake .. -DCMAKE_BUILD_TYPE=Releasemake -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.gitcd ../..catkin_makesource devel/setup.bashrospack 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.306408Camera.fy: 516.469215Camera.cx: 318.643040Camera.cy: 255.313989Camera.k1: 0.262383Camera.k2: -0.953104Camera.p1: -0.005358Camera.p2: 0.002628Camera.k3: 1.163314Camera.width: 640Camera.height: 480# Camera frames per secondCamera.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 imageORBextractor.nFeatures: 1000# ORB Extractor: Scale factor between levels in the scale pyramidORBextractor.scaleFactor: 1.2# ORB Extractor: Number of levels in the scale pyramidORBextractor.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 contrastORBextractor.iniThFAST: 20ORBextractor.minThFAST: 7#--------------------------------------------------------------------------------------------# Viewer Parameters#--------------------------------------------------------------------------------------------Viewer.KeyFrameSize: 0.05Viewer.KeyFrameLineWidth: 1Viewer.GraphLineWidth: 0.9Viewer.PointSize:2Viewer.CameraSize: 0.08Viewer.CameraLineWidth: 3Viewer.ViewpointX: 0Viewer.ViewpointY: -0.7Viewer.ViewpointZ: -1.8Viewer.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/51829157
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
- ORB_SLAM2系列之二:ORB_SLAM2跑单目SLAM
- ORB_SLAM2系列之三:ORB_SLAM2跑RGBD SLAM数据集
- ORB_SLAM2之RGBD测试
- ORB_SLAM2系列之四:利用华硕Xtion Pro Live跑ORB_SLAM2
- ORB_SLAM2 源码阅读 ORB_SLAM2::ORBextractor
- ORB_SLAM2系列之一:Ubuntu 14.04 ROS indigo下编译安装ORB_SLAM2
- Run orb_slam2 on ubuntu
- orb_slam2 install遇到问题
- ORB_SLAM2安装与运行
- ORB_SLAM2安装与运行
- ORB_SLAM2代码解析[1]
- ORB_SLAM2配置完整步骤
- 编译 ORB_SLAM2 (一)
- ORB_SLAM2的编译运行
- ORB_SLAM2安装以及使用说明
- ORB_SLAM2+kinect2+ros_indigo
- ORB_SLAM2捋思路
- ORB_SLAM2捋思路(2)
- 7.Python
- WEB监听器(三大域对象的创建销毁监听总结)
- git使用小手册
- c#中形参是引用类型但依然是值传递!!
- minSdkVersion、targetSdkVersion、compileSdkVersion三者的作用解析
- ORB_SLAM2系列之二:ORB_SLAM2跑单目SLAM
- 647. Palindromic Substrings
- C语言的动态分配函数
- HDOJ--2188(巴什博奕)
- scrapy安装
- Unity3D
- java开发微信端获取code和opendId,access_token,用户列表
- python学习—Day33—综合复习第二弹
- NLP15-基于keras的中文情感挖掘试探