summaryrefslogtreecommitdiffstats
path: root/source/Concept/Framework/defines.h
blob: a86282ccaffda03a8a0559bcbd3027219060134d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
#ifndef _DEFINES_H
#define _DEFINES_H

#ifndef NULL
#define NULL 0
#endif

//Integer definition
#ifndef int8
	#ifdef __int8
		#define int8 __int8
	#else
		#define int8 char
	#endif
#endif

#ifndef int16
	#ifdef __int16
		#define int16 __int16
	#else
		#define int16 int
	#endif
#endif

#ifndef int32
	#ifdef __int32
		#define int32 __int32
	#else
		#define int32 long
	#endif
#endif

#ifndef int64
	#ifdef __int64
		#define int64 __int64
	#else
		#define int64 long long
	#endif
#endif

//Unsigned
#ifndef uint8
#define uint8 unsigned int8
#endif

#ifndef uint16
#define uint16 unsigned int16
#endif

#ifndef uint32
#define uint32 unsigned int32
#endif

#ifndef uint64
#define uint64 unsigned int64
#endif

//Constants
#define SPEED_PER_PWM 1
#define DISTANCE_PER_VALUE 1
#define TICKS_PER_CM 205.0f
//#define TICKS_PER_CM 90.0f
#define ULTRASONIC_PER_CM 2.0f

#define WIRELESS_ACTIVE false

#define PI 3.14159265358979323846f
#define CYCLES_PER_CORRECTION 20
#define EMPTY_FLOAT 81188.1484f

#define BALL_HELD_INTENSITY 900

#define KEEPER_LEFT_ANGLE 20.0f * PI / 180.0f
#define KEEPER_RIGHT_ANGLE (2 * PI) - (20.0f * PI / 180.0f)

#define COMMAND_BUFFER_SIZE 20

#define DEFAULT_SPEED 200
#define DEFAULT_ROTATION_SPEED 200

#define AREA_BOUNDS_X 20000.0f
#define AREA_BOUNDS_Y 5000.0f

#define WALL_DISTANCE_TOLERANCE 30.0f
#define ENEMY_ROBOT_RADIUS 40.0f

#define HOME_LOC_X -500.0f
#define HOME_LOC_Y 0
#define ENEMY_LOC_X 500.0f
#define ENEMY_LOC_Y 0
#define DEFENCE_L_LOC_X -500.0f
#define DEFENCE_L_LOC_Y 70.0f
#define DEFENCE_R_LOC_X -500.0f
#define DEFENCE_R_LOC_Y -70.0f

#define DISTANCE_TOLERANCE 1.0f
#define ORIENTATION_TOLERANCE 0.1f

#define MAX_OBSTACLE_COUNT 20

#define OBSTACLE_DECAY 100

#define BALL_DIRECTION_FRONT_L 45.0f * PI / 180.0f
#define BALL_DIRECTION_FRONT_R 315.0f * PI / 180.0f

#define WIRELESS_CODE "SPASS!"
enum WirelessCommands
{
	WLESS_CMD_CONFIRM,
	WLESS_CMD_RECIEVED_BALL,
};

//IO Module Names
enum IOModuleNames
{
	//General
	IO_START,

	//Engines
	IO_ENGINE_START = IO_START,

	IO_ENGINE_DRIVE_LEFT = IO_ENGINE_START,
	IO_ENGINE_DRIVE_RIGHT,
	IO_ENGINE_DRIVE_BACK,

	IO_ENGINE_END,

	//Dribbler

	IO_DRIBBLER_START = IO_ENGINE_END,

	IO_DRIBBLER_MAIN = IO_DRIBBLER_START,

	IO_DRIBBLER_END,

	//Kicker

	IO_KICKER_START = IO_DRIBBLER_END,

	IO_KICKER_MAIN = IO_KICKER_START,

	IO_KICKER_END,

	// Aktuator

	IO_AKTUATOR_START = IO_KICKER_END,

	IO_AKTUATOR_MAIN = IO_AKTUATOR_START,

	IO_AKTUATOR_END,

	// Wireless

	IO_WIRELESS_START = IO_AKTUATOR_END,

	IO_WIRELESS_MAIN = IO_WIRELESS_START,

	IO_WIRELESS_END,
	
	//Sensors
	IO_SENSOR_START = IO_WIRELESS_END,

	IO_SENSOR_IR_0_DEG = IO_SENSOR_START,
	IO_SENSOR_IR_30_DEG,
	IO_SENSOR_IR_60_DEG,
	IO_SENSOR_IR_100_DEG,
	IO_SENSOR_IR_180_DEG,
	IO_SENSOR_IR_260_DEG,
	IO_SENSOR_IR_300_DEG,
	IO_SENSOR_IR_330_DEG,
	IO_SENSOR_DISTANCE_0_DEG,
	IO_SENSOR_DISTANCE_90_DEG,
	IO_SENSOR_DISTANCE_180_DEG,
	IO_SENSOR_DISTANCE_270_DEG,
	IO_SENSOR_MOUSE_LEFT,
	IO_SENSOR_MOUSE_RIGHT,

	IO_SENSOR_END,

	//Leds

	IO_LED_START = IO_SENSOR_END,

	IO_LED_MAIN = IO_LED_START,

	IO_LED_END,

	//Displays

	IO_DISPLAY_START = IO_LED_END,

	IO_DISPLAY_MAIN = IO_DISPLAY_START,

	IO_DISPLAY_END,

	//Keyboards

	IO_KEYBOARD_START = IO_DISPLAY_END,

	IO_KEYBOARD_MAIN = IO_KEYBOARD_START,

	IO_KEYBOARD_END,

	//Command Handler

	IO_COMMAND_HANDLER_START = IO_KEYBOARD_END,

	IO_COMMAND_HANDLER_MAIN = IO_COMMAND_HANDLER_START,

	IO_COMMAND_HANDLER_END,

	//Position Tracker

	IO_POSITION_TRACKER_START = IO_COMMAND_HANDLER_END,

	IO_POSITION_TRACKER_MAIN,

	IO_POSITION_TRACKER_END,

	//Obstacle Tracker

	IO_OBSTACLE_TRACKER_START = IO_POSITION_TRACKER_END,

	IO_OBSTACLE_TRACKER_MAIN,

	IO_OBSTACLE_TRACKER_END,

	//Ball Tracker

	IO_BALL_TRACKER_START = IO_OBSTACLE_TRACKER_END,

	IO_BALL_TRACKER_MAIN,

	IO_BALL_TRACKER_END,

	//Navigators

	IO_NAVIGATOR_START = IO_BALL_TRACKER_END,

	IO_NAVIGATOR_MAIN,

	IO_NAVIGATOR_END,

	//Logics

	IO_LOGIC_START = IO_NAVIGATOR_END,

	IO_LOGIC_MAIN,

	IO_LOGIC_END,

	//General
	IO_END = IO_NAVIGATOR_END,
};

#endif