Revision 1919
Added a statusbot project to help me debug the demo by seeing what the bots are thinking.
lineFollow.h | ||
---|---|---|
15 | 15 |
#define NOLINE -50 |
16 | 16 |
#define FULL_LINE -51 |
17 | 17 |
|
18 |
|
|
19 |
|
|
20 | 18 |
/** |
21 | 19 |
* @brief Initializes line following. |
22 | 20 |
* |
23 | 21 |
* Must be called before line following will work. |
24 | 22 |
* Turns the analog loop off. |
25 |
**/
|
|
23 |
*/ |
|
26 | 24 |
void lineFollow_init(void); |
27 | 25 |
|
28 |
/* lineFollow |
|
29 |
Must call lineFollow first
|
|
30 |
Must be called inside a loop |
|
31 |
*/ |
|
26 |
/** lineFollow
|
|
27 |
* Must call lineFollow_init first
|
|
28 |
* Must be called inside a loop
|
|
29 |
*/
|
|
32 | 30 |
int lineFollow(int speed); |
33 | 31 |
|
34 |
/* turnLeft turnRight mergeLeft mergeRight |
|
35 |
Must be called inside a loop |
|
36 |
returns 0 when complete |
|
37 |
*/ |
|
32 |
/** turnLeft turnRight mergeLeft mergeRight
|
|
33 |
* Must be called inside a loop
|
|
34 |
* returns 0 when complete
|
|
35 |
*/
|
|
38 | 36 |
int turnLeft(void); |
39 | 37 |
int turnRight(void); |
40 | 38 |
int mergeLeft(void); |
... | ... | |
45 | 43 |
* current sensor readings. |
46 | 44 |
* |
47 | 45 |
* @param values The array of five integers to be updated. |
48 |
**/
|
|
46 |
*/ |
|
49 | 47 |
void updateLine(int* values); |
50 | 48 |
|
51 | 49 |
/** |
... | ... | |
62 | 60 |
* LWHITE or LBLACK. |
63 | 61 |
* @return Either a special value or an index from -4 to 4. |
64 | 62 |
* |
65 |
**/
|
|
63 |
*/ |
|
66 | 64 |
int lineLocate(int* colors); |
67 | 65 |
|
68 |
/* updatebarCode |
|
69 |
Reads in and processes |
|
70 |
bar code data |
|
71 |
*/ |
|
66 |
/** updatebarCode
|
|
67 |
* Reads in and processes
|
|
68 |
* bar code data
|
|
69 |
*/
|
|
72 | 70 |
void updateBarCode(void); |
73 | 71 |
|
74 | 72 |
/** |
... | ... | |
77 | 75 |
* Returns a bar code if available (if at the end of a barcode) and resets the |
78 | 76 |
* barcodePosition to 0. Otherwise, return NOBARCODE. * |
79 | 77 |
* @return The value of the barcode if a complete barcode, else NOBARCODE. |
80 |
**/
|
|
78 |
*/ |
|
81 | 79 |
int getBarCode(void); |
82 | 80 |
|
83 | 81 |
|
... | ... | |
86 | 84 |
//! A simple function to return the maximum of two integers. |
87 | 85 |
int max(int x, int y); |
88 | 86 |
|
89 |
/* motorLeft |
|
90 |
Commands the left motor |
|
91 |
Cannot be used to stop |
|
92 |
0-126 are backward |
|
93 |
127-255 are forward |
|
94 |
*/ |
|
87 |
/** @todo Alex: I hate these functions, but I'm keeping them so code will still work. But we should delete them sometime. */ |
|
88 |
|
|
89 |
/** motorLeft |
|
90 |
* Commands the left motor |
|
91 |
* Cannot be used to stop |
|
92 |
* 0-126 are backward |
|
93 |
* 127-255 are forward |
|
94 |
*/ |
|
95 | 95 |
void motorLeft(int speed); |
96 | 96 |
|
97 |
/* motorRight |
|
98 |
Commands the right motor |
|
99 |
Cannot be used to stop |
|
100 |
0-126 are backward |
|
101 |
127-255 are forward |
|
102 |
*/ |
|
97 |
/** motorRight
|
|
98 |
* Commands the right motor
|
|
99 |
* Cannot be used to stop
|
|
100 |
* 0-126 are backward
|
|
101 |
* 127-255 are forward
|
|
102 |
*/
|
|
103 | 103 |
void motorRight(int speed); |
104 | 104 |
|
105 |
/* lost |
|
106 |
Internal counter to detect if the line was lost |
|
107 |
*/ |
|
105 |
/** lost
|
|
106 |
* Internal counter to detect if the line was lost
|
|
107 |
*/
|
|
108 | 108 |
int lost; |
109 | 109 |
|
110 | 110 |
int onLine(void); |
Also available in: Unified diff