PnPL
PnPL copied to clipboard
Vector 4D not defined in the scope
I got several error message in pnpl.cpp. It seems that after the line typedef Eigen::Matrix<double,6,1,Eigen::ColMajor> Vector6D; Vector4D 3D 2D shoule also be defined.
After I fixed this, I got problems with the API of G2O. So I changed to link an early version G2O, and it is OK now.
/home/rick/SLAMProjects/PnPL/src/pnpl.cpp: In function ‘void PnPL(const std::vector<cv::Point3_
I was able to resolve this by comparing with the new g2o
api example here: https://github.com/RainerKuemmerle/g2o/blob/master/g2o/examples/ba/ba_demo.cpp
(along with adding missing typedefs for the Vector*D
types)
@matt-deboer I still cannot figure out how did you solve this problem. Can you explain more in details, please?
@zhangjun-xyz Did you sloved it, I meet it too and do not know what it is meaning. thank you
@Zedzou Sorry I don't focus on this project for a long time. But as a reminder I guess it's caused by wrong g2o version. You can check it. Hope this can help you. :)
// init g2o, the init func shuold match the g2o version
// I solved it by substituting old version init using new version
// my g2o is 20200410
// **********************old version(20170730_git) g2o solver init*******************************
g2o::BlockSolver_6_3::LinearSolverType * linearSolver;
linearSolver= new g2o::LinearSolverCSparse<g2o::BlockSolver_6_3::PoseMatrixType>();
g2o::BlockSolver_6_3 * solver_ptr = new g2o::BlockSolver_6_3(linearSolver);
g2o::OptimizationAlgorithmLevenberg* solver = new g2o::OptimizationAlgorithmLevenberg(solver_ptr);
// *******************************************************************************************
// **********************new version(20200410) g2o solver init*******************************
// ******************if you use new g2o, the construction function should match*************
typedef g2o::LinearSolverCSparse<g2o::BlockSolver_6_3::PoseMatrixType> LinearType;
auto linearSolver= std::unique_ptr<LinearType>(new LinearType);
auto solver_ptr = std::unique_ptr<g2o::BlockSolver_6_3>(new g2o::BlockSolver_6_3(std::move(linearSolver)));
auto solver = new g2o::OptimizationAlgorithmLevenberg( std::move(solver_ptr) );
// **********************************finally we can init the optimizer***************************
g2o::SparseOptimizer optimizer;
// optimizer.setVerbose(true);
optimizer.setAlgorithm(solver);
// *******************************************************************************************