UavPositionControl.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 string getObjectName() const {
00088 return "ExampleTaskOptions";
00089 }
00090 };
00091
00092
00096 class ExampleTaskSharedMem : public SharedMem{
00097 public:
00100 void initSharedMem();
00101 };
00102
00103
00107 class ExampleTask : public Task{
00108 private:
00109
00115 static const TaskPlate _plate = EXA_TASK;
00116
00120 static const long int _maxDurSec = 0, _maxDurUsec = 100000;
00121 static const long int _maxSamplPeriodSec = 0, _maxSamplPeriodUsec = 500000;
00122 static const long int _minSamplPeriodSec = 0, _minSamplPeriodUsec = 50000;
00123
00125 ProtrusionsExtr* _protrusionExtractor;
00126
00128 MobileRob* _mobileRob;
00129
00131 #ifndef MIP_PLATFORM_ARM
00132 DraWin* _draWin;
00133 unsigned int _drawList;
00134 bool dwOn;
00135 #endif
00136
00137
00139 ExampleTaskSharedMem* _sharedMem;
00140
00142 ExampleTaskOptions _options;
00143
00145 int _exampleOfIntVariable;
00146 double _exampleOfDecimalVariable;
00147 ExampleTaskStates _state;
00148
00150 void _firstRun();
00151 void _normalRun();
00152
00153 public:
00155 ExampleTask(ResourcePointers resources,int argc, const char* argv[]);
00156
00158 ~ExampleTask();
00159
00162 TaskPlate getPlate() const {
00163 return _plate;
00164 }
00167 Time getMaxDuration(){
00168 return Time(_maxDurSec,_maxDurUsec);
00169 }
00172 Time getMaxSamplPeriod(){
00173 return Time(_maxSamplPeriodSec,_maxSamplPeriodUsec);
00174 }
00177 Time getMinSamplPeriod(){
00178 return Time(_minSamplPeriodSec,_minSamplPeriodUsec);
00179 }
00180
00188 TaskOutputs run();
00189 };
00190
00247
00248
00249
00250 };
00251
00252 #endif
00253
00254
00255
00256
00257