Go to the documentation of this file.00001 #include <cstring>
00002 #include <iostream>
00003 #include <fstream>
00004 #include <sstream>
00005 #include <vector>
00006 #include <list>
00007 #include <gmapping/utils/point.h>
00008 #include "gfsreader.h"
00009
00010 #define MAX_LINE_LENGHT (1000000)
00011
00012 using namespace std;
00013 using namespace GMapping;
00014 using namespace GMapping::GFSReader;
00015
00016 int main (int argc, const char * const * argv){
00017 if (argc<3){
00018 cout << "usage gfs2log [-err] [-neff] [-part] [-odom] <infilename> <outfilename>" << endl;
00019 cout << " -odom : dump raw odometry in ODOM message instead of inpolated corrected one" << endl;
00020 return -1;
00021 }
00022 bool err=0;
00023 bool neff=0;
00024 bool part=0;
00025 bool odom=0;
00026
00027 unsigned int c=1;
00028 if (!strcmp(argv[c],"-err")){
00029 err=true;
00030 c++;
00031 }
00032 if (!strcmp(argv[c],"-neff")){
00033 neff=true;
00034 c++;
00035 }
00036 if (!strcmp(argv[c],"-part")){
00037 part=true;
00038 c++;
00039 }
00040 if (!strcmp(argv[c],"-odom")){
00041 odom=true;
00042 c++;
00043 }
00044 ifstream is(argv[c]);
00045 if (!is){
00046 cout << "could read file "<< endl;
00047 return -1;
00048 }
00049 c++;
00050 RecordList rl;
00051 rl.read(is);
00052 unsigned int bestidx=rl.getBestIdx();
00053 cout << endl << "best index = " << bestidx<< endl;
00054 ofstream os(argv[c]);
00055 if (! os){
00056 cout << "could write file "<< endl;
00057 return -1;
00058 }
00059 rl.printPath(os,bestidx,err,odom);
00060 if(part)
00061 rl.printLastParticles(os);
00062 os.close();
00063 return 0;
00064 }