result-bag-viewer.cpp
Go to the documentation of this file.
00001 /* This file is part of RGBDSLAM.
00002  * 
00003  * RGBDSLAM is free software: you can redistribute it and/or modify
00004  * it under the terms of the GNU General Public License as published by
00005  * the Free Software Foundation, either version 3 of the License, or
00006  * (at your option) any later version.
00007  * 
00008  * RGBDSLAM is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  * GNU General Public License for more details.
00012  * 
00013  * You should have received a copy of the GNU General Public License
00014  * along with RGBDSLAM.  If not, see <http://www.gnu.org/licenses/>.
00015  */
00016 
00017 #include "bagloader.h"
00018 #include "qtros.h"
00019 #include <QApplication>
00020 #include <QObject>
00021 #include "qt_gui.h"
00022 #include <Eigen/Core>
00023 #include "parameter_server.h"
00024 #include "ros_service_ui.h"
00025 
00026 //TODO:
00027 //better potential-edge-selection through flann or place recognition
00028 //Better separation of function, communication, parameters and gui
00029 //Better integration of the calibration data
00030 //Correct implementation of odometry
00031 //Multi-Camera-fusion
00032 
00034 void gui_connections(Graphical_UI* gui, BagLoader* loader)
00035 {
00036     QObject::connect(gui, SIGNAL(openBagFile(QString)), loader, SLOT(loadBagFileAsync(QString)));
00037     if (ParameterServer::instance()->get<bool>("use_glwidget") && gui->getGLViewer() != NULL) {
00038       GLViewer* glv = gui->getGLViewer();
00039             QObject::connect(loader, SIGNAL(setPointCloud(pointcloud_type *, QMatrix4x4)), glv, SLOT(addPointCloud(pointcloud_type *, QMatrix4x4)), Qt::BlockingQueuedConnection ); //Needs to block, otherwise the opengl list compilation makes the app unresponsive. This effectively throttles the processing rate though
00040       typedef const std::vector<Eigen::Vector4f, Eigen::aligned_allocator<Eigen::Vector4f> >* cnst_ft_vectors;
00041       QObject::connect(glv, SIGNAL(cloudRendered(pointcloud_type *)), loader, SLOT(clearPointCloud(pointcloud_type *))); // 
00042     }
00043     QObject::connect(loader, SIGNAL(setGUIInfo(QString)), gui, SLOT(setInfo(QString)));
00044     QObject::connect(loader, SIGNAL(setGUIInfo2(QString)), gui, SLOT(setInfo2(QString)));
00045     QObject::connect(loader, SIGNAL(setGUIStatus(QString)), gui, SLOT(setStatus(QString)));
00046     QObject::connect(gui, SIGNAL(togglePause()), loader, SLOT(togglePause()));
00047 }
00048 
00057 int main(int argc, char** argv)
00058 {
00059   setlocale(LC_NUMERIC,"C");//Avoid expecting german decimal separators in launch files
00060 
00061   //create thread object, to run the ros event processing loop in parallel to the qt loop
00062   QtROS qtRos(argc, argv, "rgbdslam_bag_viewer"); //ros node name & namespace
00063 
00064   //Depending an use_gui on the Parameter Server, a gui- or a headless application is used
00065   QApplication app(argc, argv); 
00066 
00067   //Instantiate the kinect image loader
00068   BagLoader loader;
00069 
00070   Graphical_UI* gui = new Graphical_UI("RGBDSLAM's Bagviewer");
00071   gui->show();
00072   gui->set2DStream(false);
00073   gui_connections(gui, &loader);
00074 
00075 
00076   //If one thread receives a exit signal from the user, signal the other thread to quit too
00077   QObject::connect(&app, SIGNAL(aboutToQuit()), &qtRos, SLOT(quitNow()));
00078   QObject::connect(&qtRos, SIGNAL(rosQuits()), &app, SLOT(quit()));
00079 
00080   qtRos.start();// Run main loop.
00081   
00082   std::string bagfile_name = ParameterServer::instance()->get<std::string>("bagfile_name");
00083   if(!bagfile_name.empty()){
00084     loader.loadBagFileAsync(bagfile_name);
00085   }
00086   app.exec();
00087 }
00088 
00089 


rgbdslam_v2
Author(s): Felix Endres, Juergen Hess, Nikolas Engelhard
autogenerated on Thu Jun 6 2019 21:49:45