00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __DebugDrawings_h_
00010 #define __DebugDrawings_h_
00011
00012 #include "Tools/Debugging/Debugging.h"
00013 #include "Tools/Debugging/DebugKeyTable.h"
00014
00015
00016
00017 #include "DebugDrawings2.h"
00018
00019
00020
00021
00022
00023 class Drawings
00024 {
00025 public:
00026
00027
00028
00029
00030 enum ShapeType
00031 {
00032 circle, filledCircle, line, dot, largeDot, octangle, arrow, coloredLine, midDot
00033 };
00034
00035
00036
00037
00038
00039 enum FieldDrawing
00040 {
00041
00042 fieldPolygons,
00043 fieldLines,
00044
00045
00046 percepts_ballFlagsGoalsField,
00047 percepts_obstaclesAndPSDField,
00048 percepts_specialField,
00049 percepts_robot,
00050 lineCrossingsField,
00051 multipleBallPerceptsField,
00052 circlePoints_Field,
00053
00054
00055 worldStateOracle,
00056 worldStateGTCam,
00057 worldState,
00058 worldStateRemoteCam,
00059 models_obstaclesField,
00060
00061
00062 selfLocatorField,
00063 ballLocatorField,
00064 goaliePositionField,
00065 headControlField,
00066 teamBallLocatorFieldParticles,
00067 teamBallLocatorField,
00068 comboBallLocatorField,
00069 comboTeamBallLocatorField,
00070 playerModelField,
00071
00072
00073 behavior_CBBVector,
00074 behavior_CBBWay,
00075 behavior_kickAngles,
00076 behavior_aStarSearch,
00077
00078 dribbleBall,
00079
00080 logAnalyzer,
00081 logAnalyzerDots,
00082
00083
00084 firstDrawingInRadarViewer,
00085 percepts_ballFlagsGoalsRadar = firstDrawingInRadarViewer,
00086 percepts_obstaclesAndPSDRadar,
00087 models_obstaclesRadar,
00088 models_corridorsRadar,
00089 behavior_kickAnglesRadar,
00090
00091 numberOfFieldDrawings
00092 };
00093
00094
00095
00096
00097
00098 enum ImageDrawing
00099 {
00100 percepts_ball,
00101 percepts_flagsGoals,
00102 percepts_freePartOfGoal,
00103 percepts_lines,
00104 percepts_edges,
00105 percepts_obstacles,
00106 percepts_psd,
00107 percepts_special,
00108 models_obstacles,
00109 models_freePartOfGoal,
00110 selfLocator,
00111 imageProcessor_general,
00112 imageProcessor_horizon,
00113 imageProcessor_scanLines,
00114 imageProcessor_coloredSegments1,
00115 imageProcessor_coloredSegments2,
00116 imageProcessor_coloredSegments3,
00117 imageProcessor_calibration1,
00118 imageProcessor_calibration2,
00119 imageProcessor_ball1,
00120 imageProcessor_ball2,
00121 imageProcessor_ball3,
00122 imageProcessor_ball4,
00123 imageProcessor_ground,
00124 imageProcessor_flagsAndGoals,
00125 imageProcessor_obstacles,
00126 imageProcessor_gradients,
00127 imageProcessor_edges,
00128 imageProcessor_lines,
00129 imageProcessor_linefragments,
00130 imageProcessor_robot_detection,
00131 sketch,
00132 imageProcessor_multipleBallPercepts,
00133 circlePoints_image,
00134 numberOfImageDrawings
00135 };
00136
00137 enum TypeOfDrawing
00138 {
00139 drawingOnField,
00140 drawingOnImage
00141 };
00142
00143 static TypeOfDrawing getTypeOfDrawing(FieldDrawing) {return drawingOnField;}
00144 static TypeOfDrawing getTypeOfDrawing(ImageDrawing) {return drawingOnImage;}
00145
00146
00147
00148
00149
00150 static const char* getDrawingName(FieldDrawing fieldDrawing)
00151 {
00152 switch (fieldDrawing)
00153 {
00154 case fieldPolygons: return "field polygons";
00155 case fieldLines: return "field lines";
00156
00157 case percepts_ballFlagsGoalsField: return "percepts: ball; flags; goals";
00158 case percepts_obstaclesAndPSDField: return "percepts: obstacles; PSD";
00159 case percepts_specialField: return "percepts: special";
00160 case percepts_robot:return "percepts: robot";
00161
00162 case worldStateOracle: return "world state oracle";
00163 case worldState: return "world state";
00164 case worldStateRemoteCam: return "remote camera world state";
00165 case worldStateGTCam: return "GTCam world state";
00166 case models_obstaclesField: return "models: obstacles";
00167
00168 case selfLocatorField: return "self locator";
00169 case ballLocatorField: return "ball locator";
00170 case goaliePositionField: return "goalie position";
00171 case headControlField: return "head control";
00172 case teamBallLocatorFieldParticles: return "team ball locator particles";
00173 case teamBallLocatorField: return "team ball locator";
00174 case comboBallLocatorField: return "combo ball locator";
00175 case comboTeamBallLocatorField: return "combo team ball locator";
00176 case playerModelField: return "player model";
00177
00178 case behavior_CBBVector: return "behavior: CBBVector";
00179 case behavior_CBBWay: return "behavior: CBBWay";
00180 case behavior_kickAngles: return "behavior: kick angles";
00181 case behavior_aStarSearch: return "behavior: A* search tree";
00182 case dribbleBall: return "dribble Ball";
00183 case logAnalyzer: return "logfile analyzer lines";
00184 case logAnalyzerDots: return "logfile analyzer dots";
00185
00186 case percepts_ballFlagsGoalsRadar: return "radar - percepts: ball; flags; goals";
00187 case percepts_obstaclesAndPSDRadar: return "radar - percepts: obstacles; PSD";
00188 case models_obstaclesRadar: return "radar - models: obstacles";
00189 case models_corridorsRadar: return "radar - models: corridors";
00190 case behavior_kickAnglesRadar: return "radar - behavior: kick angles";
00191
00192 case lineCrossingsField: return "line crossings";
00193 case multipleBallPerceptsField: return "multiple ball percepts";
00194 case circlePoints_Field: return "circlePoints_Field";
00195
00196 default: return "check available drawings";
00197 }
00198 }
00199
00200
00201
00202
00203
00204 static const char* getDrawingName(ImageDrawing imageDrawing)
00205 {
00206 switch (imageDrawing)
00207 {
00208 case percepts_ball: return "percepts: ball";
00209 case percepts_flagsGoals: return "percepts: flags; goals";
00210 case percepts_freePartOfGoal: return "percepts: free part of goal";
00211 case percepts_lines: return "percepts: lines";
00212 case percepts_edges: return "percepts: edges";
00213 case percepts_obstacles: return "percepts: obstacles";
00214 case percepts_psd: return "percepts: psd";
00215 case percepts_special: return "percepts: special";
00216 case models_obstacles: return "models: obstacles";
00217 case models_freePartOfGoal: return "models: free part of goal";
00218 case selfLocator: return "self locator";
00219 case imageProcessor_general: return "image processor: general";
00220 case imageProcessor_horizon: return "image processor: horizon";
00221 case imageProcessor_scanLines: return "image processor: scan lines";
00222 case imageProcessor_coloredSegments1: return "image processor: colored segments1";
00223 case imageProcessor_coloredSegments2: return "image processor: colored segments2";
00224 case imageProcessor_coloredSegments3: return "image processor: colored segments3";
00225 case imageProcessor_calibration1: return "image processor: calibration 1";
00226 case imageProcessor_calibration2: return "image processor: calibration 2";
00227 case imageProcessor_ball1: return "image processor: ball 1";
00228 case imageProcessor_ball2: return "image processor: ball 2";
00229 case imageProcessor_ball3: return "image processor: ball 3";
00230 case imageProcessor_ball4: return "image processor: ball 4";
00231 case imageProcessor_ground: return "image processor: ground";
00232 case imageProcessor_flagsAndGoals: return "image processor: flags; goals";
00233 case imageProcessor_obstacles: return "image processor: obstacles";
00234 case imageProcessor_gradients: return "image processor: gradients";
00235 case imageProcessor_edges: return "image processor: edges";
00236 case imageProcessor_lines: return "image processor: lines";
00237 case imageProcessor_linefragments: return "image processor: linefragments";
00238 case imageProcessor_robot_detection: return "image processor: robot detection";
00239 case sketch: return "sketch";
00240 case imageProcessor_multipleBallPercepts: return "imageProcessor: multiple ball percepts";
00241 case circlePoints_image: return "circlePoints_image";
00242 default: return "check available drawings";
00243 }
00244 }
00245
00246 static bool getDebugKeyID(enum FieldDrawing fieldDrawing, DebugKeyTable::debugKeyID& debugKeyID)
00247 {
00248 switch (fieldDrawing)
00249 {
00250 case selfLocatorField: debugKeyID = DebugKeyTable::send_selfLocatorField_drawing; return true;
00251 case ballLocatorField: debugKeyID = DebugKeyTable::send_ballLocatorField_drawing; return true;
00252 case goaliePositionField: debugKeyID = DebugKeyTable::send_goaliePositionField_drawing; return true;
00253 case headControlField: debugKeyID = DebugKeyTable::send_headControlField_drawing; return true;
00254 case playerModelField: debugKeyID = DebugKeyTable::send_playerModelField_drawing; return true;
00255 case teamBallLocatorFieldParticles: debugKeyID = DebugKeyTable::send_teamBallLocatorFieldParticles_drawing; return true;
00256 case teamBallLocatorField: debugKeyID = DebugKeyTable::send_teamBallLocatorField_drawing; return true;
00257 case comboBallLocatorField: debugKeyID = DebugKeyTable::send_comboBallLocatorField_drawing; return true;
00258 case comboTeamBallLocatorField: debugKeyID = DebugKeyTable::send_comboTeamBallLocatorField_drawing; return true;
00259
00260 case behavior_CBBVector: debugKeyID = DebugKeyTable::send_behavior_CBBVector_drawing; return true;
00261 case behavior_CBBWay: debugKeyID = DebugKeyTable::send_behavior_CBBWay_drawing; return true;
00262 case behavior_kickAngles: debugKeyID = DebugKeyTable::send_behavior_kickAngles_drawing; return true;
00263 case behavior_aStarSearch: debugKeyID = DebugKeyTable::send_behavior_aStarSearch_drawing; return true;
00264 case dribbleBall: debugKeyID = DebugKeyTable::send_dribbleBall_drawing; return true;
00265
00266 case models_corridorsRadar: debugKeyID = DebugKeyTable::send_models_corridorsRadar_drawing; return true;
00267 case behavior_kickAnglesRadar: debugKeyID = DebugKeyTable::send_behavior_kickAnglesRadar_drawing; return true;
00268 case percepts_robot: debugKeyID = DebugKeyTable::send_percepts_robot_drawing; return true;
00269
00270 case lineCrossingsField: debugKeyID = DebugKeyTable::send_lineCrossingsField_drawing; return true;
00271 case multipleBallPerceptsField: debugKeyID = DebugKeyTable::send_multipleBallPerceptsField_drawing; return true;
00272 case circlePoints_Field: debugKeyID = DebugKeyTable::send_circlePoints_Field_drawing; return true;
00273 default: return false;
00274 }
00275 }
00276
00277 static bool getDebugKeyID(enum ImageDrawing imageDrawing, DebugKeyTable::debugKeyID& debugKeyID)
00278 {
00279 switch (imageDrawing)
00280 {
00281 case selfLocator: debugKeyID = DebugKeyTable::send_selfLocator_drawing; return true;
00282 case imageProcessor_general: debugKeyID = DebugKeyTable::send_imageProcessor_general_drawing; return true;
00283 case imageProcessor_horizon: debugKeyID = DebugKeyTable::send_imageProcessor_horizon_drawing; return true;
00284 case imageProcessor_scanLines: debugKeyID = DebugKeyTable::send_imageProcessor_scanLines_drawing; return true;
00285 case imageProcessor_coloredSegments1: debugKeyID = DebugKeyTable::send_imageProcessor_coloredSegments1_drawing; return true;
00286 case imageProcessor_coloredSegments2: debugKeyID = DebugKeyTable::send_imageProcessor_coloredSegments2_drawing; return true;
00287 case imageProcessor_coloredSegments3: debugKeyID = DebugKeyTable::send_imageProcessor_coloredSegments3_drawing; return true;
00288 case imageProcessor_calibration1: debugKeyID = DebugKeyTable::send_imageProcessor_calibration1_drawing; return true;
00289 case imageProcessor_calibration2: debugKeyID = DebugKeyTable::send_imageProcessor_calibration2_drawing; return true;
00290 case imageProcessor_ball1: debugKeyID = DebugKeyTable::send_imageProcessor_ball1_drawing; return true;
00291 case imageProcessor_ball2: debugKeyID = DebugKeyTable::send_imageProcessor_ball2_drawing; return true;
00292 case imageProcessor_ball3: debugKeyID = DebugKeyTable::send_imageProcessor_ball3_drawing; return true;
00293 case imageProcessor_ball4: debugKeyID = DebugKeyTable::send_imageProcessor_ball4_drawing; return true;
00294 case imageProcessor_ground: debugKeyID = DebugKeyTable::send_imageProcessor_ground_drawing; return true;
00295 case imageProcessor_flagsAndGoals: debugKeyID = DebugKeyTable::send_imageProcessor_flagsAndGoals_drawing; return true;
00296 case imageProcessor_obstacles: debugKeyID = DebugKeyTable::send_imageProcessor_obstacles_drawing; return true;
00297 case imageProcessor_gradients: debugKeyID = DebugKeyTable::send_imageProcessor_gradients_drawing; return true;
00298 case imageProcessor_edges: debugKeyID = DebugKeyTable::send_imageProcessor_edges_drawing; return true;
00299 case imageProcessor_lines: debugKeyID = DebugKeyTable::send_imageProcessor_lines_drawing; return true;
00300 case imageProcessor_linefragments: debugKeyID = DebugKeyTable::send_imageProcessor_linefragments_drawing; return true;
00301 case imageProcessor_robot_detection: debugKeyID = DebugKeyTable::send_imageProcessor_robot_detection_drawing; return true;
00302 case sketch: debugKeyID = DebugKeyTable::send_sketch_drawing; return true;
00303 case imageProcessor_multipleBallPercepts: debugKeyID = DebugKeyTable::send_imageProcessor_multipleBallPercepts_drawing; return true;
00304 case circlePoints_image: debugKeyID = DebugKeyTable::send_circlePoints_image_drawing; return true;
00305 default: return false;
00306 }
00307 }
00308
00309
00310 enum PenStyle
00311 {
00312 ps_solid, ps_dash, ps_dot, ps_null
00313 };
00314
00315
00316 enum FillStyle
00317 {
00318 bs_solid, bs_null
00319 };
00320
00321
00322 enum Color
00323 {
00324 red, green, blue, yellow, orange, pink, skyblue, white, light_gray, gray, dark_gray, black, yellowOrange, numberOfColors
00325 };
00326
00327 };
00328
00329 #ifdef NDEBUG
00330 #define NODEBUGDRAWINGS
00331 #endif
00332 #ifdef NO_DEBUG_DRAWING
00333 #define NODEBUGDRAWINGS
00334 #endif
00335
00336 #ifdef NODEBUGDRAWINGS
00337 #define CIRCLE(id, center_x, center_y, radius, penWidth, penStyle, penColor)
00338 #define DOT(id, x, y, penColor, fillColor)
00339 #define MID_DOT(id, x, y, penColor, fillColor)
00340 #define LARGE_DOT(id, x, y, penColor, fillColor)
00341 #define ARROW(id, x1, y1, x2, y2, penWidth, penStyle, penColor)
00342 #define LINE(id, x1, y1, x2, y2, penWidth, penStyle, penColor)
00343 #define COLORED_LINE(id, x1, y1, x2, y2, penWidth, penStyle, penColorR, penColorG, penColorB)
00344 #define POSE_2D_SAMPLE(id, p, color)
00345 #define OCTANGLE(id, x1,y1,x2,y2,x3,y3,x4,y4,x5,y5,x6,y6,x7,y7,x8,y8, color, fill)
00346 #define QUADRANGLE(id, x1,y1,x2,y2,x3,y3,x4,y4, penWidth, penStyle, penColor)
00347 #define RECTANGLE(id, x1,y1,x2,y2, penWidth, penStyle, penColor)
00348 #define CROSS(id, x, y, size, penWidth, penStyle, penColor)
00349
00350 #define COMPLEX_DRAWING(id,expression)
00351 #define DEBUG_DRAWING_FINISHED(id)
00352
00353 #else //NODEBUGDRAWINGS
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365 #define CIRCLE(id, center_x, center_y, radius, penWidth, penStyle, penColor) \
00366 INFO(send_##id##_drawing, idDebugDrawing2, bin, \
00367 (char)Drawings::circle << \
00368 (char)Drawings::id << \
00369 (char)Drawings::getTypeOfDrawing(Drawings::id) << \
00370 (int)(center_x) << (int)(center_y) << (int)(radius) << (char)(penWidth) << \
00371 (char)(penStyle) << (char)(penColor) \
00372 );
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382 #define DOT(id, x, y, penColor, fillColor) \
00383 INFO(send_##id##_drawing, idDebugDrawing2, bin, \
00384 (char)Drawings::dot << \
00385 (char)Drawings::id << \
00386 (char)Drawings::getTypeOfDrawing(Drawings::id) << \
00387 (int)(x) << (int)(y) << (char)(penColor) << (char)(fillColor) \
00388 );
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399 #define MID_DOT(id, x, y, penColor, fillColor) \
00400 INFO(send_##id##_drawing, idDebugDrawing2, bin, \
00401 (char)Drawings::midDot << \
00402 (char)Drawings::id << \
00403 (char)Drawings::getTypeOfDrawing(Drawings::id) << \
00404 (int)(x) << (int)(y) << (char)(penColor) << (char)(fillColor) \
00405 );
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415 #define LARGE_DOT(id, x, y, penColor, fillColor) \
00416 INFO(send_##id##_drawing, idDebugDrawing2, bin, \
00417 (char)Drawings::largeDot << \
00418 (char)Drawings::id << \
00419 (char)Drawings::getTypeOfDrawing(Drawings::id) << \
00420 (int)(x) << (int)(y) << (char)(penColor) << (char)(fillColor) \
00421 );
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434 #define LINE(id, x1, y1, x2, y2, penWidth, penStyle, penColor) \
00435 INFO(send_##id##_drawing, idDebugDrawing2, bin, \
00436 (char)Drawings::line << \
00437 (char)Drawings::id << \
00438 (char)Drawings::getTypeOfDrawing(Drawings::id) << \
00439 (int)(x1) << (int)(y1) << (int)(x2) << (int)(y2) << (char)(penWidth) << (char)(penStyle) << (char)(penColor) \
00440 );
00441
00442 #define COLORED_LINE(id, x1, y1, x2, y2, penWidth, penStyle, penColorR, penColorG, penColorB) \
00443 INFO(send_##id##_drawing, idDebugDrawing2, bin, \
00444 (char)Drawings::coloredLine << \
00445 (char)Drawings::id << \
00446 (char)Drawings::getTypeOfDrawing(Drawings::id) << \
00447 (int)(x1) << (int)(y1) << (int)(x2) << (int)(y2) << (char)(penWidth) << (char)(penStyle) << (char)(penColorR) << (char)(penColorG) << (char)(penColorB)\
00448 );
00449
00450 #define CROSS(id, x, y, size, penWidth, penStyle, penColor)\
00451 LINE(id, x+size, y+size, x-size,y-size, penWidth, penStyle, penColor);\
00452 LINE(id, x+size, y-size, x-size,y+size, penWidth, penStyle, penColor);
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468 #define ARROW(id, x1, y1, x2, y2, penWidth, penStyle, penColor) \
00469 INFO(send_##id##_drawing, idDebugDrawing2, bin, \
00470 (char)Drawings::arrow << \
00471 (char)Drawings::id << \
00472 (char)Drawings::getTypeOfDrawing(Drawings::id) << \
00473 (int)(x1) << (int)(y1) << (int)(x2) << (int)(y2) << (char)(penWidth) << (char)(penStyle) << (char)(penColor) \
00474 );
00475
00476
00477
00478
00479
00480
00481
00482
00483 #define POSE_2D_SAMPLE(id, p, color) \
00484 Pose2D current = p; current += Pose2D(-100,0); \
00485 LINE(id, int(current.translation.x),int(current.translation.y), int(p.translation.x), int(p.translation.y), \
00486 1, Drawings::ps_solid, color); \
00487 current = p; current += Pose2D(-40,-40); \
00488 LINE(id, int(current.translation.x), int(current.translation.y), int(p.translation.x), int(p.translation.y), \
00489 1, Drawings::ps_solid, color); \
00490 current = p; current += Pose2D(-40,40); \
00491 LINE(id, int(current.translation.x),int(current.translation.y),int(p.translation.x), int(p.translation.y), \
00492 1, Drawings::ps_solid, color); \
00493
00494
00495
00496
00497
00498
00499
00500
00501 #define OCTANGLE(id, x1,y1,x2,y2,x3,y3,x4,y4,x5,y5,x6,y6,x7,y7,x8,y8, color, fill) \
00502 INFO(send_##id##_drawing, idDebugDrawing2, bin, \
00503 (char)Drawings::octangle << \
00504 (char)Drawings::id << \
00505 (char)Drawings::getTypeOfDrawing(Drawings::id) << \
00506 (int)(x1) << (int)(y1) << (int)(x2) << (int)(y2) << (int)(x3) << (int)(y3) << (int)(x4) << (int)(y4) << \
00507 (int)(x5) << (int)(y5) << (int)(x6) << (int)(y6) << (int)(x7) << (int)(y7) << (int)(x8) << (int)(y8) << \
00508 (char)ColorClasses::colorClassToDrawingsColor(color) << (char)fill \
00509 );
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519 #define QUADRANGLE(id, x1,y1,x2,y2,x3,y3,x4,y4, penWidth, penStyle, penColor) \
00520 LINE(id, x1, y1, x2, y2, penWidth, penStyle, penColor); \
00521 LINE(id, x2, y2, x3, y3, penWidth, penStyle, penColor); \
00522 LINE(id, x3, y3, x4, y4, penWidth, penStyle, penColor); \
00523 LINE(id, x4, y4, x1, y1, penWidth, penStyle, penColor);
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533 #define RECTANGLE(id, x1,y1,x2,y2, penWidth, penStyle, penColor) \
00534 LINE(id, x1, y1, x1, y2, penWidth, penStyle, penColor); \
00535 LINE(id, x1, y2, x2, y2, penWidth, penStyle, penColor); \
00536 LINE(id, x2, y2, x2, y1, penWidth, penStyle, penColor); \
00537 LINE(id, x2, y1, x1, y1, penWidth, penStyle, penColor);
00538
00539
00540
00541
00542 #define COMPLEX_DRAWING(id,expression) \
00543 if (getDebugKeyTable().isActive(DebugKeyTable::send_##id##_drawing)) {\
00544 expression;\
00545 }
00546
00547
00548
00549
00550
00551 #define DEBUG_DRAWING_FINISHED(id) \
00552 INFO(send_##id##_drawing, idDebugDrawingFinished, bin, (char)Drawings::id << (char)Drawings::getTypeOfDrawing(Drawings::id) );
00553
00554 #endif //NODEBUGDRAWINGS
00555 #endif //__DebugDrawings_h_
00556