log_test.cpp
Go to the documentation of this file.
1 #include <cstdlib>
2 #include <fstream>
3 #include <iostream>
5 #include <log/sensorlog.h>
6 
7 
8 using namespace std;
9 using namespace GMapping;
10 
11 int main(int argc, char ** argv){
12  if (argc<2){
13  cout << "usage log_test <filename>" << endl;
14  exit (-1);
15  }
16  ifstream is(argv[1]);
17  if (! is){
18  cout << "no file " << argv[1] << " found" << endl;
19  exit (-1);
20  }
22  conf.load(is);
23 
24  SensorMap m=conf.computeSensorMap();
25 
26  //for (SensorMap::const_iterator it=m.begin(); it!=m.end(); it++)
27  // cout << it->first << " " << it->second->getName() << endl;
28 
29  SensorLog log(m);
30  is.close();
31 
32  ifstream ls(argv[1]);
33  log.load(ls);
34  ls.close();
35  cerr << "log size" << log.size() << endl;
36  for (SensorLog::iterator it=log.begin(); it!=log.end(); it++){
37  RangeReading* rr=dynamic_cast<RangeReading*>(*it);
38  if (rr){
39  //cerr << rr->getSensor()->getName() << " ";
40  //cerr << rr->size()<< " ";
41  //for (RangeReading::const_iterator it=rr->begin(); it!=rr->end(); it++){
42  // cerr << *it << " ";
43  //}
44  cout<< rr->getPose().x << " " << rr->getPose().y << " " << rr->getPose().theta << " " << rr->getTime() << endl;
45  }
46  }
47 }
virtual SensorMap computeSensorMap() const
virtual std::istream & load(std::istream &is)
const OrientedPoint & getPose() const
Definition: rangereading.h:15
std::istream & load(std::istream &is)
Definition: sensorlog.cpp:23
std::map< std::string, Sensor * > SensorMap
Definition: sensor.h:19
double getTime() const
Definition: sensorreading.h:11
ifstream is(argv[c])
int main(int argc, char **argv)
Definition: log_test.cpp:11


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