Project

General

Profile

Revision 1960

Fixed lineFollow.h compile issues.

View differences:

trunk/code/projects/linefollowing/lineFollow.h
1
<<<<<<< .mine
2 1
#include <dragonfly_lib.h>
3 2

  
4 3
#ifndef _LINEFOLLOW_H_
......
25 24
//! Anything higher than this value is black
26 25
#define BLACK_THRESHOLD 400
27 26

  
28
#define LEFT_SENSOR     1
29
#define RIGHT_SENSOR    0
27
#define NUM_READINGS 20
30 28

  
31
/**
32
 * @brief Initializes line following.
33
 * 
34
 * Must be called before line following will work.
35
 * Turns the analog loop off.
36
 */
37
void lineFollow_init(void);
38

  
39
/**	lineFollow
40
 *	Must call lineFollow_init first
41
 *	Must be called inside a loop
42
 */
43
int lineFollow(int speed);
44

  
45
/**	turnLeft turnRight mergeLeft mergeRight
46
 *	Must be called inside a loop
47
 *	returns 0 when complete
48
 */
49
int turnLeft(void);
50
int turnRight(void);
51
int mergeLeft(void);
52
int mergeRight(void);
53

  
54
/**
55
 * @brief Updates the values stored in the array to white or black based on
56
 * current sensor readings.
57
 *
58
 * @param values The array of five integers to be updated. 
59
 */
60
void updateLine(int* values); 
61

  
62
/**
63
 * @brief Returns an index of the middle of the line based on line readings.
64
 *
65
 * Two special return values are possible:
66
 *   NOLINE if none of the sensors holds a black value, and
67
 *   FULL_LINE if all of the sensors see black.
68
 *
69
 * Otherwise, returns a value from -4 (farthest left) to 4 (farthest right), with
70
 * 0 the line being centered in the middle.
71
 *
72
 * @param colors The array of 5 readings from the line sensor.  Must be either
73
 *    LWHITE or LBLACK.
74
 * @return Either a special value or an index from -4 to 4.
75
 *
76
 */
77
int lineLocate(int* colors);
78

  
79
/**	updatebarCode
80
 *	Reads in and processes
81
 *	bar code data
82
 */
83
void updateBarCode(void);
84

  
85
/**
86
 * @brief Gets the completed value read by the barcode reader, or NOBARCODE.
87
 *
88
 * Returns a bar code if available (if at the end of a barcode) and resets the
89
 * barcodePosition to 0. Otherwise, return NOBARCODE.  *
90
 * @return The value of the barcode if a complete barcode, else NOBARCODE.
91
 */
92
int getBarCode(void);
93

  
94

  
95
//! A simple function to return the minimum of two integers.
96
int min(int x, int y);
97
//! A simple function to return the maximum of two integers.
98
int max(int x, int y);
99

  
100
/** @todo Alex: I hate these functions, but I'm keeping them so code will still work. But we should delete them sometime. */
101

  
102
/**	motorLeft
103
 *	Commands the left motor
104
 *	Cannot be used to stop
105
 *	0-126 are backward
106
 *	127-255 are forward
107
 */
108
void motorLeft(int speed);
109

  
110
/**	motorRight
111
 *	Commands the right motor
112
 *	Cannot be used to stop
113
 *	0-126 are backward
114
 *	127-255 are forward
115
 */
116
void motorRight(int speed);
117

  
118
/**	lost
119
 *	Internal counter to detect if the line was lost
120
 */
121
int lost;
122

  
123
int onLine(void);
124

  
125
#endif
126
=======
127
#include <dragonfly_lib.h>
128

  
129
#ifndef _LINEFOLLOW_H_
130
#define _LINEFOLLOW_H_
131

  
132
#define LWHITE			0
133
#define LGREY			1
134
#define LBLACK	 		2
135
#define CENTER			3
136
#define LINELOST		-1
137

  
138
#define NOBARCODE 		-2
139
#define INTERSECTION 	-25
140

  
141
#define NOLINE			-50
142
#define FULL_LINE 		-51
143

  
144
//! Number of consecutive barcode color readings for a significant reading.
145
#define MAX_DURATION    20
146
//! Number of consecutive white barcode readings before a barcode reset.
147
#define TIMEOUT_DURATION    1000
148
//! Anything lower than this value is white
149
#define GREY_THRESHOLD 100
150
//! Anything higher than this value is black
151
#define BLACK_THRESHOLD 400
152

  
153 29
#define LEFT_SENSOR     1
154 30
#define RIGHT_SENSOR    0
155 31

  
......
248 124
int onLine(void);
249 125

  
250 126
#endif
251
>>>>>>> .r1952

Also available in: Unified diff