gfs2stat.cpp
Go to the documentation of this file.
1 #include <gmapping/utils/stat.h>
3 #include <iostream>
4 #include <fstream>
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 }
GMapping::Gaussian3::computeFromSamples
void computeFromSamples(const std::vector< OrientedPoint > &poses)
main
int main(int argc, char **argv)
Definition: gfs2stat.cpp:12
particlefilter.h
is
ifstream is(argv[c])
GMapping
Definition: configfile.cpp:34
GMapping::Gaussian3
Definition: stat.h:34
rl
RecordList rl
Definition: gfs2stream.cpp:60
GMapping::Gaussian3::covariance
EigenCovariance3 covariance
Definition: stat.h:36
GMapping::GFSReader::ScanMatchRecord::poses
vector< OrientedPoint > poses
Definition: gfsreader.h:69
GMapping::point::y
T y
Definition: point.h:16
GMapping::orientedpoint::theta
A theta
Definition: point.h:60
GMapping::Gaussian3::mean
OrientedPoint mean
Definition: stat.h:35
GMapping::GFSReader
Definition: gfsreader.cpp:8
GMapping::GFSReader::RecordList
Definition: gfsreader.h:86
gfsreader.h
stat.h
GMapping::GFSReader::ScanMatchRecord
Definition: gfsreader.h:67
GMapping::EigenCovariance3::eval
double eval[3]
Definition: stat.h:30
GMapping::GFSReader::RecordList::read
istream & read(istream &is)
Definition: gfsreader.cpp:198
GMapping::point::x
T x
Definition: point.h:16


openslam_gmapping
Author(s): Cyrill Stachniss, Udo Frese, Giorgio Grisetti, Wolfram Burgard
autogenerated on Thu Oct 19 2023 02:25:51