Ask Your Question

Simontraww's profile - activity

2019-05-31 21:40:26 -0600 received badge  Famous Question (source)
2019-05-31 21:40:26 -0600 received badge  Notable Question (source)
2019-05-31 21:40:26 -0600 received badge  Popular Question (source)
2018-08-27 03:12:10 -0600 marked best answer G2O BlockSolver Initialization Crash on Unix System

I have a project which possesses and uses G2O library, it runs on both platforms(win/Unix).

(WINDOW PASSED / UNIX CRASHED)

We can see in both platforms, these lines:

g2o::SparseOptimizer optimizer;
g2o::BlockSolver_6_3::LinearSolverType * linearSolver;

linearSolver = new g2o::LinearSolverDense<g2o::BlockSolver_6_3::PoseMatrixType>();

Next steps, in window os we have this:

g2o::BlockSolver_6_3 * solver_ptr = new g2o::BlockSolver_6_3(linearSolver);
g2o::OptimizationAlgorithmLevenberg* solver = new g2o::OptimizationAlgorithmLevenberg(solver_ptr);

But Unix system can't compile those lines because it says

my_file_G2o.cpp: In member function 'int *Refiner_G2O::refinePose(cv::Mat&, const std::vector<cv::point3_<float> >&, const std::vector<cv::keypoint>&, const cv::Mat&, float, std::vector<int>&)': my_file_G2o.cpp --> no matching function for call to 'g2o::BlockSolver<g2o::blocksolvertraits&lt;6, 3="">::BlockSolver(g2o::BlockSolver<g2o::blocksolvertraits&lt;6, 3="">::LinearSolverType&)'* ^ In file included from G2o/include/g2o/core/block_solver.h:199:0, G2o/include/g2o/core/block_solver.hpp:40:1: note: candidate: g2o::BlockSolver<traits>::BlockSolver(std::unique_ptr<typename traits::linearsolvertype="">) [with Traits = g2o::BlockSolverTraits<6, 3>; typename Traits::LinearSolverType = g2o::LinearSolver<eigen::matrix<double, 6,="" 6,="" 0=""> >] BlockSolver<traits>::BlockSolver(std::unique_ptr<linearsolvertype> linearSolver)

When I see these errors, I complete my Unix code with this new block

auto solver_ptr = g2o::make_unique<g2o::BlockSolver_6_3>(linearSolver); // [SEGFAULT LINE]
auto solver = g2o::make_unique<g2o::OptimizationAlgorithmLevenberg>(solver_ptr);
optimizer.setAlgorithm(solver.get());

So now, I can build/run but I meet a segfault on the line with [SEGFAULT LINE] tag.

I don't understand, why? if someone has an idea I want to understand how in Window it works and not in Unix system, will feel wonderful if you help.

LINUX Version: Ubuntu 16.04
CMAKE Version: 3.11.4

Best regards,

2018-08-03 06:50:50 -0600 answered a question G2O BlockSolver Initialization Crash on Unix System

SOLVED: G2O optimise: g2o::SparseOptimizer optimizer; auto linearSolver = std::make_unique<g2o::LinearSolverDense&

2018-08-02 06:48:18 -0600 asked a question G2O BlockSolver Initialization Crash on Unix System

G2O BlockSolver Initialization Crash on Unix System I have a project which possesses and uses G2O library, it runs on bo