Caddy
A 2005 Roborodentia entry with vision and path planning capability
 All Data Structures Files Functions Variables Typedefs Macros Pages
line_tracking.h
Go to the documentation of this file.
1 /*
2  * This file is part of Caddy.
3  *
4  * Caddy is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * Caddy is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Caddy. If not, see <http://www.gnu.org/licenses/>.
16  */
21 #ifndef TRACKLINE_H_
22 #define TRACKLINE_H_
23 
24 #include <stdint.h>
25 #include <stdbool.h>
26 
27 #define DS_X_LINE 1
28 #define DS_Y_LINE 4
29 #define VW_X1_LINE 10
30 #define VW_Y1_LINE 1
31 #define VW_X2_LINE 77
32 #define VW_Y2_LINE 35
33 #define VW_X_SIZE_LINE (VW_X2_LINE - VW_X1_LINE + 1)
34 #define VW_Y_SIZE_LINE (VW_Y2_LINE - VW_Y1_LINE + 1)
35 
36 #define LINE_STATS_ROWS VW_Y_SIZE_LINE
37 #define LINE_STATS_COLS 4 // must correspond to bits in LINE_STAT_MASK
38 
39 void adjustPWM( void );
40 
41 void trackLineInit(void);
42 void restartLineMode(void);
43 
44 void analyzeLineStats(void);
45 bool isGoodScan(uint8_t y);
46 bool isJunctionScan(uint8_t y);
47 bool mayBeBallScan(uint8_t y);
48 
49 void printPacket(void);
50 
51 extern int8_t junctionY;
52 
53 // Global variables
54 extern volatile uint8_t lineStats[LINE_STATS_ROWS][LINE_STATS_COLS];
55 extern volatile bool lineStatsProcessed;
56 
57 #endif // #ifndef TRACKLINE_H_