FeatExtrTask.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 
00035 
00036 
00037 
00038 #ifndef __FEAT_EXTR_TASK_H_
00039 #define __FEAT_EXTR_TASK_H_
00040 
00041 #include <Task.h>
00042 #include <Resource.h>
00043 #include <MobileRob.h>
00044 #include <ProtrusionExtr.h>
00045 #include <EdgeExtr.h>
00046 #include <SharedMem.h>
00047 #include <CommonOptions.h>
00048 #ifndef MIP_PLATFORM_ARM
00049 #include <DraWin.h>
00050 #endif
00051 
00052 using namespace MipAlgorithms;
00053 using namespace MipResources;
00054 
00055 namespace MipTasks{
00056  
00058  /* @{ */
00059  
00063  class FeatExtrOptions : public Options {
00064   public:
00066    DecimalOption* discThreshold;
00068    DecimalOption* minRobWidth;
00070    DecimalOption* maxRobWidth;
00072    DecimalOption* offset;
00074    DecimalOption* sameFeatThreshold;
00076    DecimalOption* addNoiseRange;
00078    DecimalOption* addNoiseBear;
00080    IntOption* doCornerExtraction;
00082    IntOption* doProtrusionExtraction;
00083    
00085    BoolOption *saveLaserMeas;
00086    
00088    FeatExtrOptions();
00089 
00090    string getObjectName() const {
00091     return "FeatExtrOptions";
00092    }
00093  };
00094  
00095  
00099  class FeatExtrSharedMem : public SharedMem{
00100   public:
00103    void initSharedMem();
00104    
00108    void setMyProtrusions(PosiFeatures &protrusions, MotionModuleTState &protrusionsTState);
00109    
00113    void setMyCorners(PosiFeatures &corners, MotionModuleTState &cornersTState);
00114    
00117    bool printFeat();
00118  };
00119  
00120  
00124  class FeatExtrTask : public Task{
00125   private:
00126    static const TaskPlate _plate = FEA_TASK;
00127    static const long int  _maxDurSec  = 0,      _maxDurUsec = 100000;
00128    static const long int  _maxSamplPeriodSec = 0, _maxSamplPeriodUsec = 500000;
00129    static const long int  _minSamplPeriodSec = 0, _minSamplPeriodUsec = 50000;
00130  
00131    ProtrusionsExtr* _protrusionExtractor;
00132    ProtrusionsExtr* _targetExtractor;
00133    PosiEdgeExtr* _cornerExtractor;
00134    MobileRob*  _mobileRob;
00135    FeatExtrSharedMem* _sharedMem;
00136    
00137  #ifndef MIP_PLATFORM_ARM
00138    DraWin*      _draWin;   
00139    unsigned int _drawList; 
00140    bool         dwOn;      
00141  #endif
00142  
00143    bool scanOn;
00144    Scan currScan;
00145    
00146    Timer lifeTimer;
00147    
00148    FeatExtrOptions options;
00149    fstream _saveTState;
00150    fstream _saveTStateTime;
00151    fstream _saveLaserMeas;
00152    Time t;
00153    
00154    ofstream *outputFile; 
00155    
00156   public:
00158    FeatExtrTask(ResourcePointers resources,int argc, const char* argv[]);
00160    ~FeatExtrTask(){
00161     //_saveTState.close();
00162     //_saveLaserMeas.close();
00163     cout << "destr FeatExtrTask" << endl;
00164    }
00167    TaskPlate getPlate() const {
00168     return _plate;
00169    }
00172    Time getMaxDuration(){
00173     return Time(_maxDurSec,_maxDurUsec);
00174    }
00177    Time getMaxSamplPeriod(){
00178     return Time(_maxSamplPeriodSec,_maxSamplPeriodUsec);
00179    }
00182    Time getMinSamplPeriod(){
00183     return Time(_minSamplPeriodSec,_minSamplPeriodUsec);
00184    }
00185    
00188    TaskOutputs run();
00189    
00190  };
00191  
00192  /* @} */
00193  
00194 };// end namespace MipTasks
00195 
00196 #endif
00197 
00198 
00199 
00200 
00201 

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