GMPHDUnicycle2DIdCoopFilter.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 
00030 
00031 #ifndef __GMPHD_UNICYCLE_2D_ID_COOP_FILTER_H
00032 #define __GMPHD_UNICYCLE_2D_ID_COOP_FILTER_H
00033 
00034 #include <Spaces.h>
00035 #include <GaussianMixture.h>
00036 #include "PHDFilter.h"
00037 
00038 #define NO_ID -1
00039 #define STEADY_ID -2
00040 
00041 using namespace MipBaselib;
00042 using namespace arma;
00043 
00044 namespace MipAlgorithms{
00045 
00047  /* @{ */
00048 
00052  class GMPHDUnicycle2DIdCoopFilterPars:public PHDFilterPars{
00053   public:
00054    
00056    int myId;
00057 
00058    // system model
00060    DMat N_n_x;
00061 
00062    // measurement model
00064    DMat H;
00066    DMat N_n_z;
00067 
00068    // pruning thresholds
00071    Decimal truncThresh;
00073    int maxNumComponents;
00076    Decimal mergThresh;
00078    int partNumber;
00079 
00080    // parameters for the computation of the actual detection probability of a target.
00082    Decimal sensorDetectionRay;
00084    Decimal targetDimension;
00086    Decimal maxDetectionBearing;
00087 
00089    bool useNewNoMeasWeight;
00090 
00091    // constructors
00093    GMPHDUnicycle2DIdCoopFilterPars();
00095    GMPHDUnicycle2DIdCoopFilterPars(int mI, Decimal pS, Decimal pD, Time t, DMat& nx, DMat& h, DMat& nz, Decimal tt, int mc, Decimal mt, int pN, Decimal sdr, Decimal td, Decimal mdb, bool unw=false);
00096  };
00097 
00098 
00102  class GMPHDUnicycle2DIdCoopFilterVars:public PHDFilterVars{
00103 
00104   public:
00105 
00106    Pose myLastPose;
00107    Decimal lastMeasurementNumber;
00108    vector<Position> lastMeasurements;
00109 
00110    GaussianMixtureJointId prediction;
00111 
00112    vector<DCol> predictedMeasures;
00113    vector<Decimal> predictedMeasuresD;
00114    vector<Angle> predictedMeasuresB;
00115    vector<DMat> predictedCovariances;
00116    vector<DMat> kalmanGains;
00117    vector<DMat> stepKCovariances;
00118    vector<Decimal> detectionProbability;
00119 
00120    int bestMyEstimate;
00121 
00122    vector<vector<Decimal> > predictedMeasuresOth;
00123    vector<vector<Decimal> > predictedCovariancesOth;
00124    vector<vector<DMat> > kalmanGainsOth;
00125    vector<vector<DMat> > stepKCovariancesOth;
00126    vector<vector<Decimal> > detectionProbabilityOth;
00127    vector<vector<Decimal> > sensorWeightsOth;
00128 
00129    vector<Decimal> detectionProbabilitySum;
00130    Decimal sensorWeightSum;
00131    vector<Decimal> notDetectionProbabilityProd;
00132 
00133    vector<vector<Decimal > > dists;
00134 
00135 //   vector<int> sP;
00136    //map of current sensors in the current belief
00137    map <int, vector <int> > currSens;
00138 
00139 
00140    bool firstStepAfterMeasurements;
00141 
00142    GaussianMixtureJointId belief;
00143 
00144    GaussianMixtureJointId beliefOth;
00145 
00146    vector<int> lastOtherRobotPoseNum;
00147    map<int,Pose> lastOtherRobotPose;
00148    map<int,Pose> odometries;
00149 
00150    GMPHDUnicycle2DIdCoopFilterVars();
00151  };
00152 
00153 
00157  class GMPHDUnicycle2DIdCoopFilter:public PHDFilter{
00158   protected:
00159    GMPHDUnicycle2DIdCoopFilterVars* _gmvars;
00160    GMPHDUnicycle2DIdCoopFilterPars* _gmpars;
00161 
00162   public:
00164    GMPHDUnicycle2DIdCoopFilter();
00165 
00167    GMPHDUnicycle2DIdCoopFilter(GMPHDUnicycle2DIdCoopFilterPars inParams);
00168    
00169    void step(PHDFilterIn &in);
00170    
00171    string print();
00172    
00173    void getBelief(GaussianMixtureJointId &gm);
00174    Pose getMyBestPose();
00175    void setMyPose(Pose &p);
00176    
00177    string getObjectName() const {
00178     return "GMPHDUnicycle2DIdCoopFilter";
00179    }
00180    
00181    
00182    PHDFilterOutputType getOutputType(){
00183     return PHD_OUT_GMJID;
00184    }
00185 
00186   protected:
00187    void _computeOdometries(PHDFilterIn &in);
00188 
00189    void _predictBirthTarget(PHDFilterIn &in);
00190    virtual void _predictExistingTarget();
00191 
00192    void _findMyBestEstimate();
00193 
00194    virtual void _buildPHDUpdateComponents(PHDFilterIn &in);
00195    virtual void _updateWithMeasurements(PHDFilterIn &in);
00196    virtual void _updateWithNoMeasurements(PHDFilterIn &in);
00197 
00198    void _transformOtherMeasurements(PHDFilterIn &in);
00199    void _findAllSensors(PHDFilterIn &in);
00200 
00201    void _buildOtherPHDUpdateComponents(PHDFilterIn &in);
00202    virtual void _buildOtherPHDUpdateComponentsSingle(PHDFilterIn &in, int sensId);
00203    virtual void _updateWithOtherNoDetection(PHDFilterIn &in, int measIndex);
00204    virtual void _updateWithOtherMeasurements(PHDFilterIn &in, int measIndex);
00205 
00206    void _prune();
00207    void _pruneSimple();
00208 //    void _prune2();
00209 
00210    virtual void _initialize(PHDFilterIn &in);
00211    void _normalStep(PHDFilterIn &in);
00212 
00213    Decimal _mahalanobisDist(GaussianComponent& a, GaussianComponent& b);
00214 
00215  };
00216 
00217  /* @} */
00218 
00219 }
00220 
00221 
00222 #endif
00223 
00224 
00225 
00226 
00227 
00228 
00229 
00230 

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