ExampleTask.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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 };
00247
00248 #endif
00249
00250
00251
00252
00253