• 【ORB SLAM3】一、ORB SLAMv3 在Ubuntu18.04 下载安装编译


    一、 下载

    1. 创建工作目录

    cd ~/
    mkdir Orb_Slamv3
    cd Orb_Slamv3
    

    2. 下载 ORB SLAMv3源码(当前最新版本是0.4)

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

    3. 下载 Opencv(最低要求3.2.0)(使用的是3.3.1)

    git clone git@github.com:opencv/opencv.git
    git checkout 3.3.1
    

    4. 下载 Eigen3(最低要求3.1.0)(使用的是3.1.0)

    可以在Eigen3.1下载压缩包,git下载太慢

    5. 下载 Pangolin

    git clone git@github.com:stevenlovegrove/Pangolin.git
    

    至此,所依赖的扩展包都下载完毕。接下来逐个编译安装。

    二、安装编译

    1.安装opencv

    cd opencv
    mkdir build
    cd build
    cmake .. -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local
    make -j4
    make install
    

    2.安装Eigen3.1.0

    cd ~/Orb_Slamv3
    tar -xzvf eigen-3.1.0.tar.gz
    mv eigen-3.1.0 /usr/local/include/eigen3
    cd /usr/local/include
    cp eigen3/Eigen ./ -r
    

    3.安装Pangolin

    sudo apt install libgl1-mesa-dev
    sudo apt install libglew-dev
    sudo apt install libpython2.7-dev
    git submodule init && git submodule update
    sudo python -mpip install numpy pyopengl Pillow pybind11
    sudo apt install pkg-config
    sudo apt install libegl1-mesa-dev libwayland-dev libxkbcommon-dev wayland-protocols
    sudo apt install ffmpeg libavcodec-dev libavutil-dev libavformat-dev libswscale-dev libavdevice-dev
    sudo apt install libdc1394-22-dev libraw1394-dev
    sudo apt install libjpeg-dev libpng12-dev libtiff5-dev libopenexr-dev
    
    cd ~/Orb_Slamv3/Pangolin
    mkdir build
    cd build
    cmake ..
    make -j4
    make install
    

    4.安装 ORB SLAMv3

    在ORBSLAM3目录下CMakeList.txt中做如下修改屏蔽

    include_directories("/usr/local/include/eigen3") #新增
    #find_package(Eigen3 3.1.0 REQUIRED) #屏蔽
    find_package(Pangolin REQUIRED)
    find_package(realsense2)
    
    include_directories(
    ${PROJECT_SOURCE_DIR}
    ${PROJECT_SOURCE_DIR}/include
    ${PROJECT_SOURCE_DIR}/include/CameraModels
    #${EIGEN3_INCLUDE_DIR} #屏蔽
    ${Pangolin_INCLUDE_DIRS}
    )
    

    在ORBSLAM3/Thirdparty/g2o/CMakeList.txt中做如下修改

    
    # Find Eigen3
    #SET(EIGEN3_INCLUDE_DIR ${G2O_EIGEN3_INCLUDE})  #屏蔽
    #FIND_PACKAGE(Eigen3 3.1.0 REQUIRED)  #屏蔽
    #IF(EIGEN3_FOUND)   #屏蔽
    #  SET(G2O_EIGEN3_INCLUDE ${EIGEN3_INCLUDE_DIR} CACHE PATH "Directory of Eigen3")  #屏蔽
    #ELSE(EIGEN3_FOUND)  #屏蔽
    #  SET(G2O_EIGEN3_INCLUDE "" CACHE PATH "Directory of Eigen3")  #屏蔽
    #ENDIF(EIGEN3_FOUND)  #屏蔽
    include_directories("/usr/local/include/eigen3" ) #新增
    
    # Set up the top-level include directories
    INCLUDE_DIRECTORIES(
    ${g2o_SOURCE_DIR}/core
    ${g2o_SOURCE_DIR}/types
    ${g2o_SOURCE_DIR}/stuff
    #${G2O_EIGEN3_INCLUDE}) #屏蔽
    

    编译

    sudo apt-get install libboost-dev
    sudo apt install libssl-dev
    
    cd Thirdparty/DBoW2
    mkdir build
    cd build
    cmake .. -DCMAKE_BUILD_TYPE=Release
    make -j
    
    cd ../../g2o
    mkdir build
    cd build
    cmake .. -DCMAKE_BUILD_TYPE=Release
    make -j
    
    cd ../../../
    
    cd Vocabulary
    tar -xf ORBvoc.txt.tar.gz
    cd ..
    
    mkdir build
    cd build
    cmake .. -DCMAKE_BUILD_TYPE=Release
    make
    

    三、错误总结:

    1.

    错误:

    /usr/local/include/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h:48:77: error: invalid use of incomplete type ‘struct Eigen::internal::make_unsigned<long long int>’
       typedef typename make_unsigned<typename make_integer<Scalar>::type>::type ScalarUI;
    

    解决:修改Eigen为3.1.0版本

    2.

    错误:

    CMakeFiles/ORB_SLAM3.dir/build.make:374: recipe for target 'CMakeFiles/ORB_SLAM3.dir/src/Optimizer.cc.o' failed
    make[2]: *** [CMakeFiles/ORB_SLAM3.dir/src/Optimizer.cc.o] Error 1
    virtual memory exhausted: Cannot allocate memory
    virtual memory exhausted: Cannot allocate memory
    virtual memory exhausted: Cannot allocate memory
    

    解决:创建虚拟内存或者增大实际的物理内存,并将所编译命令从make -j 替换为 make

    mkdir /opt/images/
    rm -rf /opt/images/swap
    dd if=/dev/zero of=/opt/images/swap bs=1024 count=6144000
    mkswap /opt/images/swap
    swapon /opt/images/swap
    

    3.

    错误:

    /home/rwz/OFFI_ORB/ORB_SLAM3/src/MLPnPsolver.cpp:394:11: error: ‘class Eigen::SparseMatrix<double>’ has no member named ‘setIdentity’
             P.setIdentity(); // standard
    

    解决:该函数只是将矩阵初始化I,可暂时屏蔽

    4.

    错误:

    error: no match for ‘operator/’ (operand types are ‘cv::Matx<float, 3, 1>’ and ‘float’) x3D = x3D_h.get_minor<3,1>(0,0) / x3D_h(3);
    

    解决:

    x3D = x3D_h.get_minor<3,1>(0,0) / x3D_h(3);
    

    改为:

    x3D = x3D_h.get_minor<3,1>(0,0) (1/x3D_h(3));
    

    5.

    错误:

    fatal error: boost/serialization/serialization.hpp: No such file or directory
    

    解决:

    sudo apt-get install libboost-dev
    

    6.

    错误:

    fatal error: openssl/md5.h: No such file or directory
    

    解决:

    sudo apt install libssl-dev
    
  • 相关阅读:
    Servlet 的生命周期
    关于JSP
    JQuery事件绑定
    JavaScript中操作元素
    javaScript的函数使用
    Servlet 的API
    JavaScript中BOM对象
    gridview 绑定时间列 取短日期
    A4纸网页打印中对应像素的设定和换算
    动态添加 控件 并获取值
  • 原文地址:https://www.cnblogs.com/Raowz/p/15109975.html
Copyright © 2020-2023  润新知