Revision 1910
Updating some documentation for lineFollow
lineFollow.h | ||
---|---|---|
1 | 1 |
#include <dragonfly_lib.h> |
2 | 2 |
|
3 |
#ifndef _LINEFOLLOW_H_
|
|
4 |
#define _LINEFOLLOW_H_
|
|
3 |
#ifndef _LINEFOLLOW_H_ |
|
4 |
#define _LINEFOLLOW_H_ |
|
5 | 5 |
|
6 | 6 |
#define LWHITE 0 |
7 | 7 |
#define LGREY 1 |
8 | 8 |
#define LBLACK 2 |
9 | 9 |
#define CENTER 3 |
10 |
#define NOLINE -42 |
|
10 |
#define NOLINE -42 //! Magic number?
|
|
11 | 11 |
#define LINELOST -1 |
12 | 12 |
|
13 | 13 |
#define NOBARCODE -2 |
14 |
#define INTERSECTION -25 |
|
15 |
#define FULL_LINE -26 |
|
14 |
#define INTERSECTION -25 //! Magic number?
|
|
15 |
#define FULL_LINE -26 //! Magic number?
|
|
16 | 16 |
|
17 | 17 |
|
18 | 18 |
|
... | ... | |
37 | 37 |
int mergeLeft(void); |
38 | 38 |
int mergeRight(void); |
39 | 39 |
|
40 |
/* updateLine |
|
41 |
Reads in the analog values |
|
42 |
Fills the given array with WHITE |
|
43 |
or BLACK representing the line |
|
44 |
*/ |
|
40 |
/** |
|
41 |
* @brief Updates the values stored in the array to white or black based on |
|
42 |
* current sensor readings. |
|
43 |
* |
|
44 |
* @param values The array of five integers to be updated. |
|
45 |
**/ |
|
45 | 46 |
void updateLine(int* values); |
46 | 47 |
|
47 |
/* lineLocate |
|
48 |
Finds the location of the line |
|
49 |
Outputs positive for right side |
|
50 |
Negative for left, or NOLINE if a line is not found |
|
51 |
*/ |
|
48 |
/** |
|
49 |
* @brief Returns an index of the middle of the line based on line readings. |
|
50 |
* |
|
51 |
* Two special return values are possible: |
|
52 |
* NOLINE if none of the sensors holds a black value, and |
|
53 |
* FULL_LINE if all of the sensors see black. |
|
54 |
* |
|
55 |
* Otherwise, returns a value from -4 (farthest left) to 4 (farthest right), with |
|
56 |
* 0 the line being centered in the middle. |
|
57 |
* |
|
58 |
* @param colors The array of 5 readings from the line sensor. Must be either |
|
59 |
* LWHITE or LBLACK. |
|
60 |
* @return Either a special value or an index from -4 to 4. |
|
61 |
* |
|
62 |
**/ |
|
52 | 63 |
int lineLocate(int* colors); |
53 | 64 |
|
54 | 65 |
/* updatebarCode |
... | ... | |
57 | 68 |
*/ |
58 | 69 |
void updateBarCode(void); |
59 | 70 |
|
60 |
/* getBarCode |
|
61 |
returns a bar code, if |
|
62 |
available, otherwise NOBARCODE |
|
63 |
*/ |
|
71 |
/** |
|
72 |
* @brief Gets the completed value read by the barcode reader, or NOBARCODE. |
|
73 |
* |
|
74 |
* Returns a bar code if available (if at the end of a barcode) and resets the |
|
75 |
* barcodePosition to 0. Otherwise, return NOBARCODE. * |
|
76 |
* @return The value of the barcode if a complete barcode, else NOBARCODE. |
|
77 |
**/ |
|
64 | 78 |
int getBarCode(void); |
65 | 79 |
|
66 |
/* min max |
|
67 |
returns the minimum/maximum of two values |
|
68 |
*/ |
|
80 |
|
|
81 |
//! A simple function to return the minimum of two integers. |
|
69 | 82 |
int min(int x, int y); |
83 |
//! A simple function to return the maximum of two integers. |
|
70 | 84 |
int max(int x, int y); |
71 | 85 |
|
72 | 86 |
/* motorLeft |
Also available in: Unified diff