This article provides clear instructions on how to install necessary environments for all modules in Sim-To-Real Navigation Robots project, apart from the official original documentation provided. Since it was made in 2020, some additional corrections are needed during installation.

Moreover, there are some missing files in the original repo, they were also provided in this page. Note that we will only go though the updates to the original documentation, please refer to the original documentation for full instructions.

ORB-SLAM2 Installation


OpenCV 3.2

1. Missing stdlib.h

In section 3.3, change the original build & install command into the following:

cmake -DCMAKE_BUILD_TYPE=Release \
      -DWITH_CUDA=OFF \
      -DCMAKE_INSTALL_PREFIX=/usr/local/opencv-${CV3_RELEASE} \
      -DOPENCV_EXTRA_MODULES_PATH=/tmp/opencv_contrib/modules \
      /tmp/opencv
      -DENABLE_PRECOMPILED_HEADERS=OFF

Here -DENABLE_PRECOMPILED_HEADERS=OFF is added, without this line of parameter might cause an error of missing stdlib.h (fatal error: stdlib.h: No such file or directory #include_next stdlib.h).

2. Specify Number of Parallel Building Threads

If you are running Ubuntu 18.04 in virtual machine, it is likely that proc variable does not work, hence leading to a building error.

Install OpenCV by explicitly specify the number of threads would address this problem, which is also recommended:

sudo make install -j8

In this case 8 threads will be used to build the project. Note that even you are not using an virtual machine, specify maximum threads would not violate anything.

Pangolin

Do not just clone the Pangolin repo directly, Pangolin has several upgrades to the new version, which were made compilable with C++ 17. However, C++ 17 is not installed in Ubuntu 18.04 by default, install latest version of Pangolin in lower version C++ will cause error [Pangolin could not be found because dependency Eigen3 could not be found.].

Download Pangolin v0.5 here and build & install it as detailed in original instruction.

Make sure you specify threads while building Pangolin if needed.

Install ORB-SLAM2

Clone the repo to your local environment first as instructed by the original documentation. Copy modified_ORB_SLAM2 folder in localization_module folder to the src directory of your ROS workspace, and rename it to ORB_SLAM2.

In additional, you must do the following first before build ORB-SLAM2.

1. Missing tar file

In built.bash, file ORBvoc.txt.tar.gz is referenced but not provided. Download the file here and put it into ORB-SLAM2/Vocabulary/.

2. Missing Examples Folder

The original Examples folder provided is not complete. Replace the whole folder with the one appears in this repo.

3. Update CMakeList.txt

Update CMakeList.txt in ORB_SLAM2_Examples/ROS/ORB_SLAM2/ by adding a boost library line -lboost_syste into the library section:

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
)

Now you can build & install ORB-SLAM2 and ORB-SLAM2 node as instructed by the original documentation.