Ubuntu   发布时间:2022-05-10  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Ubuntu16.04下编译ORB_SLAM2错误大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

到Ubuntu16.04下编译ORB_SLAM2报错,提示:

/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:745:3:error: static assertion Failed:YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY
  EIGEN_checK_BINARY_COMPATIBILIY(Func,typename ActualDstTypeCleaned::Scalar,typename Src::Scalar);

/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h: In instantiation of ‘void Eigen::internal::call_assignment_no_alias(Dst&,const Src&,const Func&) [with Dst = Eigen::Matrix<int,-1,1>; Src = Eigen::Matrix<long int,1,1>; Func = Eigen::internal::assign_op<int>]’:
/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:712:27: required from ‘void Eigen::internal::call_assignment(Dst&,const Func&,typename Eigen::internal::enable_if<(! Eigen::internal::evaluator_assume_aliasing<Src>::value),void*>::typE) [with Dst = Eigen::Matrix<int,1>; Func = Eigen::internal::assign_op<int>; typename Eigen::internal::enable_if<(! Eigen::internal::evaluator_assume_aliasing<Src>::value),void*>::type = void*]’
/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:693:18: required from ‘void Eigen::internal::call_assignment(Dst&,const Src&) [with Dst = Eigen::Matrix<int,1>]’
/usr/include/eigen3/Eigen/src/Core/PlainObjectBase.h:682:32: required from ‘Derived& Eigen::PlainObjectBase<Derived>::_set(const Eigen::DenseBase<OtherDerived>&) [with OtherDerived = Eigen::Matrix<long int,1>; Derived = Eigen::Matrix<int,1>]’
/usr/include/eigen3/Eigen/src/Core/Matrix.h:225:24: required from ‘Eigen::Matrix<_Scalar,_Rows,_Cols,_Options,_MaxRows,_MaxCols>& Eigen::Matrix<_Scalar,_MaxCols>::operator=(const Eigen::DenseBase<OtherDerived>&) [with OtherDerived = Eigen::Matrix<long int,1>; _Scalar = int; int _Rows = -1; int _Cols = 1; int _Options = 0; int _MaxRows = -1; int _MaxCols = 1]’
/usr/include/eigen3/Eigen/src/Core/PermutationMatrix.h:367:17: required from ‘Eigen::PermutationMatrix<SizeAtCompileTime,MaxSizeAtCompileTime,IndexType>& Eigen::PermutationMatrix<SizeAtCompileTime,IndexType>::operator=(const Eigen::PermutationBase<OtherDerived>&) [with Other = Eigen::PermutationMatrix<-1,long int>; int SizeAtCompileTime = -1; int MaxSizeAtCompileTime = -1; _StorageIndex = int]’
/home/armmlinux/zdfwork/work/SLAM/orb_slam/ORB_SLAM2-master/Thirdparty/g2o/g2o/solvers/linear_solver_eigen.h:68:18: required from ‘void g2o::LinearSolverEigen<MatrixType>::CholeskyDecomposition::analyzePatternWithPermutation(g2o::LinearSolverEigen<MatrixType>::SparseMatrix&,const PermutationMatrix&) [with MatrixType = Eigen::Matrix<double,7,7>; g2o::LinearSolverEigen<MatrixType>::SparseMatrix = Eigen::SparseMatrix<double,0>; g2o::LinearSolverEigen<MatrixType>::PermutationMatrix = Eigen::PermutationMatrix<-1,long int>]’
/home/armmlinux/zdfwork/work/SLAM/orb_slam/ORB_SLAM2-master/Thirdparty/g2o/g2o/solvers/linear_solver_eigen.h:195:9: required from ‘void g2o::LinearSolverEigen<MatrixType>::computeSymbolicDecomposition(const g2o::SparseBlockMatrix<MatrixType>&) [with MatrixType = Eigen::Matrix<double,7>]’
/home/armmlinux/zdfwork/work/SLAM/orb_slam/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>]’
/home/armmlinux/zdfwork/work/SLAM/orb_slam/ORB_SLAM2-master/src/Optimizer.cc:1244:1: required from here
/usr/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);
^
/usr/include/eigen3/Eigen/src/Core/util/XprHelper.h:707:3: note: in expansion of macro ‘EIGEN_STATIC_ASSERT’
EIGEN_STATIC_ASSERT((internal::functor_is_product_like<BInop>::ret \
^
/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:745:3: note: in expansion of macro ‘EIGEN_checK_BINARY_COMPATIBILIY’
EIGEN_checK_BINARY_COMPATIBILIY(Func,typename Src::Scalar);
^
CMakeFiles/ORB_SLAM2.dir/build.make:350: recipe for target 'CMakeFiles/ORB_SLAM2.dir/src/Optimizer.cc.o' Failed
make[2]: *** [CMakeFiles/ORB_SLAM2.dir/src/Optimizer.cc.o] Error 1
CMakeFiles/Makefile2:178: recipe for target 'CMakeFiles/ORB_SLAM2.dir/all' Failed
make[1]: *** [CMakeFiles/ORB_SLAM2.dir/all] Error 2
Makefile:83: recipe for target 'all' Failed
@H_806_33@make: *** [all] Error 2


问题原因: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>
public LinearSolver<MatrixType>
3 {
public:
:1.5; color:rgb(128,Eigen::ColMajor> SparseMatrix;
double> Triplet;
8     typedef Eigen::PermutationMatrix<Eigen::Dynamic,int> PermutationMatrix;
9     /**

大佬总结

以上是大佬教程为你收集整理的Ubuntu16.04下编译ORB_SLAM2错误全部内容,希望文章能够帮你解决Ubuntu16.04下编译ORB_SLAM2错误所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: