gaoxiang12/ygz-stereo-inertial

安装时候g2o相关函数报错

Sunchanghao opened this issue · 5 comments

报错信息如下
/home/sch/GAAS/software/SLAM/ygz_slam_ros/backend/src/BackendSlidingWindowG2O.cpp:448:103: error: no matching function for call to ‘g2o::BlockSolver<g2o::BlockSolverTraits<-1, -1> >::BlockSolver(std::remove_reference<std::unique_ptr<g2o::LinearSolver<Eigen::Matrix<double, -1, -1> > >&>::type)’
std::unique_ptr g2o::BlockSolverX solver_ptr (new g2o::BlockSolverX( std::move(linearSolver)));
^
In file included from /usr/local/include/g2o/core/block_solver.h:189:0,
from /home/sch/GAAS/software/SLAM/ygz_slam_ros/backend/src/BackendSlidingWindowG2O.cpp:11:
/usr/local/include/g2o/core/block_solver.hpp:39:1: note: candidate: g2o::BlockSolver::BlockSolver(g2o::BlockSolver::LinearSolverType*) [with Traits = g2o::BlockSolverTraits<-1, -1>; g2o::BlockSolver::LinearSolverType = g2o::LinearSolver<Eigen::Matrix<double, -1, -1> >]
BlockSolver::BlockSolver(LinearSolverType* linearSolver) :
^
/usr/local/include/g2o/core/block_solver.hpp:39:1: note: no known conversion for argument 1 from ‘std::remove_reference<std::unique_ptr<g2o::LinearSolver<Eigen::Matrix<double, -1, -1> > >&>::type {aka std::unique_ptr<g2o::LinearSolver<Eigen::Matrix<double, -1, -1> > >}’ to ‘g2o::BlockSolver<g2o::BlockSolverTraits<-1, -1> >::LinearSolverType* {aka g2o::LinearSolver<Eigen::Matrix<double, -1, -1> >}’
/home/sch/GAAS/software/SLAM/ygz_slam_ros/backend/src/BackendSlidingWindowG2O.cpp:450:116: error: no matching function for call to ‘g2o::OptimizationAlgorithmLevenberg::OptimizationAlgorithmLevenberg(std::remove_reference<std::unique_ptr<g2o::BlockSolver<g2o::BlockSolverTraits<-1, -1> > >&>::type)’
g2o::OptimizationAlgorithmLevenberg solver = new g2o::OptimizationAlgorithmLevenberg(std::move(solver_ptr));
^
In file included from /home/sch/GAAS/software/SLAM/ygz_slam_ros/backend/src/BackendSlidingWindowG2O.cpp:13:0:
/usr/local/include/g2o/core/optimization_algorithm_levenberg.h:45:16: note: candidate: g2o::OptimizationAlgorithmLevenberg::OptimizationAlgorithmLevenberg(g2o::Solver
)
explicit OptimizationAlgorithmLevenberg(Solver
solver);
^
/usr/local/include/g2o/core/optimization_algorithm_levenberg.h:45:16: note: no known conversion for argument 1 from ‘std::remove_reference<std::unique_ptr<g2o::BlockSolver<g2o::BlockSolverTraits<-1, -1> > >&>::type {aka std::unique_ptr<g2o::BlockSolver<g2o::BlockSolverTraits<-1, -1> > >}’ to ‘g2o::Solver*’
/home/sch/GAAS/software/SLAM/ygz_slam_ros/backend/src/BackendSlidingWindowG2O.cpp: In member function ‘void ygz::BackendSlidingWindowG2O::LocalBAWithoutIMU(bool)’:
/home/sch/GAAS/software/SLAM/ygz_slam_ros/backend/src/BackendSlidingWindowG2O.cpp:668:103: error: no matching function for call to ‘g2o::BlockSolver<g2o::BlockSolverTraits<-1, -1> >::BlockSolver(std::remove_reference<std::unique_ptr<g2o::LinearSolver<Eigen::Matrix<double, -1, -1> > >&>::type)’
std::unique_ptr g2o::BlockSolverX solver_ptr (new g2o::BlockSolverX( std::move(linearSolver)) );

下面还有很长都是类似的报错
看起来可能是版本问题
请教一下如何修改
谢谢

解决了 GAAS的项目是基于这个修改的 他们使用了DBOW3 所以g2o需要使用最新版本

@Sunchanghao 所以您是又下载了最新版本的g2o库运行的吗?而不是使用他们project中的g2o?

@ns15417 对 是这样的

@Sunchanghao 您还保存有对应的g2o链接吗?看到有人说用salm14讲里面的g2o,我在高博的slambook2里面找到了这个:https://github.com/RainerKuemmerle/g2o/tree/9b41a4ea5ade8e1250b9c1b279f3a9c098811b5a
不知道您用的是这个版本的g2o吗?
O(∩_∩)O谢谢

@ns15417 我是去g20官方git的最新版本 没有用高博提供的