虚拟机ubuntu16.04 安装ORB_SLAM3
一.下载和编译ORB_SLAM3git clone https://github.com/UZ-SLAMLab/ORB_SLAM3.gitcd ORB_SLAM3chmod +x build.sh./build.sh出现问题:*CMake 3.10 or higher is required. You are running version 3.5.2 *这里参考cmake版本升级https://
虚拟机ubuntu16.04 安装ORB_SLAM3
一.依赖项
使用Pangolin进行可视化和用户界面的显示
使用OpenCV进行图像处理特征提取(opencv的安装)
Eigen3,g2o需要用,矩阵计算
DBoW2 和 g2o,使用DBoW2库的修改版本来执行位置识别和g2o库来执行非线性优化
二.进行库安装
1、安装Pangolin(参考此博客)
安装依赖包
sudo apt-get install libglew-dev
sudo apt-get install cmake
sudo apt-get install libpython2.7-dev
sudo apt-get install ffmpeg libavcodec-dev libavutil-dev libavformat-dev libswscale-dev
sudo apt-get install libdc1394-22-dev libraw1394-dev
sudo apt-get install libjpeg-dev libpng12-dev libtiff5-dev libopenexr-dev
Pangolin下载网址:https://github.com/stevenlovegrove/Pangolin/tags
这里下载的是0.5版本,0.6版本编译会出现问题。
解压:
tar -xzvf Pangolin-0.5.tar.gz
进入文件夹:
cd Pangolin-0.5/
建立bulid文件夹:
mkdir build
cd build
cmake ..
编译完成
make
sudo make install
Pangolin安装完成!
2 安装opencv
安装依赖包
sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
下载opencv和opencv_contrib:
https://github.com/opencv寻找对应版本
解压:
tar -xzvf opencv-3.4.2.tar.gz
tar -xzvf opencv_contrib-3.4.2.tar.gz
新建文件夹,开始编译
cd opencv-3.4.2/
mkdir build
cd build
cmake命令:
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D WITH_TBB=ON \
-D WITH_V4L=ON \
-D WITH_QT=ON \
-D WITH_OPENGL=ON \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4.16/modules \
-D BUILD_EXAMPLES=ON ..
遇到报错
检查opencv modules里和opencv_contrib modules里的文件是否重复,删除contrib里的重复组件即可
编译完成:
sudo make -j8
sudo make install
sudo sh -c 'echo "/usr/local/lib" >> /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig
3 安装eigen3
sudo apt-get install libeigen3-dev
或者采用源码安装,这里参考https://blog.csdn.net/hhz_999/article/details/120473659
三.下载和编译ORB_SLAM3
git clone https://github.com/UZ-SLAMLab/ORB_SLAM3.git
cd ORB_SLAM3
chmod +x build.sh
修改部分代码,我这里发生了报错
Opencv4 改为3
添加libboost_serialization.so链接库,否则编译不通过
LINK_directories("/usr/local/lib")
# If RealSense SDK is found the library is added and its examples compiled
if(realsense2_FOUND)
include_directories(${PROJECT_NAME}
${realsense_INCLUDE_DIR}
)
target_link_libraries(${PROJECT_NAME}
${realsense2_LIBRARY}
libboost_serialization.so
)
endif()
./build.sh
编译完成:
在此过程中还存在着其他库版本错误:
出现问题:
*CMake 3.10 or higher is required. You are running version 3.5.2 *
这里参考cmake版本升级https://www.cnblogs.com/jsdy/p/12689470.html
出现问题:
Pangolin版本降级https://blog.csdn.net/weixin_43166819/article/details/121372051
安装opencv4.4 https://blog.csdn.net/lu_linux/article/details/114135156
报错:
这里参考这篇博客https://www.cnblogs.com/didada/p/12305066.html
四.测试:
下载数据集:
https://projects.asl.ethz.ch/datasets/doku.php?id=kmavvisualinertialdatasets
我下载的是MH01:
开始运行:
./Examples/Monocular/mono_euroc ./Vocabulary/ORBvoc.txt ./Examples/Monocular/EuRoC.yaml ./Datasets/EuRoc/MH01 ./Examples/Monocular/EuRoC_TimeStamps/MH01.txt dataset-MH01_mono
效果如下:
运行ROS版
rosrun ORB_SLAM3 Mono /home/ycp/realsense/ORB_SLAM3_comments/Vocabular/ORBvoc.txt /home/ycp/realsense/ORB_SLAM3_comments/Examples/Monocular/RealSense_D435i.yaml
说明:
在实际安装中由于官方的库中含有intel相机相关驱动积相机参数信息,在本次安装编译完成后SLAM也无法正常运行,具体原因还在寻找中,本文展现的效果为另一个版本的测试。
参考博客:
https://blog.csdn.net/qq_43131852/article/details/121546419
https://www.icode9.com/content-4-1134365.html
https://blog.csdn.net/hhz_999/article/details/120473659
https://zpf1900.blog.csdn.net/article/details/118031317
更多推荐
所有评论(0)