ORB-SLAM3: Build and Test
Notes
Make sure to practice on Ubuntu 18.04
to avoid potential build failures caused by different version of tools.
-
If you are running Windows, you can make use of WSL2 or VMware to raise up one Ubuntu 18.04 instance.
-
If you are running Linux but not Ubuntu 18.04, then you can try Incus(formerly LXD), LXC, systemd-nspawn or QEMU/KVM to run a Ubuntu 18.04 image.
Dependencies
Use a mirror if needed.
1 | sudo sed -i 's@//.*archive.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list |
Get necessary tools and libs.
1 | sudo apt install git cmake gcc g++ |
Build & Install Pangolin
Get the source code from GitHub. Use --depth=1
to save download time and disk storage by only acquiring the latest version.
1 | mkdir ~/repos && cd ~/repos |
Configure the project with CMake by generating build configuration files in build/
. The CMAKE_BUILD_TYPE
option should be set to ensure you get the Release
build (not Debug
or something else), which allows a higher perfomance.
1 | mkdir build && cd build |
Build the project with GNU Make according to the Makefile
you just generated. Use -j
to make use of all CPU cores and accelerate the compiling.
1 | make -j |
Be aware that there exist new syntaxes for Configure and Build, though Pangolin uses a low CMake version which does not support them:
1
2 cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
Install Pangolin into system for later use.
1 | sudo make install |
Refresh cached list of shared libraries to ensure Pangolin be correctly found and linked later.
1 | sudo ldconfig |
Build ORB-SLAM3
Get the source code from GitHub. The tested version is v0.4-beta
.
1 | cd ~/repos |
The system-wide installed OpenCV
version is 3.x, while ORB-SLAM3 uses 4.x. A simple workaround would be modifying include/CameraModels/KannalaBrandt8.h
by adding these lines:
1 | namespace cv { |
Build with build.sh
.
1 | chmod +x build.sh && ./build.sh |
If you ran into errors like c++: internal compiler error: killed (program cc1plus)
, it’s possibly caused by a lack of memory. Try the methods below:
-
Allocate more memory to the virtual machine / container.
-
Adopt
make
instead ofmake -j
to occupy less system resource. -
Use Swap Memory.
Test and Judge
Take EuRoc Dateset - MH03 for an example. Download and extract files to ~/repos/orb-slam/Examples/Datasets/EuRoc/
.
Mono Data
Refer to euroc_examples.sh
and find Mono processing command. This will generate two txt files. The f-
one stands for the whole track while the kf-
one stands for the key frame track.
1 | cd ~/repos/orb-slam/Examples |
Refer to euroc_eval_examples.sh
and find the corresponding judging command. This will generate a pdf file.
You may need to install some libraries for python:
1 sudo apt install python-numpy python-matplotlib
1 | cd ~/repos/orb-slam/Examples |
Whole Dataset
The whole script would be like below. Edit and run it under ~/repos/orb-slam/Examples
to judge the whole dataset.
1 |
|