在WSL2中运行ORB-SLAM3
系统
我前面弄了Apollo所以想再整个新系统来弄SLAM,也可以直接在原系统中进行。
- 在wsl2-distro-manager的release中下载最新版的压缩包。
- 打开就可以复制已有的WSL。
依赖
Pangolin
1 | git clone https://github.com/stevenlovegrove/Pangolin |
OpenCV
- 安装依赖
1
2
3sudo apt install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg-dev libswscale-dev libtiff5-dev
sudo apt install libgtk2.0-dev
sudo apt install pkg-config - 安装OpenCV
1
2
3
4
5
6
7
8sudo apt update && sudo apt install g++ unzip wget cmake
wget -O opencv.zip https://github.com/opencv/opencv/archive/refs/tags/4.4.0.zip
unzip opencv.zip
cd opencv-4.4.0/
mkdir build && cd build
cmake ..
cmake --build .
sudo make install安装好依赖的话在5.3中应该就不会报错
Eigen3
1 | wget https://gitlab.com/libeigen/eigen/-/archive/3.1.1/eigen-3.1.1.zip |
不知道为什么这个不用
cmake --build .
安装
Clone the repository:
1 | git clone https://github.com/UZ-SLAMLab/ORB_SLAM3.git ORB_SLAM3 |
1 | cd ORB_SLAM3 |
报错1
1 | /home/trrrrw/orb-slam3/ORB_SLAM3/Thirdparty/DBoW2/DBoW2/BowVector.h:17:10: fatal error: boost/serialization/serialization.hpp: No such file or directory |
1 | sudo apt install libboost-dev |
报错2
1 | /home/trrrrw/orb-slam3/ORB_SLAM3/src/System.cc:26:10: fatal error: openssl/md5.h: No such file or directory |
1 | sudo apt install libssl-dev |
报错3
1 | /usr/bin/ld: cannot find -lboost_serialization |
安装boost
1 | sudo apt install libboost-all-dev |
测试数据集
- 下载数据集
https://projects.asl.ethz.ch/datasets/doku.php?id=kmavvisualinertialdatasets#downloads
下载ASL格式
放在最外面新建文件夹Examples能找到就行
- 解压出
mav0
文件夹 - 在
ORB_SLAM3
下新建文件夹dataset/MH01
,将mav0
文件夹放在这1
2
3
4mkdir dataset && cd dataset
mkdir MH01 && cd MH01
# 把mav0文件夹复制到MH01里就行
cp -r ../../../Examples/mav0/ ./ - 运行
1
2cd ../../Examples
./Monocular/mono_euroc ../Vocabulary/ORBvoc.txt ./Monocular/EuRoC.yaml ../dataset/MH01 ./Monocular/EuRoC_TimeStamps/MH01.txt这样应该是没有窗口的
在 Examples/Monocular/mono_euroc.cc 第 83 行附近,将函数的最后一个参数更改为 true ORB_SLAM3::System SLAM(argv[1],argv[2],ORB_SLAM3::System::MONOCULAR, true); 默认情况下为 false,改为true
用WSL这样还是没有窗口🤷♂️
WSL2
- 安装xfce4
1
sudo apt install xfce4
- 重新编译会报错(如果2.2.1没安装依赖的话)
1
what(): OpenCV(4.4.0) /home/trrrrw/orb-slam3/opencv-4.4.0/modules/highgui/src/window.cpp:634: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvNamedWindow'
- 删除OpenCV后安装
libgtk2.0-dev
andpkg-config
后重新编译安装1
2cd opencv-4.4.0/build
sudo make uninstall - 安装依赖
1
2
3sudo apt install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg-dev libswscale-dev libtiff5-dev
sudo apt install libgtk2.0-dev
sudo apt install pkg-config - 编译安装
1
2
3
4cd build
cmake ..
cmake --build .
sudo make install
- 删除OpenCV后安装
- 再执行4.4
成功👍
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Trrrrw!
评论