编译ORBSLAM2_with_pointcloud_map的 g2o_with_orbslam2问题解决

场景:

编译高翔博士的ORBSLAM2_with_pointcloud_map
它的过程为:
Unzip the file you will find two directories. First compile the modified g2o:
cd g2o_with_orbslam2
mkdir build
cd build
cmake …
make
Following the instructions from the original g2o library: [https://github.com/RainerKuemmerle/g2o] if you have dependency problems. I just add the extra vertecies and edges provided in ORB_SLAM2 intog2o.
Then compile the ORB_SLAM2. You need firstly to compile the DBoW2 in ORB_SLAM2_modified/Thirdpary, and then the Pangolin module (https://github.com/stevenlovegrove/Pangolin). Finally, build ORB_SLAM2:
cd ORB_SLAM2_modified
mkdir build
cd build
cmake …
make
To run the program you also need to download the ORB vocabulary (which is a large file so I don’t upload it) in the original ORB_SLAM2 repository.


问题描述

编译g2o_with_orbslam2遇到的问题汇总以及解决方法
参考网页:
https://blog.csdn.net/weixin_39752599/article/details/86564808
https://www.cnblogs.com/wjx-zjut/p/7107217.html
https://blog.csdn.net/gaiyonghuming110/article/details/103245061
https://www.cnblogs.com/haijian/p/10788141.html

解决方案:

问题1

报错信息:
ORBSLAM2_with_pointcloud_map/orbslam2_modified/g2o_with_orbslam2/g2o/types/slam2d/edge_se2_pointxy_bearing.cpp: In member function ‘virtual void g2o::EdgeSE2PointXYBearing::initialEstimate(const VertexSet&, g2o::OptimizableGraph::Vertex*)’:
/home/robot/g2o/g2o/types/slam2d/edge_se2_pointxy_bearing.cpp:50:52: error: no matching function for call to ‘g2o::SE2::setRotation(Eigen::Rotation2D::Scalar)’
t.setRotation(t.rotation().angle()+_measurement);

处理方法:
In g2o/types/slam2d/edge_se2_pointxy_bearing.cpp
change:
t.setRotation(t.rotation().angle()+_measurement);
to
t.setRotation((Eigen::Rotation2Dd)(t.rotation().angle()+_measurement));

问题2:

报错信息:
/usr/include/eigen3/Eigen/src/Core/util/StaticAssert.h:32: 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);

处理方法:
打开g2o/solvers/linear_solver_eigen.h,将以下代码:
template
class LinearSolverEigen: public LinearSolver
{
public:
typedef Eigen::SparseMatrix<double, Eigen::ColMajor> SparseMatrix;
typedef Eigen::Triplet Triplet;
typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, SparseMatrix::Index> PermutationMatrix;
改成
template
class LinearSolverEigen: public LinearSolver
{
public:
typedef Eigen::SparseMatrix<double, Eigen::ColMajor> SparseMatrix;
typedef Eigen::Triplet Triplet;
typedef Eigen::PermutationMatrix<Eigen::Dynamic, Eigen::Dynamic, int> PermutationMatrix;

问题3:

报错信息:
MatrixExponential’ is not a member of ‘Eigen’

处理方法:
// bigB = expm(bigA)
//Eigen::MatrixExponential me(bigA);
//me.compute(bigB);
bigB = bigA.exp();
前三行代码注释掉,添加最后一行

问题4:

报错信息:
ORBSLAM2_with_pointcloud_map/orbslam2_modified/g2o_with_orbslam2/g2o/examples/tutorial_slam2d/simulator.cpp:80:39: required from here
/usr/include/eigen3/Eigen/src/Core/util/StaticAssert.h:32:40: error: static assertion failed: FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED
#define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG);

处理方法:
g2o/g2o/examples/tutorial_slam2d/simulator.cpp: 80行
VectorXd probLimits(MO_NUM_ELEMS); —>>>
VectorXd probLimits; probLimits.resize(MO_NUM_ELEMS);

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值