在树莓派4上编译运行orbslam2
2020-10-27 本文已影响0人
PIBOT导航机器人
1. 环境
- 硬件环境:
树莓派4B 4G 32G sandisk tf card - 软件环境:
Linux pibot 5.4.0-1022-raspi #25~18.04.1-Ubuntu SMP PREEMPT Thu Oct 15 14:38:18 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux
pibot@pibot:~$ pkg-config --modversion opencv
3.2.0
pibot@pibot:~$ pkg-config --modversion eigen3
3.3.4
cd Pangolin
git log --graph --decorate --oneline -1
#* 86eb497 (HEAD -> master, origin/master, origin/HEAD) cmake: Fix wayland option
cd ORB_SLAM2
git log --graph --decorate --oneline -1
# * f2e6f51 (HEAD -> master, origin/master, origin/HEAD) Update README.md
2. 编译Pangolin
sudo apt-get install libglew-dev
unzip Pangolin.zip
cd Pangolin
mkdir build && cd build
cmake ..
make -j4
sudo make install
3. 编译orb-slam2
3.1 修改头文件
include/System.h
新增#include <unistd.h>
以修复usleep
未定义的错误
diff --git a/include/System.h b/include/System.h
index b377b45..b2e990c 100644
--- a/include/System.h
+++ b/include/System.h
@@ -25,7 +25,7 @@
#include<string>
#include<thread>
#include<opencv2/core/core.hpp>
+#include <unistd.h>
#include "Tracking.h"
#include "FrameDrawer.h"
#include "MapDrawer.h"
3.2 编译
cd ORB_SLAM2
git log --graph --decorate --oneline -1
# * f2e6f51 (HEAD -> master, origin/master, origin/HEAD) Update README.md
./build.sh
4. 测试
4.1 数据集测试
2.2 数据集准备
cd dataset
wget https://vision.in.tum.de/rgbd/dataset/freiburg1/rgbd_dataset_freiburg1_desk.tgz
wget https://svncvpr.in.tum.de/cvpr-ros-pkg/trunk/rgbd_benchmark/rgbd_benchmark_tools/src/rgbd_benchmark_tools/associate.py
tar xzvf rgbd_dataset_freiburg1_desk.tgz
# 使用associate.py处理rgb.txt和depth.txt,生成配对的文件associate.txt
cd rgbd_dataset_freiburg1_desk
python ../associate.py rgb.txt depth.txt > associate.txt
4.2 测试
cd ORB_SLAM2
cd Vocabulary
tar xzvf ORBvoc.txt.tar.gz # 解压得到ORBvoc.txt
cd ..
# Usage: ./rgbd_tum path_to_vocabulary path_to_settings path_to_sequence path_to_associatio
./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt ./Examples/RGB-D/TUM1.yaml ../dataset/rgbd_dataset_freiburg1_desk ../dataset/rgbd_dataset_freiburg1_desk/associate.txt
效果如下
orb-slam2_freiburg1_desk