g2o
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
g2o
examples
slam2d
slam2d_g2o.cpp
Go to the documentation of this file.
1
// g2o - General Graph Optimization
2
// Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard
3
//
4
// This file is part of g2o.
5
//
6
// g2o is free software: you can redistribute it and/or modify
7
// it under the terms of the GNU General Public License as published by
8
// the Free Software Foundation, either version 3 of the License, or
9
// (at your option) any later version.
10
//
11
// g2o is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
15
//
16
// You should have received a copy of the GNU General Public License
17
// along with g2o. If not, see <http://www.gnu.org/licenses/>.
18
19
#include <iostream>
20
21
#include "
main_window.h
"
22
23
#include "
g2o/core/sparse_optimizer.h
"
24
#include "
g2o/core/block_solver.h
"
25
#include "
g2o/core/factory.h
"
26
#include "
g2o/core/optimization_algorithm_gauss_newton.h
"
27
#include "
g2o/core/optimization_algorithm_levenberg.h
"
28
#include "
g2o/solvers/csparse/linear_solver_csparse.h
"
29
30
#include <QApplication>
31
using namespace
std
;
32
using namespace
g2o
;
33
34
G2O_USE_TYPE_GROUP
(slam2d);
35
36
int
main
(
int
argc,
char
** argv)
37
{
38
QApplication qapp(argc, argv);
39
40
MainWindow
mw;
41
mw.show();
42
43
mw.viewer->graph =
new
SparseOptimizer
();
44
45
typedef
BlockSolver
<
BlockSolverTraits
<-1, -1> > SlamBlockSolver;
46
typedef
LinearSolverCSparse<SlamBlockSolver::PoseMatrixType>
SlamLinearSolver;
47
48
SlamLinearSolver* linearSolver =
new
SlamLinearSolver();
49
linearSolver->setBlockOrdering(
false
);
50
SlamBlockSolver* blockSolver =
new
SlamBlockSolver(linearSolver);
51
52
OptimizationAlgorithmGaussNewton
* solverGauss =
new
OptimizationAlgorithmGaussNewton
(blockSolver);
53
OptimizationAlgorithmLevenberg
* solverLevenberg =
new
OptimizationAlgorithmLevenberg
(blockSolver);
54
mw.
solverGaussNewton
= solverGauss;
55
mw.
solverLevenberg
= solverLevenberg;
56
mw.viewer->graph->setAlgorithm(solverGauss);
57
58
return
qapp.exec();
59
}
MainWindow::solverGaussNewton
g2o::OptimizationAlgorithm * solverGaussNewton
Definition:
main_window.h:35
main
int main(int argc, char **argv)
Definition:
slam2d_g2o.cpp:36
g2o::OptimizationAlgorithmLevenberg
Implementation of the Levenberg Algorithm.
Definition:
optimization_algorithm_levenberg.h:38
std
g2o::BlockSolverTraits
traits to summarize the properties of the fixed size optimization problem
Definition:
block_solver.h:43
g2o::OptimizationAlgorithmGaussNewton
Implementation of the Gauss Newton Algorithm.
Definition:
optimization_algorithm_gauss_newton.h:38
optimization_algorithm_gauss_newton.h
g2o
Definition:
dl_wrapper.cpp:54
sparse_optimizer.h
g2o::LinearSolverCSparse
linear solver which uses CSparse
Definition:
linear_solver_csparse.h:71
g2o::SparseOptimizer
class G2O_CORE_API SparseOptimizer
Definition:
optimization_algorithm_factory.h:47
main_window.h
factory.h
block_solver.h
MainWindow::solverLevenberg
g2o::OptimizationAlgorithm * solverLevenberg
Definition:
main_window.h:36
g2o::BlockSolver
Implementation of a solver operating on the blocks of the Hessian.
Definition:
block_solver.h:96
linear_solver_csparse.h
G2O_USE_TYPE_GROUP
G2O_USE_TYPE_GROUP(slam2d)
optimization_algorithm_levenberg.h
MainWindow
main window of the g2o viewer
Definition:
main_window.h:40
Generated on Mon Mar 18 2019 20:14:38 for g2o by
1.8.11