AntiSimmetryTask.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
00029
00030
00034
00035
00036 #ifndef __ANTI_SIMMETRY_TASK_H_
00037 #define __ANTI_SIMMETRY_TASK_H_
00038
00039 #include <Task.h>
00040 #include <Resource.h>
00041 #include <MobileRob.h>
00042 #include <SharedMem.h>
00043 #include <CommonOptions.h>
00044 #include <AntiSimmetry.h>
00045 #ifndef MIP_PLATFORM_ARM
00046 #include <DraWin.h>
00047 #endif
00048
00049 using namespace MipAlgorithms;
00050 using namespace MipResources;
00051
00052 namespace MipTasks{
00053
00055
00056
00060 enum AntiSimmetryTaskStates{
00061 ANTISIMMETRY_TASK_FIRST_RUN,
00062 ANTISIMMETRY_TASK_NORMAL_RUN,
00063 ANTISIMMETRY_TASK_STATES_NUM
00064 };
00065
00066
00069 static const char* AntiSimmetryTaskStatesNames[ANTISIMMETRY_TASK_STATES_NUM] = {
00070 "FirstRun",
00071 "NormalRun"
00072 };
00073
00074
00078 class AntiSimmetryTaskOptions : public Options {
00079 public:
00081 StringOption* controlAlgo;
00082
00084 AntiSimmetryTaskOptions();
00085
00086 string getObjectName() const {
00087 return "AntiSimmetryTaskOptions";
00088 }
00089 };
00090
00091
00095 class AntiSimmetryTaskSharedMem : public SharedMem{
00096 public:
00098 void initSharedMem();
00099
00101 bool getDoAutoNavigation();
00102
00104 PoseFeatures getFormation();
00105
00107 PoseFeatures getEstimates();
00108
00110 bool doAutoNavigation();
00111 };
00112
00116 class AntiSimmetryTask : public Task{
00117 private:
00118
00119
00120 static const TaskPlate _plate = ASI_TASK;
00121
00122
00123 static const long int _maxDurSec = 0, _maxDurUsec = 100000;
00124 static const long int _maxSamplPeriodSec = 1, _maxSamplPeriodUsec = 0;
00125 static const long int _minSamplPeriodSec = 0, _minSamplPeriodUsec = 500000;
00126
00127
00128 AntiSimmetry* _antiSimmetry;
00129
00130
00131 MobileRob* _mobileRob;
00132
00133
00134 #ifndef MIP_PLATFORM_ARM
00135 DraWin* _draWin;
00136 unsigned int _drawList;
00137 bool dwOn;
00138 #endif
00139
00140
00141
00142 AntiSimmetryTaskSharedMem* _sharedMem;
00143
00144
00145 AntiSimmetryTaskOptions _options;
00146
00147
00148 int _controlOfIntVariable;
00149 double _controlOfDecimalVariable;
00150 AntiSimmetryTaskStates _state;
00151
00152 vector<Position> _formation;
00153 int _myPosition;
00154 int _myId;
00155 Pose _myPose;
00156 Position _control;
00157
00158
00159 void _firstRun();
00160 void _normalRun();
00161 bool _getOtherRobotPositions();
00162 void _applyControl();
00163 void _draw();
00164
00165 public:
00167 AntiSimmetryTask(ResourcePointers resources,int argc, const char* argv[]);
00168
00170 ~AntiSimmetryTask();
00171
00174 TaskPlate getPlate() const {
00175 return _plate;
00176 }
00179 Time getMaxDuration(){
00180 return Time(_maxDurSec,_maxDurUsec);
00181 }
00184 Time getMaxSamplPeriod(){
00185 return Time(_maxSamplPeriodSec,_maxSamplPeriodUsec);
00186 }
00189 Time getMinSamplPeriod(){
00190 return Time(_minSamplPeriodSec,_minSamplPeriodUsec);
00191 }
00192
00200 TaskOutputs run();
00201 };
00202
00203
00204
00205
00206 };
00207
00208
00209 #endif
00210
00211
00212
00213