ORB SLAM2 UBUNTU16.04 build error

    xiaoxiao2021-11-23  47

    ORBSLAM2 build OK on 14.04, but after migration to Ubuntu16.04, ORB Slam2 meet 2 build errors:

    Error 1,

    /home/larry/Downloads/larry/ORB_SLAM2-master/Thirdparty/g2o/g2o/solvers/linear_solver_eigen.h:100:37:   required from ‘bool g2o::LinearSolverEigen<MatrixType>::solve(const g2o::SparseBlockMatrix<MatrixType>&, double*, double*) [with MatrixType = Eigen::Matrix<double, 7, 7, 0, 7, 7>]’ /home/larry/Downloads/larry/ORB_SLAM2-master/src/Optimizer.cc:1244:1:   required from here /usr/local/include/eigen3/Eigen/src/Core/util/StaticAssert.h:32:40: error: static assertion failed: YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY      #define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG);

    solution:  from: http://www.cnblogs.com/shishiteng/p/5799406.html

    Eigen3的bug

    解决方法: 打开Thirdparty/g2o/g2o/solvers/linear_solver_eigen.h,将以下代码 1 template <typename MatrixType> 2 class LinearSolverEigen: public LinearSolver<MatrixType> 3 { 4 public: 5 typedef Eigen::SparseMatrix<double, Eigen::ColMajor> SparseMatrix; 6 typedef Eigen::Triplet<double> Triplet; 7 typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, SparseMatrix::Index> PermutationMatrix;

    改为

    1 template <typename MatrixType> 2 class LinearSolverEigen: public LinearSolver<MatrixType> 3 { 4 public: 5 typedef Eigen::SparseMatrix<double, Eigen::ColMajor> SparseMatrix; 6 typedef Eigen::Triplet<double> Triplet; 8 typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, int> PermutationMatrix; 9 /** Error2:

    /home/larry/Downloads/larry/ORB_SLAM2-master/src/Tracking.cc: In member function ‘void ORB_SLAM2::Tracking::Reset()’: /home/larry/Downloads/larry/ORB_SLAM2-master/src/Tracking.cc:1510:20: error: ‘usleep’ was not declared in this scope          usleep(3000);

    Solution:

    Modify ORB_SLAM2-master/include/system.h, add "#include <unistd.h>" in header.

    #ifndef SYSTEM_H #define SYSTEM_H #include <unistd.h>

    Then everything OK.

    转载请注明原文地址: https://ju.6miu.com/read-678466.html

    最新回复(0)