Skip to content

ORB-SLAM2 Installation Guide

About 1720 wordsAbout 6 min

Installation Guide

2024-12-27

Preface

This blog will describe in detail how I installed Ubuntu16.04 dual system in bare metal state and installed the corresponding version of ROSkinetic system. In addition, after installing these two systems, how to successfully install and debug INDEMIND binocular camera and implement ORB-SLAM2 algorithm.

This article is my work notes of laboratory work during undergraduate period, officially recorded in January 2020, and now recorded on this blog site.

Hardware preparation

I use DELL-inspirion 5488, which is equipped with 3.0 USB interface for the camera.

Please do not lower than this configuration during the installation process, so as to avoid the algorithm cannot be executed after installation.

The whole installation process includes the following major links. If you have already installed some modules, you can skip this part.

Install Ubuntu16.04

IDEMIND binocular camera can match Ubuntu18.04 and Ubuntu16.04 versions of Ubuntu, but it is best to use Ubuntu16.04 version.

Because I installed it too many times, I forgot to take screenshots. For detailed process, please refer to this article: Install Ubuntu 16.04 desktop

Install ROS

About the version

During the installation process, please pay attention to the ROS version, which must match your Ubuntu version. Ubuntu16.04 corresponds to The ROS version is kinetic. If you don't know which version of ROS your Ubuntu corresponds to, you can search Baidu.

Friends with the ability can go directly to the ROS kinetic official website and follow the official installation guide. Most of the installation processes on the Internet are translated from the official website. And the official website can guarantee that the latest key is used.

Be sure to use a stable network during the installation process! Most of the errors are caused by unstable network.

  1. Configure Ubuntu's resource library. (Optional)

    Ubuntu resource library configuration
    Ubuntu resource library configuration

    Tips

    If you are in China, the URL of Download from is most effective when using Alibaba Cloud's link.

    http://mirrors.aliyun.com/ubuntu
  2. Set Ubuntu's sources.list.

    sudo sh -c 'echo "deb http://packages.ros.org/ros/Ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
  3. Set key.

    sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

    Tips

    If you cannot connect to the above server, you can try to replace keyserver with hkp://pgp.mit.edu:80 or hkp://keyserver.Ubuntu.com:80.

  4. Update package.

    sudo apt-get update
  5. Install ROS kinetic Full version.

    sudo apt-get install ros-kinetic-desktop-full

    Tips

    After installation, you can view the available packages through the following command:

    apt-cache search ros-kinetic
  6. Initialize rosdep.

    Before using ROS, you must initialize it, use the following command:

    sudo rosdep init
    rosdep update
  7. Configure the environment.

    echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
    source ~/.bashrc

    Among them: sourc ~/.bashrc is the code to update the configuration file. This command must be executed every time the bash file is changed to take effect.

  8. Install the dependencies of the building package.

    sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential
  9. Test that ROS is installed successfully.

    1. Open Termial and enter the following command to initialize the ROS environment:
    roscore
    1. Open a new Termial and enter the following command to pop up a small turtle window:
    rosrun turtlesim turtlesim_node
    1. Open a new Termial and enter the following command to control the movement of the turtle with the arrow keys in Termial:
    rosrun turtlesim turtle_teleop_key
    turtlesim runs successfully
    turtlesim runs successfully
    1. Open a new Termial and enter the following command to pop up a new window to view the ROS node information:
    rosrun rqt_graph rqt_graph
    ROS node information
    ROS node information

Install The ORB-SLAM Algorithm In INDEMIND

The following process is mostly a record of the installation operation process under the Ubuntu18.04 version. The second installation of the Ubuntu16.04 version is slightly different. The differences are reflected in the form of annotations, and there is no screenshot record.

The algorithm for installing this camera is divided into the following main steps:

  1. [Configure the environment](/article/2iezf70h/#Configure the environment)
  2. [Install the SDK dependent environment](/article/2iezf70h/#Install the SDK dependent environment)
  3. [Install the SDK](/article/2iezf70h/#Install the SDK)

Configure The Environment

Install Pangolin

Before installing Pangolin, make sure the following environments have been installed correctly.

  1. Glew
sudo apt-get install libglew-dev
  1. CMake
sudo apt-get install cmake
  1. Boost
sudo apt-get install libboost-dev libboost-thread-dev libboost-filesystem-dev
  1. Python

Ubuntu16.04 and 18.04 come with Python2, no need to reinstall.

After ensuring that the above prerequisites are installed, execute the following command to install Pangolin.

git clone https://github.com/stevenlovegrove/pangolin.git
cd pangolin
mkdir build
cd build
cmake -DCPP11_NO_BOOST=1 ..
make -j

Problems that may be encountered during installation

  1. Network problems. Be sure to pay attention to network problems during installation! If possible, try to use hotspots.

If the error reported in the middle is not an error like 'XXX package not found', it is mostly caused by unstable network. Re-execute the failed command multiple times to succeed. 2. Package Not Found problem.

Just follow the prompts to install the corresponding package. Note that after the installation package is completed, re-execute the following two lines of code to take effect:

cmake -DCPP11_NO_BOOST=1 ..
make -j
Problems I encountered.
  1. ERROR 1: libpng12-dev installation failed. When executing sudo apt-get install libjpeg-dev libpng12-dev libtiff5-dev libopenexr-dev:

    E: Package 'libpng12-dev' has no installation candidate

    Solution

    This error is because libpng12-dev has been discarded after Ubuntu16.04 and needs to be replaced with libpng-dev.

    sudo apt-get install libjpeg-dev libpng-dev libtiff5-dev libopenexr-dev
  2. ERROR 2: xkbcommon not found.

    xkbcommon not found
    xkbcommon not found

    Solution

    sudo apt-get install libxkbcommon-dev

Install OpenCV3.4.3

About the installed version

Opencv must be installed with version 3.4.3, otherwise INDEMIND will not run. Although this article is an installation tutorial for 18.04, it is also completely fine for 16.04.

  1. Install cmake and other dependencies.

    sudo apt-get update
    sudo apt-get install cmake
    sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg.dev libtiff4.dev libswscale-dev libjasper-dev
  2. Download the corresponding version from the opencv official website: https://opencv.org/releases/.

  3. After downloading, unzip the file.

  4. Enter the unzipped folder and create a build folder, and enter build.

    mkdir build
    cd build
  5. cmake.

    cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
  6. Compile.

    sudo make
  7. Execute the installation command.

    sudo make install
  8. Configure the environment.

    sudo gedit /etc/ld.so.conf.d/opencv.conf

    Add to the blank document that opens:

    /usr/local/lib

    Then execute to make the changes take effect:

    sudo ldconfig
  9. Configure bash.

    sudo gedit /etc/bash.bashrc

    Add to the end of the open file:

    PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
    export PKG_CONFIG_PATH

    Then execute the following command to update:

    source /etc/bash.bashrc
    sudo updatedb

    Configuration completed!

  10. Test.

    Enter opencv-3.4.3/samples/cpp/example_cmake, which contains some official cmake programs, and execute the camera program:

    cmake .
    make
    ./opencv_example

    If you can call your computer's camera, it means the installation is successful!

Install Eigen3

sudo apt-get install libeigen3-dev

Install DBoW2

When installing DBoW2, you need OpenCV support.

git clone https://github.com/dorian3d/DBoW2

cd DBow2
mkdir build
cd build

cmake ..
make
sudo make install

Install g2o.

  1. Download the compressed package from the official website.

  2. Install dependencies.

    sudo apt-get install cmake libeigen3-dev libsuitesparse-dev qtdeclarative5-dev qt5-qmake libqglviewer-dev

    It may happen that linqglviewer-dev cannot be installed. If you do not need the viewer module of g2o, you do not need to install this dependency. If you need it, you can download it directly from the official website, and then execute the following command to install it separately:

    mkdir build
    cd build
    cmake
    make
    sudo make install
  3. Compile.

    mkidr build
    cd build
    cmake ..
    make
  4. Install.

    sudo make install

Install SDK dependencies

  1. Install google-glog and gflags.

    sudo apt-get install libgoogle-glog-dev
  2. Install BLAS&LAPACK.

    sudo apt-get install libatlas-base-dev
  3. Install SuiteSparse and CXSparse.

    sudo apt-get install libsuitesparse-dev

Install SDK

Important

Ubuntu16.04 must be compiled with GCC5.4, otherwise the link may fail.

References

  1. ROS SDK installation.
  2. ORB-SLAM tutorial on INDEMIND WeChat official account.

1. Download SDK and source code

SDK: https://github.com/INDEMIND/SDK-Linux

ORB-SLAM: https://github.com/INDEMINDtech/run.ORB

2. Install SDK

  1. After downloading SDK, go to SDK-Linux/demo_ros/src directory. Put the downloaded ORB-SLAM2 in this directory.

  2. Replace CMakeList.txt to the ...SDK/demo_ros/src directory.

  3. Enter the sdk/demo_ros/src/ORB_SLAM2/Vocabulary directory and execute:

    tar -xf ORBvoc.txt.tar.gz
  4. Open the terminal in the demo_ros folder of the Linux SDK and use the command to compile:

    catkin_make

    After successful execution, two executable files will be generated under the demo_ros folder:

    1. module_driver
    2. stereo_euroc
  5. Open a new terminal and execute:

    roscore
  6. Copy module_driver to SDK/lib/1604, open the terminal and execute:

    sudo -s
    sudo chmod 777 ./run.sh
    ./run.sh
  7. Enter the SDK/demo_ros directory, open the terminal, and execute:

    ./stereo_euroc

Summary

🎉 🎉 When you complete all the above steps, you should be able to get a real-time ORM-SLAM algorithm 🎉 🎉

Changelog

Last Updated: View All Changelog
  • fix(docs): optimize articles

    On 12/27/24
  • feat(docs): add a new english article

    On 12/27/24

Keep It Simple