gfs2stat.cpp
Go to the documentation of this file.
1 #include <gmapping/utils/stat.h>
3 #include <iostream>
4 #include <fstream>
5 #include "gfsreader.h"
6 
7 using namespace std;
8 using namespace GMapping;
9 using namespace GMapping::GFSReader;
10 
11 
12 int main(int argc, char ** argv){
13  if (argc<2){
14  cout << "usage gfs2stat <infilename> <outfilename>" << endl;
15  return 0;
16  }
17  ifstream is(argv[1]);
18  if (!is){
19  cout << "no file found: " << argv[1] << endl;
20  return 0;
21  }
22  ofstream os(argv[2]);
23  if (!os){
24  cout << "cannot open file: " << argv[1] << endl;
25  return 0;
26  }
27  cout << "loading... "<< flush;
28  RecordList rl;
29  rl.read(is);
30  cout << " done" << endl;
31  int count=-1;
32  for (RecordList::const_iterator it=rl.begin(); it!=rl.end(); it++){
33 
34  count++;
35  const ScanMatchRecord* rec=dynamic_cast<const ScanMatchRecord*>(*it);
36  if (!rec)
37  continue;
38  Gaussian3 gaussian;
39  /*
40  vector<double> nweights;
41  cout << "N"<< flush;
42  back_insert_iterator< vector<double> > out(nweights);
43  toNormalForm(out,rec->weights.begin(), rec->weights.end());
44  cout << "G"<< flush;
45  gaussian.computeFromSamples(rec->poses, nweights);
46  */
47  gaussian.computeFromSamples(rec->poses);
48  cout << "E"<< flush;
49  os << count <<" ";
50  os << gaussian.mean.x <<" ";
51  os << gaussian.mean.y <<" ";
52  os << gaussian.mean.theta <<" ";
53  os << gaussian.covariance.eval[0] <<" ";
54  os << gaussian.covariance.eval[1] <<" ";
55  os << gaussian.covariance.eval[2] <<endl;
56  }
57  os.close();
58 }
OrientedPoint mean
Definition: stat.h:34
istream & read(istream &is)
Definition: gfsreader.cpp:198
void computeFromSamples(const std::vector< OrientedPoint > &poses)
RecordList rl
Definition: gfs2stream.cpp:60
vector< OrientedPoint > poses
Definition: gfsreader.h:68
ifstream is(argv[c])
EigenCovariance3 covariance
Definition: stat.h:35
int main(int argc, char **argv)
Definition: gfs2stat.cpp:12


openslam_gmapping
Author(s): Giorgio Grisetti, Cyrill Stachniss, Wolfram Burgard
autogenerated on Mon Jun 10 2019 14:04:22