目录
- 安装OpenCV 3
- 注意事项
- 安装Glew
- 安装Pangolin
- 安装boost
- 安装Eigen 3
- 安装ORB_SLAM3
- 试用
平台:华硕 Thinker Edge R 瑞芯微 RK3399Pro
固件版本:Tinker_Edge_R-Debian-Stretch-V1.0.4-20200615
参考资料:
【入门必看】视觉惯性SLAM“灭霸”:ORB-SLAM3 —— 计算机视觉life
Ubuntu16.04环境下安装配置ORB-SLAM3 —— Hannnnnnnk
internal compiler error —— lifei_0001
ORBSLAM3 单目摄像头运行 —— 熊铁树
(20220320补:)
之前用的Fastgit来加速下载,但由于旧的镜像站不能用了,新镜像站速度也很慢,所以寄了。现在所用的方法见【Jetson Nano学习笔记】2. ORB-SLAM3及ZED 2i驱动安装
安装OpenCV 3
安装各种依赖包
// 安装build-essential、cmake、git和pkg-config
sudo apt install build-essential cmake git pkg-config // 安装jpeg格式图像工具包
sudo apt install libjpeg62-turbo-dev// 安装tif格式图像工具包
sudo apt install libtiff5-dev //安装视频I/O包
sudo apt install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev//安装gtk2.0
sudo apt install aptitude
sudo aptitude install libgtk2.0-dev//优化函数包
sudo apt install libatlas-base-dev gfortran
安装opencv及contrib
# Install minimal prerequisites (Ubuntu 18.04 as reference)
sudo apt update && sudo apt install -y cmake g++ wget unzip
# Download and unpack sources
wget -O opencv.zip https://hub.fastgit.org/opencv/opencv/archive/3.4.16.zip
wget -O opencv_contrib.zip https://hub.fastgit.org/opencv/opencv_contrib/archive/3.4.16.zip
unzip opencv.zip
unzip opencv_contrib.zip
# Create build directory and switch into it
mkdir -p build && cd build
# Configure
cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-3.4.16/modules ../opencv-3.4.16
# Build
cmake --build .
# 安装
sudo make install
# 更新动态链接库
sudo ldconfig
注意事项
在执行
cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-3.4.16/modules ../opencv-3.4.16
时可能会警告下载某些文件超时,可在cmake的日志中获取其下载链接和放置路径,自行补全后再次
cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-3.4.16/modules ../opencv-3.4.16
安装Glew
sudo apt install libglew-dev
安装Pangolin
git clone https://hub.fastgit.org/zzx2GH/Pangolin.git
cd Pangolin
sudo nano ~/Pangolin/src/CMakeLists.txt
注释掉如下内容
Ubuntu 14.04下安装Pagolin遇到的问题及解决方法(之一)
sudo nano ~/Pangolin/src/display/device/display_x11.cpp
注释如下两行:
出现报错Pangolin X11: Unable to retrieve framebuffer options怎么办? —— abcwoabcwo
mkdir build
cd build
cmake ..
make
cmake --build .
sudo make install
安装boost
wget -O boost_1_78_0.tar.gz https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.tar.gz
tar -zxvf boost_1_78_0.tar.gz
cd boost_1_78_0/
./bootstrap.sh
sudo ./b2 install
安装Eigen 3
git clone https://gitee.com/kobin24/eigen-git-mirror.git
cd eigen-git-mirror
mkdir build
cd build
cmake ..
sudo make install
执行完命令后,需要找到Eigen的安装路径,将Eigen文件夹复制到/usr/include。在Nano上用的是以下命令完成(引自Ubuntu16.04环境下安装配置ORB-SLAM3 —— Hannnnnnnk)
sudo cp -r /usr/local/include/eigen3/Eigen /usr/local/include
安装ORB_SLAM3
编译需要半天时间,过程中使用的ram十分惊人,我专门买了个内存卡做swap才编译成功,见
Linux内存卡(SD卡、TF卡)作为Swap交换空间
曾使用了高达13G的ram:
git clone https://hub.fastgit.org/electech6/ORB_SLAM3_detailed_comments.git
cd ORB_SLAM3_detailed_comments
sudo chmod +x ./build.sh
sudo chmod +x ./build_ros.sh./build.shsudo nano ~/.bashrc
# ~/ORB_SLAM3_detailed_comments为自己电脑中ORB_SLAM3存放的路径
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:~/ORB_SLAM3_detailed_comments/Examples/ROS
source ~/.bashrc./build_ros.sh
试用
# 新建一个终端
roscore# 新建一个终端
roslaunch usb_cam usb_cam-test.launch# 新建一个终端
rostopic list
可以看到当前的话题:
其中 /usb_cam/image_raw就是摄像头的话题
修改以下文件
sudo nano ~/ORB_SLAM3_detailed_comments/Examples/ROS/ORB_SLAM3/src/ros_mono.cc
改为
/usb_cam/image_raw
回到ORB_SLAM3主目录再次编译:
cd ~/ORB_SLAM3_detailed_comments
./build_ros.sh
# 新建一个终端
rosrun ORB_SLAM3 Mono ~/ORB_SLAM3_detailed_comments/Vocabulary/ORBvoc.txt ~/ORB_SLAM3_detailed_comments/Examples/ROS/ORB_SLAM3/Asus.yaml
RK3399Pro运行ORB-SLAM3单目Demo