00001 // ---------------------------------------------------------------------------- 00002 // 00003 // $Id$ 00004 // 00005 // Copyright 2008, 2009, 2010, 2011, 2012 Antonio Franchi and Paolo Stegagno 00006 // 00007 // This file is part of MIP. 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 stegagno@diag.uniroma1.it 00023 // 00024 // ---------------------------------------------------------------------------- 00025 00026 00030 00032 /* @{ */ 00033 00034 #ifndef __PA_FIL_BFL_H_ 00035 #define __PA_FIL_BFL_H_ 00036 00037 #include <filter/bootstrapfilter.h> 00038 00039 #include <model/systemmodel.h> 00040 #include <model/measurementmodel.h> 00041 00042 #include <iostream> 00043 #include <fstream> 00044 00045 #include <pdf/conditionalpdf.h> 00046 #include <pdf/gaussian.h> 00047 00048 #include "MutLoc.h" 00049 00050 00051 using namespace MatrixWrapper; 00052 using namespace BFL; 00053 using namespace std; 00054 00055 00056 00057 namespace MipAlgorithms{ 00061 class PaFilBFLPar{ 00062 public: 00063 int particleNumber; 00064 Decimal randomPercentage; 00065 00066 PaFilBFLPar(int parNum = 100, Decimal ranPercent = 0.0); 00067 00068 PaFilBFLPar(const PaFilBFLPar & pf){ 00069 particleNumber = pf.particleNumber; 00070 randomPercentage = pf.randomPercentage; 00071 } 00072 00073 PaFilBFLPar & operator=(const PaFilBFLPar & pf){ 00074 particleNumber = pf.particleNumber; 00075 randomPercentage = pf.randomPercentage; 00076 } 00077 00078 ~PaFilBFLPar(); 00079 }; 00080 }; 00081 00082 namespace MipAlgorithms{ 00086 class PaFilBFL : public MutLocFilter{ 00087 public: 00088 00090 PaFilBFL(); 00091 00093 PaFilBFL(PaFilBFLPar par); 00094 00096 ~PaFilBFL(); 00097 00100 virtual void step(MutLocFilInput &input)=0; 00101 00103 virtual void reset()=0; 00104 00106 virtual int getEstimate(Pose* ); 00107 00109 virtual int getCovariance(MIPMatrix* cov); 00110 00112 virtual int getAllEstimates(vector<Pose> &estimates, vector<Decimal> &weights); 00113 00115 virtual string print(); 00116 00117 protected: 00118 00119 BootstrapFilter<ColumnVector,ColumnVector>* _filter; 00120 00121 PaFilBFLPar _par; 00122 00123 bool _ignoreMeasures; 00124 bool _nextStepResamplingOnMeasures; 00125 00126 bool _lastStepSystemUpdate; 00127 00128 }; 00129 }; //End of MipAlgorithms namespace 00130 00131 namespace MipAlgorithms{ 00135 class PaFilBFL3D : public MutLocFilter3D{ 00136 public: 00137 00139 PaFilBFL3D(); 00140 00142 PaFilBFL3D(PaFilBFLPar par); 00143 00145 ~PaFilBFL3D(); 00146 00149 virtual void step(MutLocFilInput3D &input)=0; 00150 00152 virtual void reset()=0; 00153 00155 virtual int getEstimate(Pose3D* ,Velocity3D* bestVel=0); 00156 00158 virtual int getCovariance(MIPMatrix* cov); 00159 00161 virtual int getAllEstimates(vector<Pose3D> &estimates, vector<Decimal> &weights,vector<Velocity3D> &velEstimates); 00162 00164 virtual Decimal getLastOdomUpdateTime(); 00165 00167 virtual string print(); 00168 00169 protected: 00170 00171 BootstrapFilter<ColumnVector,ColumnVector>* _filter; 00172 00173 PaFilBFLPar _par; 00174 00175 bool _ignoreMeasures; 00176 bool _nextStepResamplingOnMeasures; 00177 00178 bool _lastStepSystemUpdate; 00179 00180 }; 00181 }; //End of MipAlgorithms namespace 00182 00183 #endif 00184 00185 00186 00187 00188 00189