ProbMultiRegCam3D.h

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00002 //
00003 // $Id$
00004 //
00005 // Copyright 2008, 2009, 2010  Antonio Franchi
00006 //
00007 // This file is part of TeleKyb.
00008 //
00009 // MIP is free software: you can redistribute it and/or modify
00010 // it under the terms of the GNU General Public License as published by
00011 // the Free Software Foundation, either version 3 of the License, or
00012 // (at your option) any later version.
00013 //
00014 // MIP is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU General Public License
00020 // along with MIP. If not, see <http://www.gnu.org/licenses/>.
00021 //
00022 // Contact info: antonio.franchi@tuebingen.mpg.de
00023 //
00024 // ----------------------------------------------------------------------------
00025 
00029 #ifndef __PROB_MULTI_REG3D_H_
00030 #define __PROB_MULTI_REG3D_H_
00031 
00032 #define BLACK "\e[2;30m"
00033 #define RED "\e[0;31m"
00034 #define GREEN "\e[0;32m"
00035 #define YELLOW "\e[0;33m"
00036 #define BLUE "\e[0;34m"
00037 #define MAGENTA "\e[0;35m"
00038 #define CYAN "\e[0;36m"
00039 #define WHITE "\e[0;37m"
00040 #define STOPCOLOR "\e[m"
00041 
00042 #include <MIPMatrix.h>
00043 #include "time.h"
00044 #include <fstream>
00045 #include <stdlib.h>
00046 #include <stdio.h>
00047 #include <vector>
00048 #include <iostream>
00049 #include <R2.h>
00050 #include <S1.h>
00051 #include <SE2.h>
00052 #include "ProbMultiRegCam3DStr.h"
00053  
00054 using namespace std;
00055 using namespace MipBaselib;
00056  
00057 namespace kybalg{
00061  class ProbMultiRegCam3DQuadPar {
00062  private:
00063   // Linear tollerance
00064   Decimal     _linearTollerance;
00065   // Angular tollerance
00066   Decimal     _angularTollerance;
00067   // Projection tollerance
00068   Decimal     _projTollerance;
00069   // Zenith tollerance
00070   Decimal     _zenithTollerance;
00071   // Expansion method
00072   int       _expandMethod;
00073   // Id path
00074   string     _idPath;
00075   // Bearing-only path
00076   string     _bearMeasPath;
00077   // Minimum weight of intersection of a triangle to be accepted
00078   Decimal     _minIntWeight;
00079  
00080  public:
00082   //ProbMultiRegCam3DQuadPar();
00083 
00085   ProbMultiRegCam3DQuadPar(Decimal lt=0.2, Decimal at=0.013962634+0.05, Decimal pt=0.1,Decimal zt=0.1,int expandMethod=2,Decimal miw=1.0,string idPath="Ids",string bmPath="UAVMeas");
00086 
00088   ProbMultiRegCam3DQuadPar(const ProbMultiRegCam3DQuadPar &A);
00089   
00091   ProbMultiRegCam3DQuadPar& operator=(ProbMultiRegCam3DQuadPar &A);
00092   
00094   Decimal getLinearTollerance();
00095   
00097   Decimal getAngularTollerance();
00098   
00100   Decimal getProjTollerance();
00101   
00103   Decimal getZenithTollerance();
00104   
00106   int getExpandMethod();
00107   
00109   string getIdPath();
00110   
00112   string getBearMeasPath();
00113   
00115   Decimal getMinIntWeight();
00116  };
00117  
00121  class ProbMultiRegCam3DQuadSol: public MIPObject {
00122  private:
00124   vector<ProbPolFusion*> _sols;
00125   
00126  public:
00128   ProbMultiRegCam3DQuadSol();
00129   
00131   ProbMultiRegCam3DQuadSol(ProbPolFusion *polFusion);
00132   
00134   ~ProbMultiRegCam3DQuadSol();
00135   
00137   void insertPol(ProbPolFusion *polFusion);
00138   
00140   int getSize();
00141   
00143   ProbPolFusion* getProbPolFusion(int pos);
00144   
00146   vector<ProbPolFusion*> getActualSol();
00147   
00149   ProbMultiRegCam3DQuadSol& operator=(ProbMultiRegCam3DQuadSol &A);
00150   
00152   int searchId(int id, vector<Pose3D> *ris, vector<MIPMatrix> *measCov, Decimal *rightProb, vector<Decimal> *weights);
00153   
00155   string printSolutions(vector<Pose3D> *ris);
00156   
00158   string print(int opt = 0);
00159   
00161   string getObjectName() const{
00162    return "ProbMultiRegCam3DQuadSol";
00163   }
00164   
00165  };
00166   
00170  class ProbMultiRegCam3DCam : public MIPObject {
00171  private:
00172   // Map that links id with actual belief (from motion update blocks of particle filters)
00173   map <int, vector<Pose3D> > *likelihood;
00174   // List of ids of activated filters
00175   vector <int> activeLikelihoods;
00176   
00177  public:
00179   ProbMultiRegCam3DQuadPar _par;
00180   
00182   ProbMultiRegCam3DCam(ProbMultiRegCam3DQuadPar par);
00183   
00185   ~ProbMultiRegCam3DCam();
00186   
00188   void initExample(vector<AngleBearId> &input);
00189   
00191   void print(vector<AngleBearId> input, int option);
00192   
00194   void print(vector< vector<Decimal> > input);
00195   
00197   void initTriangles(vector<AngleBearId> &input, ProbMultiRegCam3DQuadSol *mrcsols, int myId);
00198   
00200   vector <vector<Angle> > createAng(vector<vector<Angle> > input);
00201   
00203   void evalTria(vector<AngleBearId> &input,int firstV,int firstF,int firstS,int secondV,int secondF,int secondS,int thirdV,int thirdF,int thirdS,Triangle *triaPointer);
00204   //void evalTria(vector<AngleId> input, Decimal firstV, Decimal firstF, Decimal firstS, Decimal secondV, Decimal secondF, Decimal secondS, Decimal thirdV, Decimal thirdF, Decimal thirdS, Decimal aSide, Decimal bSide, Decimal cSide, Triangle *triaPointer);
00205   //void evalTria(vector<AngleId> input,Decimal firstV,Decimal secondV,Decimal thridV,Decimal aSide,Decimal bSide,Decimal cSide,Triangle *triaPointer);
00206   
00208   int step(int argc, char** argv);
00209   
00211   void eraseDup(Triangle* &triaPointer, Decimal thr);
00212   
00214   void eraseDup3(Triangle* &triaPointer, Decimal thr);
00215   
00217   void eraseDup2(Triangle* &triaPointer, Decimal thr);
00218   
00220   bool eraseDupTria(vector<Triangle*> &trias, Triangle* &tria);
00221   
00223   void createPol(vector<Triangle*> triaSols, int myId,ProbMultiRegCam3DQuadSol *mrcsols);
00224   
00226   void quickSortTria(vector<Triangle*> &triaSols, Triangle* &tria, int myId);
00227   
00229   void selectSubSol(vector<Triangle*> &triaSols, Triangle* &tria, int myId);
00230   
00232   void printDataIn(AngleBearId* first,int f1,int f2, AngleBearId* second, int s1, int s2, AngleBearId* third, int t1, int t2,int info1,int info2, int info3, int id1, int id2, int id3);
00233   
00235   void setLikelihood(vector<int>& ids, map <int, vector<Pose3D> >* lik);
00236   
00238   string getObjectName() const {
00239    return "ProbMultiRegCam3DCam";
00240   }
00241   
00242   // Variable used to print 
00243   fstream _logProbMultiRegCam3DCamFile;
00244   fstream _logProbMultiRegCam3DCamOutput;
00246   //void searchId(int id, ProbMultiRegCam3DQuadSol *mrcsols,vector<BearId> ris);
00247   
00248   //string printSolutions(vector<BearId> ris);
00249  };
00250   
00251 }//end of namespace kybalg
00252 
00253 #endif

Generated on Mon Feb 20 07:01:06 2017 for MIP by  doxygen 1.5.6