ORB_SLAM2 安装 血的教训 - Something TO DO

ORB_SLAM2 安装 血的教训

Something TO DO posted @ 2018年1月28日 14:32 in C++ with tags ubuntu camera orb_slam2 , 6628 阅读

记住一个原则,如果要安装请按照Github源代码下的安装说明来,各种翻译版本的容易出问题。如果你已经安装完了,出了问题也尽量去Github该源代码下的Issues中去找解决方法,其他地方也大部分是翻译过来的,更容易出新问题。(当然我记录是为了我防止再犯错,你也可以参考,还是推荐去Github)

一, 安装依赖项

这个在https://github.com/raulmur/ORB_SLAM2中有说明,这里细说一下。

依赖项有:

1) Boost

2) Pangolin

3) OpenCV

4) Eigen3

5) DBoW2和g2o (在Thirdparty文件夹下有,无需安装)

 

下面分别说一下:

1)Boost安装

sudo apt-get install libboost-all-dev

(后面自己的时间基本都耽误在这个boost上,不是这个安装的问题,具体后边说)

 

2)Pangolin安装

参考:https://github.com/stevenlovegrove/Pangolin

Required Dependencies

    C++11

    OpenGL (Desktop / ES / ES2)

    Glew

sudo apt-get install libglew-dev

 

    CMake (for build environment)

sudo apt-get install cmake

Recommended Dependencies(电脑中貌似基本都有,可以命令行输入python看一下)

    Python2 / Python3, for drop-down interactive console

(deb) sudo apt-get install libpython2.7-dev
git clone https://github.com/stevenlovegrove/Pangolin.git

cd Pangolin

mkdir build

cd build

cmake ..

cmake --build .

3) OpenCV安装

这个下载源码,编译安装就行,版本要求在2.4.3以上就行,原作者用的是OpenCV 2.4.11 and OpenCV 3.2做的测试,我下载的是OpenCV 2.4.13,也可以工作。

4)Eigen3 安装

sudo apt-get install libeigen3-dev
cd /usr/include/eigen3
sudo cp Eigen/ .. -R (将Eigen文件夹放在/usr/include下面)

5)DBoW2和g2o

不用安装。

二, ORB_SLAM2安装

1, 下载ORB_SLAM2源代码

这里一般都不说下载的位置,但是我推荐下载到自己的ros工作目录(一般为catkin_ws)的src文件夹下,即./home/{用户名}/catkin_ws/src/{ORB_SLAM2},也就是在src目录下,做以下操作:

git clone https://github.com/raulmur/ORB_SLAM2.git

2, 编译,在catkin_ws/src/ORB_SLAM2/目录下编译

打开build.sh将-j去掉,-j为多核提高编译速度,但容易引起电脑卡机

chmod +x build.sh
./build.sh

 

(这里build.sh是一系列操作的脚本,其他的感觉很复杂的操作都是之前版本的,所以需要注意)

此时可以通过TUM数据集来测试安装是否成功。

TUM Dataset

Download a sequence from http://vision.in.tum.de/data/datasets/rgbd-dataset/download and uncompress it.

    Execute the following command. Change TUMX.yaml to TUM1.yaml,TUM2.yaml or TUM3.yaml for freiburg1, freiburg2 and freiburg3 sequences respectively. Change PATH_TO_SEQUENCE_FOLDERto the uncompressed sequence folder.

./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUMX.yaml PATH_TO_SEQUENCE_FOLDER

这里之前没有遇到什么问题,如果有问题记得去Github查找Issuses。

3, 之前这些都是非ROS版本的ORB_SLAM2,下面编译ros版本的

首先需要修改.bashrc(根目录下),指定orb_slam2的ros路径,按照以下要求添加

Add the path including Examples/ROS/ORB_SLAM2 to the ROS_PACKAGE_PATH environment variable. Open .bashrc file and add at the end the following line. Replace PATH by the folder where you cloned ORB_SLAM2:

export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:PATH/ORB_SLAM2/Examples/ROS

我的ORB_SLAM2目录是放在了/home/{用户名}/catkin_ws/src/ORB_SLAM2…..

我在.bashrc中添加的为:

export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/{用户名}/catkin_ws/src/ORB_SLAM2/Examples/ROS

这里需要做另外一个工作,就是从系统中查找两个文件,libboost_system.so和libboost_filesystem.so,查找方法为

locate boost_system
locate boost_filesystem

找到这两个文件 libboost_system.so和libboost_filesystem.so后,将他们复制到 /home/{用户名}/catkin_ws/src/ORB_SLAM2/lib目录下。

然后找到/home/{用户名}/catkin_ws/src//ORB_SLAM2/Examples/ROS/ORB_SLAM2目录下的CMakeLists.txt文件,需要做一定的修改,修改方法有两种,参考:https://github.com/raulmur/ORB_SLAM2/issues/494

说明一下,这里面两个人(分别是shejing和AldrichCabrera),他们两个分别修改为

 

shejing的回复:

set(LIBS
${OpenCV_LIBS}
${EIGEN3_LIBS}
${Pangolin_LIBRARIES}
${PROJECT_SOURCE_DIR}/../../../Thirdparty/DBoW2/lib/libDBoW2.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o/lib/libg2o.so
${PROJECT_SOURCE_DIR}/../../../lib/libORB_SLAM2.so
++
${PROJECT_SOURCE_DIR}/../../../lib/libboost_filesystem.so
${PROJECT_SOURCE_DIR}/../../../lib/libboost_system.so)

 

AldrichCabrera的回复:
set(LIBS
${OpenCV_LIBS}
${EIGEN3_LIBS}
${Pangolin_LIBRARIES}
${PROJECT_SOURCE_DIR}/../../../Thirdparty/DBoW2/lib/libDBoW2.so
${PROJECT_SOURCE_DIR}/../../../Thirdparty/g2o/lib/libg2o.so
${PROJECT_SOURCE_DIR}/../../../lib/libORB_SLAM2.so
-lboost_system)

我之前在CSDN上看到的全是第一种解决方法,一直编译不通过,后来尝试第二种编译成功。不知道第一种情况有没有编译通过,后期需要找一下原因。

chmod +x build_ros.sh
./build_ros.sh

 

(同样需要去掉build_ros.sh文件中的-j参数)

切换目录到/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/下,然后按照Github上编译即可。

4, Execute build_ros.sh script:

 

笔记本摄像头驱动安装和相机标定

1. 使用博世公司的 "usb_cam":A ROS Driver for V4L USB Cameras

cd catkin_ws/src
git clone https://github.com/bosch-ros-pkg/usb_cam.git
cd ../
catkin_make

 

下载需要标定的黑白棋盘,打印后贴在平板上.

 

2. 编译ROS相机标定包

rosdep install camera_calibration
rosmake camera_calibration

3. 启动usb_cam,获取笔记本摄像头的图像

 

// sudo apt-get install ros-indigo-usb-cam optional 若没有安装usb_cam驱动时安装

roslaunch usb_cam usb-cam-test.launch

 

4. 启动标定程序

rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.025 image:=/usb_cam/image_raw camera:=/usb_cam

其中image:= 和camera:=后的内容需要根据自己电脑摄像头的话题和节点来修改,可以通过rqt_graph来查看。比如有的会是image:=/camera/image_raw camera:=/camera

标定界面出现后,按照x(左右)、y(上下)、size(前后)、skew(倾斜)等方式移动棋盘,直到x,y,size,skew的进度条都变成绿色位置.

此时可以按下CALIBRATE按钮,等一段时间就可以完成标定。

完成后Commit,在终端后会有标定结果yaml文件地址.默认一般为/home/{用户名}/.ros/camera_info/head_camera.yaml

打开后,按照TUM1.yaml的格式修改,只是需要加上camera的尺寸Camera.width和Camera.height,命名为mycam.yaml.

例如:

复制到/home/shang/catkin_ws/src/ORB_SLAM2/Examples/Monocular/目录下

而在orb_slam中的格式如下,需要将上面的

camera_matrix:

distortion_coefficients:

参数值对应。其中ORB参数与Viewer参数不变。

roslaunch usb_cam usb_cam-test.launch
rosrun ORB_SLAM2 Mono /home/mazhg/catkin_ws/src/ORB_SLAM2/Vocabulary/ORBvoc.txt /home/mazhg/catkin_ws/src/ORB_SLAM2/Examples/Monocular/myusb.yaml

 

 

Avatar_small
goodman 说:
2018年5月28日 23:54

orbslam2 git clone網址錯誤拉~
少一個2
GOOD LUCK

Avatar_small
Something TO DO 说:
2018年8月14日 08:42

@goodman: 多谢提醒,已修改

Avatar_small
cleaning company in 说:
2019年9月18日 16:08

Then again, if you need “regular maintaining, ” you will have maid maintaining services which inturn charge usually good number in maids, additionally, the time recommended. Maid maintaining companies can price ones own services within 25 to help you 35 AED by the hour.

Avatar_small
thai citrus technolo 说:
2019年11月15日 01:09

Organizations need capital for start-up costs or fund expansions. According to your enterprise, you have got several selections for raising the mandatory capital. As well as using the savings, the most frequent methods regarding financing are usually debt capital.

Avatar_small
sikkim health 说:
2020年3月24日 20:34

It really is important to address oneself using each of the principles of well being. Regular check-ups, proper healthy eating plan and balanced living many enable that you keep on top of their health within a careful still reasonable technique. Often just one becomes overly related to health difficulties and embroiled in some sort of cycle connected with health issues.

Avatar_small
clean tech laws 说:
2020年3月24日 20:34

Legal issues of Gravity is certainly one of a Wide-spread Law. So would be the Law connected with Conservation of energy, that is usually, energy are not created or maybe destroyed, only transformed collected from one of form completely to another. However, not like human legislation, which will vary from state to state, Universal Legislation are reliable and unchanging. You interact with these legislation with just about every breath people take. Many people govern ones existence.

Avatar_small
bank ruptcy law merc 说:
2020年3月24日 20:35

Legal issues of Gravity is certainly one of a Wide-spread Law. So would be the Law connected with Conservation of energy, that is usually, energy are not created or maybe destroyed, only transformed collected from one of form completely to another. However, not like human legislation, which will vary from state to state, Universal Legislation are reliable and unchanging. You interact with these legislation with just about every breath people take. Many people govern ones existence.

Avatar_small
dui lawyer montreal 说:
2020年3月24日 20:35

Everybody is subject to help these similar natural Laws on the Universe, no matter what race, coloration, creed or maybe gender. This laws use their have an effect on without your consent or maybe awareness. After we choose this behaviour, we opt for the consequences. Perhaps surprisingly, the those who find themselves frustrated with life consistently seek to defy this natural legislation. And, obviously, successful people have a home in harmony while using the natural Laws on the Universe.

Avatar_small
wendy wood law 说:
2020年3月24日 20:36

I spent their childhood years in this 1980s as soon as it looked like that all people wanted as a lawyer such as ones with LA Rules. The 1980s, 1990s, and 2000s (taking 2007) seemed to be the age of Massive Law in the event the promise of any $100, 000 to help $160, 000 pay was, the item seemed, extended to help anyone graduating at a top 20 school in order to many persons graduating at a top 50 rules school having great degrees and clerkships.

Avatar_small
shell shockers 说:
2020年3月25日 10:13

Do not be afraid to change. You may lose something good but you can achieve something even better.

Avatar_small
full time maids in d 说:
2020年4月29日 18:27

For anyone who is recruiting servant maid by using an agency, look at its consistency, referrals connected with current buyers, about the maid's medical nsurance policies, how long there're doing ecommerce etc. Ask if they guarantee the servants and if they performed any record checks on the maids.

Avatar_small
painting company in 说:
2020年4月29日 18:27

In contrast, if you decide to go additional route in addition to hire household painters; you are not required to help lift 1 finger. Professionals will work the meet your needs exactly, of course providing you pay these individuals considerably. Painters will be sure that everything is finished according to meet your needs and needs.

Avatar_small
dial a maid dubai 说:
2021年6月07日 15:12

Changing the cleansing product will help you to bring a substantial change within your house. So, it's highly suggested to not use any kind of regular cleaning soap for getting rid of the difficult stains out of your floors or even kitchen wall space. Instead of this, using cleaning soap that includes vegetable essential oil or glycerine is going to be highly advantageous.

Avatar_small
hryedumis 说:
2022年8月04日 01:33

The Government of Haryana State has designed the School Management Information System for the welfare of Schools in the state. The school staff, teachers, and students have got direct access to the portal through which most of the services easily processed. hryedumis The Government of Haryana State has designed the School Management Information System for the welfare of Schools in the state. The MIS Portal also referred to as Saksham Haryana Education Portal which is a one-stop website for every need of Schools in Haryana. The New aspirants can utilize this option to apply for their selected school form online by submitting the application form.

Avatar_small
IInd PUC Important Q 说:
2022年8月18日 14:20

Karnataka PUC Question Paper 2023 Download – KSEEB 1st & 2nd PUC Important Question Paper 2023, The Department of Pre-University Education, IInd PUC Important Question Paper 2023 Government of Karnataka PUE, has been announced the Previous Question Paper for II PUC examination for the year 2023. The examination will begin in the month of March 2023 and will continue till March last week 2023.

Avatar_small
AP SSC fa 2 Question 说:
2022年9月09日 20:16

Formative Assessment means not only an examination, it includes various aspects such as Examination in completed lessons, Reflections, Project work done on the allotted topic and Self also Prepared notes etc. AP SSC fa 2 Question Paper Candidates of Telugu Medium, English Medium & Urdu Medium of the AP State can download the AP 10th Class FA 4 Model Paper 2023 Pdf with answers for the regular exams conducted by the Directorate of Government Examinations, Andhra Pradesh.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter
Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee