log_test.cpp
Go to the documentation of this file.
00001 #include <cstdlib>
00002 #include <fstream>
00003 #include <iostream>
00004 #include <log/carmenconfiguration.h>
00005 #include <log/sensorlog.h>
00006 
00007 
00008 using namespace std;
00009 using namespace GMapping;
00010 
00011 int main(int argc, char ** argv){
00012         if (argc<2){
00013                 cout << "usage log_test <filename>" << endl;
00014                 exit (-1);
00015         }
00016         ifstream is(argv[1]);
00017         if (! is){
00018                 cout << "no file " << argv[1] << " found" << endl;
00019                 exit (-1);
00020         }
00021         CarmenConfiguration conf;
00022         conf.load(is);
00023         
00024         SensorMap m=conf.computeSensorMap();
00025         
00026         //for (SensorMap::const_iterator it=m.begin(); it!=m.end(); it++)
00027         //      cout << it->first << " " << it->second->getName() << endl;
00028         
00029         SensorLog log(m);
00030         is.close();
00031         
00032         ifstream ls(argv[1]);
00033         log.load(ls);
00034         ls.close();
00035         cerr << "log size" << log.size() << endl;
00036         for (SensorLog::iterator it=log.begin(); it!=log.end(); it++){
00037                 RangeReading* rr=dynamic_cast<RangeReading*>(*it);
00038                 if (rr){
00039                         //cerr << rr->getSensor()->getName() << " ";
00040                         //cerr << rr->size()<< " ";
00041                         //for (RangeReading::const_iterator it=rr->begin(); it!=rr->end(); it++){
00042                         //      cerr << *it << " ";
00043                         //}
00044                         cout<< rr->getPose().x << " " << rr->getPose().y << " " << rr->getPose().theta << " " << rr->getTime()  << endl;
00045                 }
00046         }
00047 }


openslam_gmapping
Author(s): Giorgio Grisetti, Cyrill Stachniss, Wolfram Burgard
autogenerated on Fri Aug 28 2015 11:56:21