ExampleTask.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 
00037 
00038 
00039 #ifndef __EXAMPLE_TASK_H_
00040 #define __EXAMPLE_TASK_H_
00041 
00042 #include <Task.h>
00043 #include <Resource.h>
00044 #include <MobileRob.h>
00045 #include <ProtrusionExtr.h>
00046 #include <SharedMem.h>
00047 #include <CommonOptions.h>
00048 #ifndef MIP_PLATFORM_ARM
00049 #include <DraWin.h>
00050 #endif
00051 
00052 namespace MipTasks{
00053  
00055  /* @{ */
00056  
00060  enum ExampleTaskStates{
00061   EXAMPLE_TASK_FIRST_RUN,
00062   EXAMPLE_TASK_NORMAL_RUN,
00063   EXAMPLE_TASK_STATES_NUM
00064  };
00065  
00068  static const char* ExampleTaskStatesNames[EXAMPLE_TASK_STATES_NUM] = {
00069   "FirstRun",
00070   "NormalRun"
00071  };
00072  
00073  
00077  class ExampleTaskOptions : public Options {
00078   public:
00080    DecimalOption* decimalOption;
00082    IntOption*   intOption;
00083    
00085    ExampleTaskOptions();
00086  };
00087  
00088  
00092  class ExampleTaskSharedMem : public SharedMem{
00093   public:
00096    void initSharedMem();
00097  };
00098  
00099  
00103  class ExampleTask : public Task{
00104   private:
00105    
00111    static const TaskPlate _plate = EXA_TASK;
00112    
00116    static const long int  _maxDurSec  = 0,      _maxDurUsec = 100000;
00117    static const long int  _maxSamplPeriodSec = 0, _maxSamplPeriodUsec = 500000;
00118    static const long int  _minSamplPeriodSec = 0, _minSamplPeriodUsec = 50000;
00119    
00121    ProtrusionsExtr* _protrusionExtractor;
00122    
00124    MobileRob*  _mobileRob;
00125    
00127  #ifndef MIP_PLATFORM_ARM
00128    DraWin*      _draWin;   
00129    unsigned int _drawList; 
00130    bool         dwOn;      
00131  #endif
00132  
00133    
00135    ExampleTaskSharedMem* _sharedMem;
00136    
00138    ExampleTaskOptions _options;
00139    
00141    int   _exampleOfIntVariable;
00142    double _exampleOfDecimalVariable;
00143    ExampleTaskStates _state;
00144    
00146    void _firstRun();
00147    void _normalRun();
00148    
00149   public:
00151    ExampleTask(ResourcePointers resources,int argc, const char* argv[]);
00152    
00154    ~ExampleTask();
00155    
00158    TaskPlate getPlate() const {
00159     return _plate;
00160    }
00163    Time getMaxDuration(){
00164     return Time(_maxDurSec,_maxDurUsec);
00165    }
00168    Time getMaxSamplPeriod(){
00169     return Time(_maxSamplPeriodSec,_maxSamplPeriodUsec);
00170    }
00173    Time getMinSamplPeriod(){
00174     return Time(_minSamplPeriodSec,_minSamplPeriodUsec);
00175    }
00176    
00184    TaskOutputs run();
00185  };
00186  
00243  
00244  /* @} */
00245  
00246 };// end namespace MipTasks
00247 
00248 #endif
00249 
00250 
00251 
00252 
00253 

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