00001 #ifndef GFSREADER_H 00002 #define GFSREADER_H 00003 00004 #include <iostream> 00005 #include <fstream> 00006 #include <sstream> 00007 #include <vector> 00008 #include <list> 00009 #include <utils/point.h> 00010 00011 #define MAX_LINE_LENGHT (1000000) 00012 00013 namespace GMapping{ 00014 00015 namespace GFSReader{ 00016 00017 using namespace std; 00018 00019 struct Record{ 00020 unsigned int dim; 00021 double time; 00022 virtual ~Record(); 00023 virtual void read(istream& is)=0; 00024 virtual void write(ostream& os); 00025 }; 00026 00027 struct CommentRecord: public Record{ 00028 string text; 00029 virtual void read(istream& is); 00030 virtual void write(ostream& os); 00031 }; 00032 00033 struct PoseRecord: public Record{ 00034 PoseRecord(bool ideal=false); 00035 void read(istream& is); 00036 virtual void write(ostream& os); 00037 bool truePos; 00038 OrientedPoint pose; 00039 }; 00040 00041 struct NeffRecord: public Record{ 00042 void read(istream& is); 00043 virtual void write(ostream& os); 00044 double neff; 00045 }; 00046 00047 struct EntropyRecord: public Record{ 00048 void read(istream& is); 00049 virtual void write(ostream& os); 00050 double poseEntropy; 00051 double trajectoryEntropy; 00052 double mapEntropy; 00053 }; 00054 00055 00056 struct OdometryRecord: public Record{ 00057 virtual void read(istream& is); 00058 vector<OrientedPoint> poses; 00059 }; 00060 00061 struct RawOdometryRecord: public Record{ 00062 virtual void read(istream& is); 00063 OrientedPoint pose; 00064 }; 00065 00066 struct ScanMatchRecord: public Record{ 00067 virtual void read(istream& is); 00068 vector<OrientedPoint> poses; 00069 vector<double> weights; 00070 }; 00071 00072 struct LaserRecord: public Record{ 00073 virtual void read(istream& is); 00074 virtual void write(ostream& os); 00075 vector<double> readings; 00076 OrientedPoint pose; 00077 double weight; 00078 }; 00079 00080 struct ResampleRecord: public Record{ 00081 virtual void read(istream& is); 00082 vector<unsigned int> indexes; 00083 }; 00084 00085 struct RecordList: public list<Record*>{ 00086 mutable int sampleSize; 00087 istream& read(istream& is); 00088 double getLogWeight(unsigned int i) const; 00089 double getLogWeight(unsigned int i, RecordList::const_iterator frame) const; 00090 unsigned int getBestIdx() const ; 00091 void printLastParticles(ostream& os) const ; 00092 void printPath(ostream& os, unsigned int i, bool err=false, bool rawodom=false) const; 00093 RecordList computePath(unsigned int i, RecordList::const_iterator frame) const; 00094 void destroyReferences(); 00095 }; 00096 00097 }; //end namespace GFSReader 00098 00099 }; //end namespace GMapping 00100 00101 #endif