잡다한이야기

[SLAM]ORB SLAM3 설치하기

hanseongbugi 2024. 1. 15. 21:16

설치 환경

  • Ubuntu 18.04
  • ROS Melodic
  • OpenCV 3.2.0

 

Pangolin 설치

https://github.com/stevenlovegrove/Pangolin

 

GitHub - stevenlovegrove/Pangolin: Pangolin is a lightweight portable rapid development library for managing OpenGL display / in

Pangolin is a lightweight portable rapid development library for managing OpenGL display / interaction and abstracting video input. - GitHub - stevenlovegrove/Pangolin: Pangolin is a lightweight po...

github.com

 

빌드 도구 및 glew 라이브러리 설치

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential cmake unzip pkg-config
sudo apt install libglew-dev

 

Pangolin을 복제 후 설치

git clone https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin 
git checkout v0.5
mkdir build 
cd build 
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j4
sudo make install

 

 

ORB_SLAM3를 위한 라이브러리 설치 

https://github.com/UZ-SLAMLab/ORB_SLAM3

 

GitHub - UZ-SLAMLab/ORB_SLAM3: ORB-SLAM3: An Accurate Open-Source Library for Visual, Visual-Inertial and Multi-Map SLAM

ORB-SLAM3: An Accurate Open-Source Library for Visual, Visual-Inertial and Multi-Map SLAM - GitHub - UZ-SLAMLab/ORB_SLAM3: ORB-SLAM3: An Accurate Open-Source Library for Visual, Visual-Inertial and...

github.com

sudo apt-get install libeigen3-dev 
sudo apt install libpython2.7-dev
sudo apt install libboost-all-dev
sudo apt install libgl1-mesa-dev
sudo apt-get install cmake libsuitesparse-dev qtdeclarative5-dev qt5-qmake
sudo apt install libssl-dev
sudo apt install pkg-config
sudo apt install libegl1-mesa-dev libwayland-dev libxkbcommon-dev wayland-protocols

 

ORB_SLAM3를 복제

git clone https://github.com/UZ-SLAMLab/ORB_SLAM3.git

 

 

ORB_SLAM3/CMakeLists.txt파일을 파일 탐색기를 통해 열고 아래와 같이 수정

find_package(OpenCV 4.4)
   if(NOT OpenCV_FOUND)
      message(FATAL_ERROR "OpenCV > 4.4 not found.")
   endif()

 

부분을

find_package(OpenCV 3.2)
   if(NOT OpenCV_FOUND)
      message(FATAL_ERROR "OpenCV > 3.2 not found.")
   endif()

 

와 같이 수정 (Opencv 3.2.0을 사용하기 때문에 위와 같이 수정해야 build 가능)

 

 

ORB SLAM3 설치 (Warning 메시지 무시)

cd ORB_SLAM3
chmod +x build.sh
./build.sh

 

 

 

빌드 테스트

https://projects.asl.ethz.ch/datasets/doku.php?id=kmavvisualinertialdatasets

 

kmavvisualinertialdatasets – ASL Datasets

The EuRoC MAV Dataset This web page presents visual-inertial datasets collected on-board a Micro Aerial Vehicle (MAV). The datasets contain stereo images, synchronized IMU measurements, and accurate motion and structure ground-truth. Those data sets were p

projects.asl.ethz.ch

 

위 데이터 셋 제공 사이트에서 데이터를 다운 받아 ORB SLAM3의 빌드 테스트를 진행한다.

cd ORB_SLAM3
mkdir Dataset
cd Dataset
wget -O MH_01.zip http://robotics.ethz.ch/~asl-datasets/ijrr_euroc_mav_dataset/machine_hall/MH_01_easy/MH_01_easy.zip
unzip MH_01.zip

 

압축을 해제한 데이터 셋의 디렉터리 경로를 아래와 같이 구성해야한다.

Dataset
└── MH_01
    └── mav0
        ├── body.yaml
        ├── cam0
        ├── cam1
        ├── imu0
        ├── leica0
        └── state_groundtruth_estimate0

 

ORB_SLAM3 디렉터리에서 아래와 같은 명령어를 입력한다. (Monocular-Inertial인 경우)

./Examples/Monocular-Inertial/mono_inertial_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular-Inertial/EuRoC.yaml ./Dataset/MH_01/ ./Examples/Monocular-Inertial/EuRoC_TimeStamps/MH01.txt