安装使用orb_slam2是遇到的问题与解决

问题1. eigen3找不到

在运行./biuld.sh时,报错

CMake Error at /usr/local/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find Eigen3 (missing: EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
  (Required is at least version "3.1.0")
Call Stack (most recent call first):
  /usr/local/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  cmake_modules/FindEigen3.cmake:82 (find_package_handle_standard_args)
  CMakeLists.txt:70 (FIND_PACKAGE)

解决方法是指定eigen3的安装路径,即修改orb_slam2和g2o文件夹下的CMakeLists.txt

两者修改后如下:

# include(/home/wang/software/opencv/opencv-3.2.0.bin/OpenCVConfig.cmake)
include(/usr/local/share/OpenCV/OpenCVConfig.cmake)
include_directories("/usr/include/eigen3")

# find_package(Eigen3 3.1.0 REQUIRED)
find_package(Pangolin REQUIRED)

include_directories(
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/include
# ${EIGEN3_INCLUDE_DIR}
${Pangolin_INCLUDE_DIRS}
)

-------------------

# 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/include/eigen3")

问题2.报错如下:

 error: 'usleep' was not declared in this scope
         usleep(3000);

解决方法:缺失头文件,在orb_slam2的include下任意.h文件中(如KeyFrame.h)添加头文件unistd.h

你可能感兴趣的:(安装使用orb_slam2是遇到的问题与解决)