G2o pointer error
1. Problem description I
error: no matching function for call to ‘g2o::BlockSolver<g2o::BlockSolverTraits<-1, -1> >::BlockSolver(SlamLinearSolver*&)
And prompt
std::unique_ptr
The reason for the pointer may be a repeated reference.
G2oSolver::G2oSolver()
{
// Step 1: Create a linear solver LinearSolver
SlamLinearSolver *linearSolver = new SlamLinearSolver();
linearSolver->setBlockOrdering(false);
// Step 2: Create the BlockSolver and initialize it with the linear solver defined above
SlamBlockSolver *blockSolver = new SlamBlockSolver(linearSolver);
// Step 3: Create the total solver solver and select one from GN, LM, DogLeg and initialize it with the block solver BlockSolver defined above
g2o::OptimizationAlgorithmLevenberg *solver = new g2o::OptimizationAlgorithmLevenberg(blockSolver);
// Step 4: Create the sparse optimizer (SparseOptimizer)
mOptimizer.setAlgorithm(solver);
}
Modified code:
G2oSolver::G2oSolver()
{
// Step 1: Create a linear solver LinearSolver
SlamLinearSolver *linearSolver = new SlamLinearSolver();
linearSolver->setBlockOrdering(false);
// Step 2: Create the BlockSolver and initialize it with the linear solver defined above
SlamBlockSolver *blockSolver=new SlamBlockSolver(std::unique_ptr<SlamLinearSolver>(linearSolver));
// Step 3: Create the total solver solver and select one from GN, LM, DogLeg and initialize it with the above block solver BlockSolver
g2o::OptimizationAlgorithmLevenberg *solver = new g2o::OptimizationAlgorithmLevenberg(std::unique_ptr<SlamBlockSolver>( blockSolver));
// Step 4: Create the Sparse Optimizer (SparseOptimizer)
mOptimizer.setAlgorithm(solver);
}
2. Problem description II
fatal error: cs.h: No such file or directory
the error is in /usr/local/include/g2o/solvers/csparse/csparse_extension.h:
#include <cs.h>
Install
CSparse
sudo apt-get install libsuitesparse-dev
Find the header file
/usr/include/suitesparse/cs.h
add the header files in CMakeLists.txt:
include_directories("/usr/include/suitesparse")
target_link_libraries(${PROJECT_NAME}_karto_slam_node
${catkin_LIBRARIES}
${Boost_LIBRARIES}
sba
${CERES_LIBRARIES}
gtsam
${G2O_LIBRARIES}
${SUITESPARSE_LIBRARIES}
)
Read More:
- [Solved] RK3568-ANDROID11-BOARD_HAVE_DONGLE ERROR (3G/4G)
- [Solved] QT Programme Error: error: no matching function for call to…
- Qt error: no matching function for call to ‘MainWindow::connect(QAction*&, void (QAction::*)
- Keil Compile Error: ..\OBJ\USART.axf: error: L6002U: Could not open file ..\obj\sys.o: No such file or directory
- Buffer I/O Error in /var/log/messages
- g++: internal compiler error: Killed (program cc1plus) Please submit a full bug report, with preprocess
- PLSQL even oracle11g problem on 64-bit machine: SQL*Net not properly installed and ORA-12154:TNS: cannot handle service name
- [Solved] Error: L6218E: Undefined symbol vApplicationGetIdleTaskMemory (referred from tasks.o).
- [Solved] ANTRL Compile HiveLexer.g File Error: syntax error: antlr: NoViableAltException(@[])
- [Solved] Error: Undefined symbol DMA_Cmd (referred from dac.o)
- [Solved] KEIL Run Error: \KEY.axf: Error: L6218E: Undefined symbol EXTI_ClearITPendingBit (referred from exit.o).
- ORB-SLAM3 Compile Error: recipe for target ‘CMakeFiles/ORB_SLAM3.dir/src/LocalMapping.cc.o‘ failed
- [Solved] Tensorflow2.0 Error: Function call stack:distributed_function
- AIX 11G Rac Startup Error: CLSU-00100,CLSU-00101,CLSU-00103,CLSU-00104,CRS-4000
- [Solved] VScode Error: PS D:\vscode> cd “d:\vscode\“ ; if ($?) { g++ tempCodeRunnerFile.cpp -o tempCodeRunn
- [Solved] keil2 Error: FATAL ERROR L210: I/O ERROR ON INPUT FILE
- Spring-boot Use dubbo Error: ERROR 8404 o.s.boot.SpringApplication:Application run failed
- [Solved] kernel: nvme nvme0: I/O xxx QID xxx timeout, aborting
- How to Fix msgsend() error: to many arguments to function call, expected 0, have2
- [Solved] Compilation error: dereferencing pointer to incomplete type…