00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef _KickSelectionTable_h_
00010 #define _KickSelectionTable_h_
00011
00012 #include "Tools/Math/Vector2.h"
00013 #include "Platform/GTAssert.h"
00014 #include "Representations/Motion/MotionRequest.h"
00015
00016
00017
00018
00019
00020 class KickCase
00021 {
00022 public:
00023
00024 double ballXR;
00025
00026
00027 double ballYR;
00028
00029
00030 unsigned long ballTR;
00031
00032
00033 double ballXS;
00034
00035
00036 double ballYS;
00037
00038
00039 unsigned long ballTS;
00040
00041
00042 double ballXA;
00043
00044
00045 double ballYA;
00046
00047
00048 unsigned long tA;
00049
00050 };
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 class KickSelectionTable
00062 {
00063 public:
00064
00065 KickSelectionTable();
00066
00067
00068 ~KickSelectionTable();
00069
00070
00071 enum ActionID{
00072 nothing = 0,
00073 headLeft,
00074 headRight,
00075 anyLeft,
00076 anyRight,
00077 hookLeft,
00078 hookRight,
00079 leftPaw,
00080 rightPaw,
00081 armLeft,
00082 armRight,
00083 pushSoft,
00084 pushStrong,
00085 chestSoft,
00086 chestStrong,
00087 putRight,
00088 putLeft,
00089 forwardKickFast,
00090 forwardKickHard,
00091 slapRight,
00092 slapLeft,
00093 headLeftSoft,
00094 headRightSoft,
00095 numberOfActions
00096 };
00097
00098
00099 static const char* getActionName(ActionID id)
00100 {
00101 switch (id)
00102 {
00103 case nothing: return "nothing";
00104 case headLeft: return "headLeft";
00105 case headRight: return "headRight";
00106 case anyLeft: return "anyLeft";
00107 case anyRight: return "anyRight";
00108 case hookLeft: return "hookLeft";
00109 case hookRight: return "hookRight";
00110 case leftPaw: return "leftPaw";
00111 case rightPaw: return "rightPaw";
00112 case armLeft: return "armLeft";
00113 case armRight: return "armRight";
00114 case pushSoft: return "pushSoft";
00115 case pushStrong: return "pushStrong";
00116 case chestSoft: return "chestSoft";
00117 case chestStrong: return "chestStrong";
00118 case putRight: return "putRight";
00119 case putLeft: return "putLeft";
00120 case forwardKickFast: return "forwardKickFast";
00121 case forwardKickHard: return "forwardKickHard";
00122 case slapRight: return "slapRight";
00123 case slapLeft: return "slapLeft";
00124 case headLeftSoft: return "headLeftSoft";
00125 case headRightSoft: return "headRightSoft";
00126
00127 default: return "please edit KickSelectionTable::getActionName";
00128 }
00129 }
00130
00131
00132 static const char* getShortActionName(ActionID id)
00133 {
00134 switch (id)
00135 {
00136 case nothing: return "no";
00137 case headLeft: return "head_l";
00138 case headRight: return "head_r";
00139 case anyLeft: return "any_l";
00140 case anyRight: return "any_r";
00141 case hookLeft: return "hook_l";
00142 case hookRight: return "hook_r";
00143 case leftPaw: return "l_paw";
00144 case rightPaw: return "r_paw";
00145 case armLeft: return "arm_l";
00146 case armRight: return "arm_r";
00147 case pushSoft: return "push_so";
00148 case pushStrong: return "pu_str";
00149 case chestSoft: return "che_so";
00150 case chestStrong: return "ch_str";
00151 case putRight: return "put_r";
00152 case putLeft: return "put_l";
00153 case forwardKickFast: return "forw_f";
00154 case forwardKickHard: return "forw_h";
00155 case slapRight: return "slap_r";
00156 case slapLeft: return "slap_l";
00157 case headLeftSoft: return "head_sl";
00158 case headRightSoft: return "head_sr";
00159
00160 default:
00161 ASSERT(false);
00162 return 0;
00163 }
00164 }
00165
00166
00167 enum KickSelectionTableID
00168 {
00169 inCenterOfField,
00170 atLeftBorder,
00171 atRightBorder,
00172 atLeftOpponentBorder,
00173 atRightOpponentBorder,
00174 nearOwnGoal,
00175 goalie,
00176 whenStuck,
00177 numberOfKickSelectionTableIDs
00178 };
00179
00180
00181 static const char* getKickSelectionTableIDName(KickSelectionTableID id)
00182 {
00183 switch (id)
00184 {
00185 case inCenterOfField: return "inCenterOfField";
00186 case atLeftBorder: return "atLeftBorder";
00187 case atRightBorder: return "atRightBorder";
00188 case atLeftOpponentBorder: return "atLeftOpponentBorder";
00189 case atRightOpponentBorder: return "atRightOpponentBorder";
00190 case nearOwnGoal: return "nearOwnGoal";
00191 case goalie: return "goalie";
00192 case whenStuck: return "whenStuck";
00193 default:
00194 ASSERT(false);
00195 return 0;
00196 }
00197 }
00198
00199
00200 static const ActionID getActionIDFromSpecialActionID(SpecialActionRequest::SpecialActionID id)
00201 {
00202 switch (id)
00203 {
00204 case SpecialActionRequest::headLeft: return headLeft;
00205 case SpecialActionRequest::headRight: return headRight;
00206 case SpecialActionRequest::anyLeft: return anyLeft;
00207 case SpecialActionRequest::anyRight: return anyRight;
00208 case SpecialActionRequest::hookLeft: return hookLeft;
00209 case SpecialActionRequest::hookRight: return hookRight;
00210 case SpecialActionRequest::leftPaw: return leftPaw;
00211 case SpecialActionRequest::rightPaw: return rightPaw;
00212 case SpecialActionRequest::armLeft: return armLeft;
00213 case SpecialActionRequest::armRight: return armRight;
00214 case SpecialActionRequest::pushSoft: return pushSoft;
00215 case SpecialActionRequest::pushStrong: return pushStrong;
00216 case SpecialActionRequest::chestSoft: return chestSoft;
00217 case SpecialActionRequest::putRight: return putRight;
00218 case SpecialActionRequest::putLeft: return putLeft;
00219 case SpecialActionRequest::forwardKickFast: return forwardKickFast;
00220 case SpecialActionRequest::forwardKickHard: return forwardKickHard;
00221 case SpecialActionRequest::slapRight: return slapRight;
00222 case SpecialActionRequest::slapLeft: return slapLeft;
00223 case SpecialActionRequest::headLeftSoft: return headLeftSoft;
00224 case SpecialActionRequest::headRightSoft: return headRightSoft;
00225 default: return nothing;
00226 }
00227 }
00228
00229
00230 enum{xRange = 20};
00231
00232
00233 enum{yRange = 40};
00234
00235
00236 enum{numberOfSectors = 12};
00237
00238
00239
00240
00241
00242 ActionID retrieveKick(
00243 double ballOffsetX, double ballOffsetY,
00244 double destinationAngle,
00245 KickSelectionTableID kickSelectionTableID
00246 ) const;
00247
00248
00249 ActionID action[xRange][yRange][numberOfSectors][numberOfKickSelectionTableIDs];
00250
00251
00252 static KickSelectionTableID getTableIDFromName(const char* name);
00253
00254
00255 static ActionID getActionIDFromShortName(const char* name);
00256
00257
00258 void load(const char* fileName);
00259 };
00260
00261
00262
00263
00264
00265
00266
00267 In& operator>>(In& stream, KickSelectionTable& kickSelectionTable);
00268
00269
00270
00271
00272
00273
00274
00275 Out& operator<<(Out& stream, const KickSelectionTable& kickSelectionTable);
00276
00277
00278
00279
00280
00281
00282
00283 In& operator>>(In& stream, KickCase& kickCase);
00284
00285
00286
00287
00288
00289
00290
00291 Out& operator<<(Out& stream, const KickCase& kickCase);
00292
00293
00294 #endif // _KickSelectionTable_h_
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402