tum-vision / dvo_slam

Dense Visual Odometry and SLAM
631 stars 306 forks source link

cant find function from the g2o package when compiling dvo_slam #64

Open geoeo opened 5 years ago

geoeo commented 5 years ago

Hello,

Apparently the function headers of g2o have changed since dvo_slam was published? Can anybody confirm or deny this? / Had this problem?

The compile error is:

/home/marc/Workspace/ROS/tum_ros/src/dvo_slam/dvo_slam/src/keyframe_graph.cpp: In constructor ‘dvo_slam::internal::KeyframeGraphImpl::KeyframeGraphImpl()’:
/home/marc/Workspace/ROS/tum_ros/src/dvo_slam/dvo_slam/src/keyframe_graph.cpp:140:5: error: no matching function for call to ‘g2o::BlockSolver<g2o::BlockSolverTraits<6, 3> >::BlockSolver(dvo_slam::internal::KeyframeGraphImpl::LinearSolver*)’
     )));
     ^
In file included from /usr/local/include/g2o/core/block_solver.h:199:0,
                 from /home/marc/Workspace/ROS/tum_ros/src/dvo_slam/dvo_slam/src/keyframe_graph.cpp:48:
/usr/local/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> >]
 BlockSolver<Traits>::BlockSolver(std::unique_ptr<LinearSolverType> linearSolver)
 ^
/usr/local/include/g2o/core/block_solver.hpp:40:1: note:   no known conversion for argument 1 from ‘dvo_slam::internal::KeyframeGraphImpl::LinearSolver* {aka g2o::LinearSolverEigen<Eigen::Matrix<double, 6, 6> >*}’ to ‘std::unique_ptr<g2o::LinearSolver<Eigen::Matrix<double, 6, 6> >, std::default_delete<g2o::LinearSolver<Eigen::Matrix<double, 6, 6> > > >’

Do I have to roll back my g2o verison?

RigerLee commented 5 years ago

If you use the latest g2o, the following codes should work : Modify codes below // g2o setup

std::unique_ptr<BlockSolver::LinearSolverType> linearSolver = g2o::make_unique<LinearSolver>();
std::unique_ptr <BlockSolver> block_solver ( new BlockSolver( std::move(linearSolver)) );
keyframegraph_.setAlgorithm(
    new g2o::OptimizationAlgorithmDogleg(
        std::move(block_solver)
    )
);