问题描述:
error: no matching function for call to ‘g2o::BlockSolver<g2o::BlockSolverTraits<-1, -1> >::BlockSolver(roborts_local_planner::TebLinearSolver*&)’
TebBlockSolver* blockSolver = new TebBlockSolver(linearSolver);
...
...
error: no matching function for call to ‘g2o::OptimizationAlgorithmLevenberg::OptimizationAlgorithmLevenberg(roborts_local_planner::TebBlockSolver*&)’
g2o::OptimizationAlgorithmLevenberg* solver = new g2o::OptimizationAlgorithmLevenberg(blockSolver);
解决办法:
代码修改为:
boost::shared_ptr<g2o::SparseOptimizer> optimizer = boost::make_shared<g2o::SparseOptimizer>();
TebLinearSolver* linearSolver = new TebLinearSolver();
linearSolver->setBlockOrdering(true);
TebBlockSolver* blockSolver = new TebBlockSolver(std::unique_ptr<TebLinearSolver>(linearSolver));
g2o::OptimizationAlgorithmLevenberg* solver = new g2o::OptimizationAlgorithmLevenberg(std::unique_ptr<TebBlockSolver>(blockSolver));