]> rtime.felk.cvut.cz Git - eurobot/public.git/blob - src/robodim/robodim.h
robodim.h: ACROPOLIS_CENTER_X, resp ..._Y coords defined
[eurobot/public.git] / src / robodim / robodim.h
1 /*
2  * robodim_eb2008.h                     08/04/18
3  *
4  * Dimensions for the robot, playground and other stuffs.
5  * Eurobot 2008
6  *
7  * Copyright: (c) 2008 CTU Dragons
8  *            CTU FEE - Department of Control Engineering
9  * License: GNU GPL v.2
10  */
11
12 #ifndef ROBODIM_EB2008_H
13 #define ROBODIM_EB2008_H
14
15 /**
16  * FIXME: update robot's dimensions !!!
17  *
18  * ROBOT DIMENSIONS 
19  *                                   S0
20  *       S4 +--------------------------+ S2
21  *        ^ |   |     |                |--,
22  *     ^  | |   -------    ABE         |   |
23  *   RR|  | |      :<--------------------->|
24  *     v  | |      :             __    |--' 
25  *       W| |      + Center  (L)|__|   |    
26  *        | |  AB  :       AF    HOK   |--,
27  *        | |<---->:<----------------->|   |
28  *        | |   -------                |   |
29  *        v |   |     |                |--' 
30  *       S5 +--------------------------+ S3
31  *                 <-->              S1
32  *                  WR
33  * 
34  * Sx - Sharp sensor
35  */
36
37 /* FIXME needs update (?) // comment added by Filip */
38 #define ROBOT_WIDTH_MM 290      /* W*/
39 #define ROBOT_WIDTH_M (ROBOT_WIDTH_MM/1000.0)
40 #define ROBOT_ROTATION_RADIUS_MM (275/2) /* RR */
41 #define ROBOT_ROTATION_RADIUS_M (ROBOT_ROTATION_RADIUS_MM/1000.0)
42 #define LASER_CENTER_OFFSET_MM 50 /*FIXME*/ /* Distance of the laser from rotation axis (Center to L) */
43 #define LASER_CENTER_OFFSET_M (LASER_CENTER_OFFSET_MM/1000.0)
44 #define ROBOT_WHEEL_RADIUS_MM 40 /* WR */
45 #define ROBOT_WHEEL_RADIUS_M (ROBOT_WHEEL_RADIUS_MM/1000.0)
46 #define ROBOT_AXIS_TO_BACK_MM 75 /* AB */
47 #define ROBOT_AXIS_TO_BACK_M (ROBOT_AXIS_TO_BACK_MM/1000.0)
48 #define ROBOT_AXIS_TO_FRONT_MM 183 /* AF */
49 #define ROBOT_AXIS_TO_FRONT_M (ROBOT_AXIS_TO_FRONT_MM/1000.0)
50 #define ROBOT_AXIS_TO_BRUSH_MM 280 /* ABE */
51 #define ROBOT_AXIS_TO_BRUSH_M (ROBOT_AXIS_TO_BRUSH_MM/1000.0)
52 #define HOKUYO_CENTER_OFFSET_MM 170
53 #define HOKUYO_CENTER_OFFSET_M (HOKUYO_CENTER_OFFSET_MM/1000.0)
54
55 #define ROBOT_AXIS_TO_PUCK_M 0.2 // puck approach distance
56 #define PUCK_REACHABLE(x) ((x<0.13)?true:false)
57 #define PUCK_INSIDE(x) ((x<=0.055)?true:false)
58
59 /**
60  * PLAYGROUND DIMENSIONS
61  * 
62  *            S2                                                                  R3
63  *            +---------------------------------+---------------------------------+
64  *        ^   |                                                              [W,H]|
65  *        |   |                                                                   |
66  *        |   |                                                                   |
67  *        |   |^                                                                 ^|
68  *        |   ||        G    G    G                           G    G    G        ||
69  *        |   ||                                                                 ||
70  *        |   |O?       G    G    G                           G    G    G        ||
71  *        |   ||                                                                 ||
72  *      H | R1+|        G    G    G                           G    G    G        |+ S1
73  *        |   ||                                                                 ||
74  *        |   ||        G    G    G                           G    G    G       ?T|
75  *        |   ||                                                                 ||
76  *        |   ||                                                                 ||
77  *        |   |v                                                                 v|
78  *        |   |                                                                   |
79  *        |   |                                                                   |
80  *        v   |[0,0]  O                                                   S       |
81  *            +---------------------------------+---------------------------------+
82  *            S3                                                                  R2
83  *             <----------------------------------------------------------------->
84  *                                              W
85  *
86  *                 G  - grid for pucks
87  *                 O? - opponent's "travelling" dispenser
88  *                 O  - opponent's static dispenser
89  *                 S  - our static dispenser
90  *                 ?T - our travelling dispenser
91  *
92  */
93 #define PLAYGROUND_WIDTH_MM     3000
94 #define PLAYGROUND_WIDTH_M      (PLAYGROUND_WIDTH_MM/1000.0)
95 #define PLAYGROUND_HEIGHT_MM    2100
96 #define PLAYGROUND_HEIGHT_M     (PLAYGROUND_HEIGHT_MM/1000.0)
97
98 #define ACROPOLIS_CENTER_X      (PLAYGROUND_WIDTH_M/2.0)
99 #define ACROPOLIS_CENTER_Y      (PLAYGROUND_HEIGHT_M/2.0)
100 #define ACROPOLIS_RADIUS        0.35
101
102 /**
103  * PUCK DISPENSERS (= COLUMN ELEMENT DISPENSERS)
104  */
105 #define STATIC_DISPENSER_X_OFFSET       0.289
106 #define DISPENSER_TO_CUSHION_DISTANCE   0.04
107 #define STATIC_DISPENSER_X              (PLAYGROUND_WIDTH_M - STATIC_DISPENSER_X_OFFSET)
108 #define STATIC_DISPENSER_Y              DISPENSER_TO_CUSHION_DISTANCE
109 #define TRAVELLING_DISPENSER_X          (PLAYGROUND_WIDTH - DISPENSER_TO_CUSHION_DISTANCE)      // in the "PLAYGROUND DIMENSIONS" ASCII art: O?
110 // y coordinate of the travelling dispenser is not known in advance                             // in the "PLAYGROUND DIMENSIONS" ASCII art: O?
111 #define OPPONENTS_STATIC_DISPENSER_X    STATIC_DISPENSER_X_OFFSET                               // in the "PLAYGROUND DIMENSIONS" ASCII art: O
112 #define OPPONENTS_STATIC_DISPENSER_Y    DISPENSER_TO_CUSHION_DISTANCE                           // in the "PLAYGROUND DIMENSIONS" ASCII art: O
113
114 /**
115  * FREE PUCKS POSITIONS
116  */
117 #define PUCK_GRID_X_OFFSET      0.6
118 #define PUCK_GRID_Y_OFFSET      0.925
119 #define PUCK_GRID_DELTA_X       0.25
120 #define PUCK_GRID_DELTA_Y       0.2
121 #define PUCK_GRID_ROWS_NUM      4
122 #define PUCK_GRID_COLS_NUM      3
123
124 struct puck_pos {
125         float x, y;             /* In meters */
126 };
127
128 /*
129  * boolean: free_puck_present[lot][ny][nx]
130  */
131 extern const char free_puck_present[10][4][3];
132
133 /*
134  * tells, whether a puck is placed in grid at nx, ny
135  * (lot=0..9, nx=0..2, ny=0..3)
136  */
137 #define FREE_PUCK_PRESENT(lot,nx,ny) (free_puck_present[lot][y][x])
138
139 /*
140  * returns position of a free puck
141  * (nx=0..2, ny=0..3)
142  *
143  * !WARNING! The positions assume WE_ARE_GREEN
144  * The pucks are sorted according to growing x, y,
145  * ie. the nearest puck to the start position is @nx=0,ny=3
146  * (yes, a stupid coord system...)
147  */
148 static inline struct puck_pos free_puck_pos(int nx, int ny) {
149         struct puck_pos pos = {PUCK_GRID_X_OFFSET + nx*PUCK_GRID_DELTA_X,
150                                PUCK_GRID_Y_OFFSET + ny*PUCK_GRID_DELTA_Y};
151         return pos;
152 }
153
154 /**
155  * BASKET
156  */
157 #define BASKET_WIDTH            0.5
158 #define BASKET_HEIGHT           0.34
159 #define BASKET_VERT_OFFSET      0.35
160
161 #define BLUE_BASKET_TARGET_X    PLAYGROUND_WIDTH_M
162 #define BLUE_BASKET_TARGET_Y    (BASKET_WIDTH/2.0)
163
164 #define RED_BASKET_TARGET_X     0
165 #define RED_BASKET_TARGET_Y     (BASKET_WIDTH/2.0)
166
167 /*
168  * 3 ultrasonic beacons
169  */
170 #define BEACON_WIDTH            0.08
171 #define BEACON_HEIGHT           BEACON_WIDTH
172
173 #define BEACON_GREEN            0
174 #define BEACON_RED              1
175 #define BEACON_CNT              3
176
177 struct beacon_pos {
178         float x, y;
179 };
180
181 extern const struct beacon_pos beacon_green[BEACON_CNT];
182 extern const struct beacon_pos beacon_red[BEACON_CNT];
183
184 /*
185  * Position of Shapr sensors on the robot with respect to the robot center
186  * (not used in EB2009)
187  */
188 struct sharp_pos {
189         float x, y, ang;
190 };
191
192 #define SHARP_COUNT 0  /* no sharp sensors in EB2009, I hope */
193
194 #endif /* ROBODIM_EB2008_H */