21 os <<
"#GFS_COMMENT: " << text << endl;
28 is >> pose.x >> pose.y >> pose.theta;
38 os << setiosflags(ios::fixed) << setprecision(6);
39 os << pose.x <<
" " << pose.y <<
" " << pose.theta <<
" 0 0 0 ";
40 os <<
time <<
" pippo " <<
time << endl;
52 os <<
"NEFF " <<
neff ;
53 os << setiosflags(ios::fixed) << setprecision(6);
54 os <<
" " <<
time <<
" pippo " <<
time << endl;
60 for (
unsigned int i=0; i<
dim; i++){
86 is >> poseEntropy >> trajectoryEntropy >> mapEntropy;
93 os << setiosflags(ios::fixed) << setprecision(6) <<
"ENTROPY " << poseEntropy <<
" " << trajectoryEntropy <<
" " << mapEntropy;
94 os <<
" " <<
time <<
" pippo " <<
time << endl;
99 for (
unsigned int i=0; i<
dim; i++){
107 weights.push_back(w);
113 for (
unsigned int i=0; i<
dim; i++){
116 readings.push_back(r);
127 os <<
"WEIGHT " << weight << endl;
128 os <<
"ROBOTLASER1 ";
131 if ((
dim == 541)||(
dim == 540)) {
138 else if ((
dim == 180)||(
dim == 181)) {
145 else if ((
dim == 360)||(
dim == 361)) {
152 else if ((
dim == 682)||(
dim == 683)) {
156 os <<
" " << 360.0/1024.0/180.0*M_PI;
169 os << setiosflags(ios::fixed) << setprecision(2);
170 for (
unsigned int i=0; i<
dim; i++){
171 os <<
" "<< readings[i] ;
173 os << setiosflags(ios::fixed) << setprecision(6);
177 os <<
" "<< pose.theta;
180 os <<
" "<< pose.theta;
186 os <<
" "<<
time <<
" localhost " <<
time << endl;
191 for (
unsigned int i=0; i<
dim; i++){
194 indexes.push_back(j);
202 istringstream lineStream(buf);
204 lineStream >> recordType;
206 if (recordType==
"LASER_READING"){
210 else if (recordType==
"ODO_UPDATE"){
214 else if (recordType==
"ODOM"){
218 else if (recordType==
"SM_UPDATE"){
222 else if (recordType==
"SIMULATOR_POS"){
226 else if (recordType==
"RESAMPLE"){
230 else if (recordType==
"NEFF"){
234 else if (recordType==
"COMMENT" || recordType==
"#COMMENT"){
238 else if (recordType==
"ENTROPY"){
244 rec->
read(lineStream);
253 unsigned int currentIndex=i;
254 for(RecordList::const_reverse_iterator it=rbegin(); it!=rend(); it++){
257 weight+=scanmatch->
weights[currentIndex];
261 currentIndex=resample->
indexes[currentIndex];
269 unsigned int currentIndex=i;
270 for(RecordList::const_reverse_iterator it(frame); it!=rend(); it++){
273 weight+=scanmatch->
weights[currentIndex];
277 currentIndex=resample->
indexes[currentIndex];
287 const_reverse_iterator it=rbegin();
292 unsigned int dim=scanmatch->
dim;
295 unsigned int best=scanmatch->
dim+1;
296 for (
unsigned i=0; i<
dim; i++){
297 double w=getLogWeight(i);
310 const_reverse_iterator it=rbegin();
317 for (vector<OrientedPoint>::const_iterator it=scanmatch->
poses.begin(); it!=scanmatch->
poses.end(); it++){
318 os <<
"MARKER [color=black; circle=" << it->x*100 <<
"," << it->y*100 <<
",10] 0 pippo 0" << endl;
323 for(RecordList::iterator it=begin(); it!=end(); it++)
329 unsigned int currentIndex=i;
335 for(RecordList::const_reverse_iterator it(frame); it!=rend(); it++){
338 p=scanmatch->
poses[currentIndex];
342 if (laser && !first){
345 rl.push_front(claser);
349 currentIndex=resample->
indexes[currentIndex];
357 unsigned int currentIndex=i;
363 for(RecordList::const_reverse_iterator it=rbegin(); it!=rend(); it++){
378 p=pose->
pose=scanmatch->
poses[currentIndex];
379 w=scanmatch->
weights[currentIndex]-oldWeight;
380 oldWeight=scanmatch->
weights[currentIndex];
390 p=pose->
pose=odometry->
poses[currentIndex];
416 rl.push_front(claser);
421 rl.push_front(ccomment);
426 currentIndex=resample->
indexes[currentIndex];
431 bool computedTransformation=
false;
432 bool truePosFound=
false;
440 for(RecordList::iterator it=rl.begin(); it!=rl.end(); it++){
443 neff=neffr->
neff/(double)sampleSize;
444 started=started ||
dynamic_cast<const LaserRecord*
>(*it)?
true:
false;
445 if (started && ! truePosFound){
450 truePose=tpose->
pose;
455 if (started && truePosFound && ! computedTransformation){
462 computedTransformation=
true;
465 if (computedTransformation){
466 os << setiosflags(ios::fixed) << setprecision(6);
477 double ex=realDelta.
x-trueDelta.
x;
478 double ey=realDelta.
y-trueDelta.
y;
480 eth=atan2(sin(eth), cos(eth));
484 << ex <<
" " << ey <<
" " << eth
485 <<
" " << sqrt(ex*ex+ey*ey) <<
" " << fabs(eth) << endl;
486 totalError+=sqrt(ex*ex+ey*ey);
501 cout <<
"average error" << totalError/count << endl;
virtual void read(istream &is)
unsigned int getBestIdx() const
void printPath(ostream &os, unsigned int i, bool err=false, bool rawodom=false) const
PoseRecord(bool ideal=false)
virtual void read(istream &is)=0
istream & read(istream &is)
virtual void write(ostream &os)
virtual void write(ostream &os)
virtual void read(istream &is)
void printLastParticles(ostream &os) const
void resample(std::vector< int > &indexes, const WeightVector &weights, unsigned int nparticles=0)
orientedpoint< T, A > absoluteDifference(const orientedpoint< T, A > &p1, const orientedpoint< T, A > &p2)
virtual void write(ostream &os)
vector< OrientedPoint > poses
virtual void read(istream &is)
vector< OrientedPoint > poses
virtual void write(ostream &os)
virtual void read(istream &is)
virtual void write(ostream &os)
vector< unsigned int > indexes
virtual void read(istream &is)
double max(double a, double b)
RecordList computePath(unsigned int i, RecordList::const_iterator frame) const
double getLogWeight(unsigned int i) const