rdk2carmen.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                 cerr << "usage "<<argv[0]<<" <filename> <outfilename>" << endl;
00014                 cerr << "or "<<argv[0]<<" <filename> for standard output" << endl;
00015                 exit (-1);
00016         }
00017         ifstream is(argv[1]);
00018         if (! is){
00019                 cerr << "no file " << argv[1] << " found" << endl;
00020                 exit (-1);
00021         }
00022         ostream *os;
00023         if (argc<3) 
00024                 os=&cout;
00025         else{
00026                 os=new ofstream(argv[2]);
00027                 if (! os){
00028                         cerr << "no file " << argv[1] << " found" << endl;
00029                         exit (-1);
00030                 }
00031         }
00032         CarmenConfiguration conf;
00033         conf.load(is);
00034         
00035         SensorMap m=conf.computeSensorMap();
00036         
00037         //for (SensorMap::const_iterator it=m.begin(); it!=m.end(); it++)
00038         //      cout << it->first << " " << it->second->getName() << endl;
00039         
00040         SensorLog log(m);
00041         is.close();
00042         
00043         ifstream ls(argv[1]);
00044         log.load(ls);
00045         ls.close();
00046         cerr << "log size" << log.size() << endl;
00047         for (SensorLog::iterator it=log.begin(); it!=log.end(); it++){
00048                 RangeReading* rr=dynamic_cast<RangeReading*>(*it);
00049                 if (rr){
00050                         *os << rr->getSensor()->getName() << " ";
00051                         *os << rr->size()<< " ";
00052                         for (RangeReading::const_iterator it=rr->begin(); it!=rr->end(); it++){
00053                                 *os << (*it)*0.001 << " ";
00054                         }
00055                         *os<< rr->getPose().x*0.001 << " " << rr->getPose().y*0.001 << " " << rr->getPose().theta << endl;
00056                 }
00057         }
00058 }


openslam_gmapping
Author(s): Giorgio Grisetti, Cyrill Stachniss, Wolfram Burgard
autogenerated on Thu Jun 6 2019 19:25:13