-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.c
71 lines (60 loc) · 1.09 KB
/
utils.c
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
#include <math.h>
#include <stdbool.h>
const bool BALL_FOUND = true;
const bool BALL_NOT_FOUND = false;
const bool OPPONENTS_FOUND = true;
const bool BOUNDARIES_FOUND = true;
const bool BALL_COLLECTED = false;
const bool BALL_DISPENSED = false;
bool moving_forward()
{
clearTimer(T1); // start the timer
while (time1(T1) < 10000)
{
if (scan_ball() == BALL_FOUND)
{
return BALL_FOUND;
}
else if (scan_boundaries == BOUNDARIES_FOUND)
{
avoid_boundaries();
return BALL_NOT_FOUND;
}
else if (scan_opponents < XXXX)
{
avoid_opponents();
return BALL_NOT_FOUND;
}
}
return BALL_NOT_FOUND;
}
float IRSensorReading(int pin_number)
{
float voltage = SensorValue(pin_number) / 4096 * 5;
float distance = p return distance;
}
void scan_ball()
{
}
void scan_opponents()
{
}
void scan_boundaries()
{
}
void avoid_boundaries()
{
if (IRSensorReading())
}
bool starting_procedure()
{
}
bool spin_search()
{
}
bool collect_ball()
{
}
void dispense_ball()
{
}