00001 // g2o - General Graph Optimization 00002 // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard 00003 // 00004 // This file is part of g2o. 00005 // 00006 // g2o is free software: you can redistribute it and/or modify 00007 // it under the terms of the GNU General Public License as published by 00008 // the Free Software Foundation, either version 3 of the License, or 00009 // (at your option) any later version. 00010 // 00011 // g2o is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU General Public License 00017 // along with g2o. If not, see <http://www.gnu.org/licenses/>. 00018 00019 #include <iostream> 00020 00021 #include "main_window.h" 00022 00023 #include "g2o/core/graph_optimizer_sparse.h" 00024 #include "g2o/core/block_solver.h" 00025 #include "g2o/solvers/csparse/linear_solver_csparse.h" 00026 00027 #include <QApplication> 00028 using namespace std; 00029 using namespace g2o; 00030 00031 int main(int argc, char** argv) 00032 { 00033 QApplication qapp(argc, argv); 00034 00035 MainWindow mw; 00036 mw.show(); 00037 00038 mw.viewer->graph = new SparseOptimizer(); 00039 00040 typedef BlockSolver< BlockSolverTraits<-1, -1> > SlamBlockSolver; 00041 typedef LinearSolverCSparse<SlamBlockSolver::PoseMatrixType> SlamLinearSolver; 00042 00043 SlamLinearSolver* linearSolver = new SlamLinearSolver(); 00044 linearSolver->setBlockOrdering(false); 00045 SlamBlockSolver* solver = new SlamBlockSolver(mw.viewer->graph, linearSolver); 00046 mw.viewer->graph->setSolver(solver); 00047 00048 while (mw.isVisible()) { 00049 qapp.processEvents(); 00050 usleep(10000); 00051 } 00052 return 0; 00053 }