PHDFilter.h

Go to the documentation of this file.
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 
00029 
00036 
00037 #ifndef __PHD_FILTER_H
00038 #define __PHD_FILTER_H
00039 
00040 #include <Spaces.h>
00041 #include <SimTime.h>
00042 #include <SpacesArma.h>
00043 #include <armadillo>
00044 #include <math.h>
00045 #include <LogTrace.h>
00046 #include <GaussianMixture.h>
00047 
00048 using namespace MipBaselib;
00049 using namespace arma;
00050 
00051 namespace MipAlgorithms{
00052  
00054  /* @{ */
00055  
00058  enum PHDFilterType{
00059   GM_LINEAR_NO_ID,
00060   GM_UNICYCLE_2D_ID,
00061   GM_UNICYCLE_2D_ID_RC, // robocentric non-cooperative filter
00062   GM_UNICYCLE_2D_ID_COOP,
00063   GM_UNICYCLE_2D_ID_COOP_2,  // non-robocentric cooperative filter bad (divided by the probability of detection)
00064   GM_UNICYCLE_2D_ID_RC_COOP, // robocentric cooperative filter
00065   GM_UNICYCLE_2D_ID_3_COOP,  // non-robocentric cooperative filter good
00066   GM_UNICYCLE_2D_ID_4_COOP,  // non-robocentric cooperative filter good
00067   GM_UNICYCLE_2D_ID_CENTR,
00068   GM_UNICYCLE_2D_NO_ID, // non-robocentric non-cooperative filter
00069   GM_UNICYCLE_2D_ID_RC_CAM,
00070   NO_PHD_EKF_ONLY,
00071   GMID_PHD_UNYCYCLE_2D_RC,
00072   PHD_FILTER_TYPE_NUM
00073  };
00074  
00079  static const char* PHDFilterTypeName[PHD_FILTER_TYPE_NUM] ={
00080    "GMLinearNoId",
00081    "GMUnicycle2DId",
00082    "GMUnicycle2DIdRoboCentric",
00083    "GMUnicycle2DIdCoop",
00084    "GMUnicycle2DIdCoop2",
00085    "GMUnicycle2DIdRoboCentricCoop",
00086    "GMUnicycle2DId3Coop",
00087    "GMUnicycle2DId4Coop",
00088    "GMUnicycle2DIdCentr",
00089    "GMUnicycle2DNoId",
00090    "GMUnicycle2DIdRoboCentricCam",
00091    "NoPHD:EKFOnly",
00092    "GMIDUnicycle2DRC"
00093  };
00094  
00097  enum PHDFilterOutputType{
00098   PHD_OUT_NULL,
00099   PHD_OUT_GM,
00100   PHD_OUT_GMJID,
00101   PHD_OUT_GMID,
00102   PHD_FILTER_OUTPUT_TYPE_NUM
00103  };
00104  
00105  
00106  
00110  class PHDFilterIn{
00111   public:
00112    Pose myPose;
00113    vector<Position> measures;
00114    vector< vector <Position> > otherMeasures;
00115    vector< int > otherIds;
00116 
00117    vector<Pose> hisPose;
00118    vector<int> hisId;
00119    
00120    // Added for PHD with camera: Marco Cognetti
00121    // Height from sonar
00122    Decimal height;
00123    // Measurements from camera
00124    vector<Position2DArma> measuresCam;
00125    // Attitude
00126    Angle roll;
00127    Angle pitch;
00128    Angle yaw;
00129    // Odometry
00130    Odometry3DTimeArma myOdom;
00131  };
00132  
00133  
00137  class PHDFilterPars {
00138   public:
00139    
00140    Decimal pSurvival;
00141    
00142    Decimal pDetection;
00143    
00144    SimTime timeBetweenUpdates;
00145    
00147    PHDFilterPars();
00148    
00151    PHDFilterPars(Decimal pS, Decimal pD, SimTime t);
00152  };
00153  
00154  
00158  class PHDFilterVars {
00159   public:
00160    bool _firstStep;
00161    SimTimer _timeFromLastUpdate;
00162    
00163    SimTimer _timeFromLastPrediction;
00164    
00165    PHDFilterVars();
00166  };
00167  
00168  
00172  class PHDFilter : public  MIPObject{
00173   protected:
00174    PHDFilterVars* _vars;
00175    PHDFilterPars* _pars;
00176   public:
00177    PHDFilter();
00178    
00179    PHDFilter(PHDFilterPars inParams);
00180    
00181    virtual void step(PHDFilterIn &in)=0;
00182    
00183    virtual string print()=0;
00184    
00185    virtual PHDFilterOutputType getOutputType()=0;
00186    
00187    virtual void getBelief(GaussianMixtureJointId &gm){}
00188    
00189    virtual void getBelief(GaussianMixture &gm){}
00190    
00191    virtual void getBelief(GaussianMixtureID &gm){}
00192    
00193   protected:
00194    
00195    virtual void _initialize(PHDFilterIn &in)=0;
00196    virtual void _normalStep(PHDFilterIn &in)=0;
00197  };
00198  
00199  /* @} */
00200  
00201 }
00202 
00203 
00204 #endif
00205 
00206 
00207 
00208 
00209 
00210 
00211 
00212 

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