gfs2log.cpp
Go to the documentation of this file.
1 #include <cstring>
2 #include <iostream>
3 #include <fstream>
4 #include <sstream>
5 #include <vector>
6 #include <list>
7 #include <gmapping/utils/point.h>
9 
10 #define MAX_LINE_LENGHT (1000000)
11 
12 using namespace std;
13 using namespace GMapping;
14 using namespace GMapping::GFSReader;
15 
16 int main (int argc, const char * const * argv){
17  if (argc<3){
18  cout << "usage gfs2log [-err] [-neff] [-part] [-odom] <infilename> <outfilename>" << endl;
19  cout << " -odom : dump raw odometry in ODOM message instead of inpolated corrected one" << endl;
20  return -1;
21  }
22  bool err=0;
23  bool neff=0;
24  bool part=0;
25  bool odom=0;
26  // int particle_num;
27  unsigned int c=1;
28  if (!strcmp(argv[c],"-err")){
29  err=true;
30  c++;
31  }
32  if (!strcmp(argv[c],"-neff")){
33  neff=true;
34  c++;
35  }
36  if (!strcmp(argv[c],"-part")){
37  part=true;
38  c++;
39  }
40  if (!strcmp(argv[c],"-odom")){
41  odom=true;
42  c++;
43  }
44  ifstream is(argv[c]);
45  if (!is){
46  cout << "could read file "<< endl;
47  return -1;
48  }
49  c++;
50  RecordList rl;
51  rl.read(is);
52  unsigned int bestidx=rl.getBestIdx();
53  cout << endl << "best index = " << bestidx<< endl;
54  ofstream os(argv[c]);
55  if (! os){
56  cout << "could write file "<< endl;
57  return -1;
58  }
59  rl.printPath(os,bestidx,err,odom);
60  if(part)
61  rl.printLastParticles(os);
62  os.close();
63  return 0;
64 }
bool neff
Definition: gfs2stream.cpp:39
unsigned int getBestIdx() const
Definition: gfsreader.cpp:283
void printPath(ostream &os, unsigned int i, bool err=false, bool rawodom=false) const
Definition: gfsreader.cpp:356
bool err
Definition: gfs2stream.cpp:38
istream & read(istream &is)
Definition: gfsreader.cpp:198
unsigned int bestidx
Definition: gfs2stream.cpp:62
void printLastParticles(ostream &os) const
Definition: gfsreader.cpp:306
bool part
Definition: gfs2stream.cpp:40
RecordList rl
Definition: gfs2stream.cpp:60
unsigned int c
Definition: gfs2stream.cpp:41
int main(int argc, const char *const *argv)
Definition: gfs2log.cpp:16
ifstream is(argv[c])


openslam_gmapping
Author(s): Cyrill Stachniss, Udo Frese, Giorgio Grisetti, Wolfram Burgard
autogenerated on Mon Feb 28 2022 22:59:20