Orb-slam (1)---Let the program fly.

Source: Internet
Author: User
Tags mkdir
1. Introduction to ORB Slam

Orbslam is a relatively complete Monocular slam algorithm in 15, The Orb refers to a rotational invariance feature, the whole algorithm is based on the Orb feature, unlike slam,orbslam based on dense or semi-dense maps, is a slam based on the feature point map. The latest advances in Orbslam are the semi-dense scene reconstruction based on Orbslam key frames, and the new research results will continue to focus on the following project homepage:

http://webdiis.unizar.es/~raulmur/orbslam/

The following is an introduction to English:

Orb-slam is a versatile and accurate monocular SLAM solution able to compute in real-time the camera trajectory and a spar Se 3D reconstruction of the scene ina wide variety of environments, ranging from small hand-held sequences of a desk to a Car driven around several city blocks. It is able toclose large loops and perform global relocalisation in real-time andfrom wide baselines. It includes an automatic and robust initialization fromplanar and non-planar scenes. See the related publication [1] for moredetails. demostrating videos, code and related publications are shown below. 2. Preparation work 2.1 source Download

Orbslam is based on Ros, so we have to get ready for Ubuntu and ROS environments, and here is not going to go into this, this article is based on the Ubuntu 14.04 and Ros Indigo Environment of the orbslam operation case.

First find the download link on the project home page to download the Orbslam project to your local

Https://github.com/raulmur/ORB_SLAM

Open the folder to see the following:

  

First of all we should pay attention to its README.txt, the inside about Orbslam how to compile, how to run is already very clear. Of course, it's easy for people who are familiar with Ros, but it may be a little hard for Ros, so here's a concrete compilation to be carried out and a detailed introduction. 2.2 test Data set preparation

Http://webdiis.unizar.es/~raulmur/orbslam/downloads/Example.bag.tar.gz

The link above is the download link for the test data set, which can be down, big, and slow.

Download the extract to get Example.bag file 3. ORB Slam compilation 3.1 dependent library installation

The Orb slam relies on the other two third-party libraries G2O (a general solver for performing graph optimizations, which can be easily understood, posture optimization, map optimization depends on it), Dbow library (mainly for place recognition, scene recognition, Orb Slam is mainly used in closed-loop detection). The two library Orb slam have been packaged in a piece, under the ThirdParty folder.

Of course, these two libraries also need to rely on other libraries, so, first install some other libraries, just follow the readme in the good ...

sudo apt-get install Libboost-all-dev
sudo apt-get install Libsuitesparse-dev
sudo apt-get install Libblas-dev
sudo apt-get install Liblapack-dev
sudo apt-get install Libeigen3-dev
3.2 Compilation of third-party libraries

After the above library has been installed, then the following will be done:

1. The terminal enters into the G2o folder and executes

   mkdir Build
   CD Build
   CMake.
Make 

After the execution of these four instructions, if not an error, oh, for DBOW2 the same truth, to this step or in accordance with the second section of the Readme is good

Note: Here the Readme does not introduce to install Opencv,orbslam is dependent on it, we do not forget to install the OPENCV, the next new version according to the instructions installed, here is not introduced.
Compilation of 3.3 Orb_slam

Here finally to the source code compiled, the compilation process and two third-party libraries similar, but there are some differences.

If Orb_slam is in your Ros workspace directory, you can skip the following steps:

Add the Orb_slam path to the ROS environment variable Ros_package_path,

Execute export ros_package_path= $ROS _package_path: (absolute path to your Orb_slam folder)

And then execute

   mkdir Build
CD Build
CMake.
Make

Under normal circumstances, if the compilation is successful, you can perform the next step. I in this step cmake times wrong, said is not find opencv2, in fact, here directly will file Manifest.xml <depend package= "opencv2"/> Delete just fine.
4. Running the program

When it comes to running programs, Orbslam is based on Ros, so first you have to run Roscore and start the Ros service. Then run a picture display, map display, Orb Slam main program, Rosbag Image Publishing program.

About starting each program, whether it is an orb body program or a visualizer or a picture publishing program, there are roughly two ways: 4.1 Manually start each program individually

(1) Open a new terminal, execute

  Roscore #启动ros服务

(2) Open a new terminal, execute

  Export ros_package_path= $ROS _package_path: (Your Orb_slam folder absolute path) #添加环境变量, if Orb_slam is in the ROS workspace, ignore
    Rosrun image_view image_view image:=/orb_slam/frame _autosize:=true   #启动图片查看程序, you can see the feature point tracking situation

(3) Open a new terminal, execute

  Export ros_package_path= $ROS _package_path: (Your Orb_slam folder absolute path) #添加环境变量, if Orb_slam is in the ROS workspace, ignore
    Rosrun Rviz rviz-d Data/rviz.rviz   #启动地图视图窗口, showing traces and feature points map

(4) Open a new terminal, execute

  Export ros_package_path= $ROS _package_path: (Your Orb_slam folder absolute path) #添加环境变量, if Orb_slam is in the ROS workspace, ignore
    Rosrun Orb_slam orb_slam data/orbvoc.yml data/settings.yaml   #运行ORB_SLAM, where orbvoc.yml needs to be decompressed first

(5) Open a new terminal execution, enter the Example.bag folder, execute

       Rosbag play--pause example.bag  #执行图片发布程序, after execution, press SPACEBAR to start

4.2 Starting a program with the launch file

Using the launch file is easier, and the Orb_slam package contains two launch files that correspond to different ROS versions

Depending on your Ros version, you can select the corresponding launch file, and the launch file will be equivalent to integrating the 2,3,4 step of the previous section in one piece, executed in the order of a script file:

(1) Open a new terminal, execute

  Roscore #启动ros服务

(2) Open a new terminal, execute

  Export ros_package_path= $ROS _package_path: (Your Orb_slam folder absolute path) #添加环境变量, if Orb_slam is in the ROS workspace, ignore
    Roslaunch Examplegroovyhydro.launch

(3) Open a new terminal execution, enter the Example.bag folder, execute

       Rosbag play--pause example.bag  #执行图片发布程序, after execution, press SPACEBAR to start

5. Problems and Solutions

Just how to run the program, but there may be some problems with using different datasets at run time, the following are some of the problems I encountered in executing the Orb slam:
5.1 Why is there always a trace failure when running a data set? I do not have any problems when using example.bag, but when running my own datasets, there are often tracking failures, and usually it is not a problem at the beginning, after running for some time. Open the picture in the dataset feel the frame before and after the change is not big ah, then measured the program every step of the execution time, a little bit to see his code implementation, the general inference is this: 1). When using Rosbag to publish images, many times use 30 frames per second of the transmission rate, however, the computer performance is not particularly good case, is not timely processing, so the reading image can be dropped frame phenomenon, resulting in image discontinuity, resulting in tracking failure; 2).      Orb_slam when the program executes, multiple threads share the same map keyframe, causing each thread to run at a time that is not fixed, which is one reason why the picture cannot be processed in time. Workaround: The person who usually runs the code first wants to look at the functionality of the code, the efficiency can be considered as the next thing, so the simplest way is to reduce or tune the Rosbag release frame rate to very low, the method is to use the Bagfromimages tool packaging when the frame rate parameter is set to a relatively small number, Instead of usually 30 frames. 5.2 Why run the results of the Kitti maximum scene (sequence 00) in the literature are inconsistent with those given in the literature.

There may be a tracking failure for smaller datasets using the method of reducing the speed of image publishing can solve some of the problems, but want to run a large scene of the data set, such as the relatively large data set in the literature (as shown below), found that the front run is OK, the back is still due to track failure, Causes the map to remain in a lost state until the scene has gone back before.


      At the beginning I was quite confused, and then a orb_slam to use the multi-threading, resource sharing mechanism and incremental map will lead to two factors: first, the algorithm time is not stable, the second is the memory consumption will be more and more, once the real physical memory is exhausted , we all know that Linux will use the swap partition as memory expansion space, so that the execution efficiency of the program will be reduced a lot, and then through the System Monitor found that 4G of memory is not enough for him to use, finally by adding a 4G of memory and then the picture published speed control to a very low frame rate, sluggish run, Finally reached the author's description of the effect (it seems that scientific research has a good performance of the computer or have advantages). 5.3 Setting your own camera-related parameters       When using your own data set, the camera's internal parameters and distortion parameters are different, so it can be modified in Settings.yaml under Data:
strong> 6. Conclusion     This article simply introduces how to run the Orb-slam step, the next one will gradually introduce my understanding of Orb-slam algorithm and some of his own thinking.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.