g2o
(base) wys@wys-pc:~/slam/test/testg2o/build$ cmake ..
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so
-- Found installed version of Eigen: /usr/lib/cmake/eigen3
-- Found required Ceres dependency: Eigen version 3.3.4 in /usr/include/eigen3
-- Found required Ceres dependency: glog
-- Found installed version of gflags: /usr/lib/x86_64-linux-gnu/cmake/gflags
-- Detected gflags version: 2.2.1
-- Found required Ceres dependency: gflags
-- Found Ceres version: 1.13.0 installed in: /usr with components: [LAPACK, SuiteSparse, SparseLinearAlgebraLibrary, CXSparse, SchurSpecializations, OpenMP]
-- Configuring done
-- Generating done
-- Build files have been written to: /home/wys/slam/test/testg2o/build
(base) wys@wys-pc:~/slam/test/testg2o/build$ make
Scanning dependencies of target g2o_test
[ 50%] Building CXX object CMakeFiles/g2o_test.dir/g2o_test.cpp.o
In file included from /usr/local/include/g2o/core/base_fixed_sized_edge.h:292:0,
from /usr/local/include/g2o/core/base_binary_edge.h:30,
from /usr/local/include/g2o/types/slam3d/edge_se3.h:30,
from /home/wys/slam/test/testg2o/g2o_test.cpp:11:
/usr/local/include/g2o/core/base_fixed_sized_edge.hpp: In instantiation of ‘void g2o::BaseFixedSizedEdge<D, E, VertexTypes>::linearizeOplusN() [with int N = 0; int D = 3; E = Eigen::Matrix<double, 3, 1>; VertexTypes = {g2o::VertexSE3Expmap}]’:
/usr/local/include/g2o/core/base_fixed_sized_edge.hpp:192:41: required from ‘void g2o::BaseFixedSizedEdge<D, E, VertexTypes>::linearizeOplusNs(std::index_sequence<Ints ...>) [with long unsigned int ...Ints = {0}; int D = 3; E = Eigen::Matrix<double, 3, 1>; VertexTypes = {g2o::VertexSE3Expmap}; std::index_sequence<Ints ...> = std::integer_sequence<long unsigned int, 0>]’
/usr/local/include/g2o/core/base_fixed_sized_edge.hpp:200:19: required from ‘void g2o::BaseFixedSizedEdge<D, E, VertexTypes>::linearizeOplus() [with int D = 3; E = Eigen::Matrix<double, 3, 1>; VertexTypes = {g2o::VertexSE3Expmap}]’
/home/wys/slam/test/testg2o/g2o_test.cpp:104:1: required from here
/usr/local/include/g2o/core/base_fixed_sized_edge.hpp:166:14: error: ‘FixedArray {aka class ceres::internal::FixedArray<double, 6>}’ has no member named ‘fill’
add_vertex.fill(0.);
~~~~~~~~~~~^~~~
/usr/local/include/g2o/core/base_fixed_sized_edge.hpp:173:30: error: ‘FixedArray {aka class ceres::internal::FixedArray<double, 6>}’ has no member named ‘data’
vertex->oplus(add_vertex.data());
~~~~~~~~~~~^~~~
/usr/local/include/g2o/core/base_fixed_sized_edge.hpp:179:30: error: ‘FixedArray {aka class ceres::internal::FixedArray<double, 6>}’ has no member named ‘data’
vertex->oplus(add_vertex.data());
~~~~~~~~~~~^~~~
CMakeFiles/g2o_test.dir/build.make:62: recipe for target 'CMakeFiles/g2o_test.dir/g2o_test.cpp.o' failed
make[2]: *** [CMakeFiles/g2o_test.dir/g2o_test.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/g2o_test.dir/all' failed
make[1]: *** [CMakeFiles/g2o_test.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
解决:
https://blog.csdn.net/weixin_44023934/article/details/122112827
g2o的
cmakelists.txt
https://blog.csdn.net/weixin_43011182/article/details/118878559
# 部分
include_directories("/usr/include/suitesparse") #cs.h文件的地址
INCLUDE_DIRECTORIES(${g20_INCLUDE_DIRS} ${Sophus_INLCUDE_DIRS}${Ceres_INCLUDE_DIRS})
SET(G2O_LIBS "/usr/local/lib/libg2o_csparse_extension.so" "/usr/local/lib/libg2o_stuff.so" "/usr/local/lib/libg2o_core.so" cxsparse)
原文链接:https://blog.csdn.net/weixin_43011182/article/details/118878559
s
svo的g2o版本:cmakelists.txt
# Add g2o if available
# g2o version g2o-20160424_git
IF(HAVE_G2O)
#set(G2O_DIR "/home/wys/pkg/g2o/g2o/install/lib/cmake/g2o")
#set(G2O_DIR "/home/wys/slam/SVO/ws/g2o-20160424_git/install")
# FIND_PACKAGE(G2O REQUIRED)
INCLUDE_DIRECTORIES(
"/home/wys/slam/SVO/ws/g2o-20160424_git/install/include"
"/usr/include/suitesparse" # for cholmod
)
LIST(APPEND LINK_LIBS
"/home/wys/slam/SVO/ws/g2o-20160424_git/install/lib/libg2o_csparse_extension.so"
"/home/wys/slam/SVO/ws/g2o-20160424_git/install/lib/libg2o_core.so"
"/home/wys/slam/SVO/ws/g2o-20160424_git/install/lib/libg2o_stuff.so"
"/home/wys/slam/SVO/ws/g2o-20160424_git/install/lib/libg2o_solver_csparse.so"
"/home/wys/slam/SVO/ws/g2o-20160424_git/install/lib/libg2o_solver_dense.so"
"/home/wys/slam/SVO/ws/g2o-20160424_git/install/lib/libg2o_solver_pcg.so"
"/home/wys/slam/SVO/ws/g2o-20160424_git/install/lib/libg2o_types_sba.so"
cholmod cxsparse
)
LIST(APPEND SOURCEFILES src/bundle_adjustment.cpp)
ENDIF(HAVE_G2O)