Revision 1886
Tested and finished the database and the valid turns and everything!
database:
files: intersectData.c and intersectData.h
database is an array defined in .h that stores all intersections
right now it is defined for our demo map.
it has an intialize function that is unique for each map and all
other functions that can be reused. (constracted in this way
so that we do not need to keep rewriting code)
validTurns:
integrated with the database. uses database lookup functions to
determine intersection type and position from the given barcode
and determines whether the given turn is valid.
Yay for being done!!
validTurns.h | ||
---|---|---|
12 | 12 |
/******************************** |
13 | 13 |
* Intersection TYPES: |
14 | 14 |
* |
15 |
* INTERSECTION_SINGLE (0 << 2) |
|
16 |
* INTERSECTION_ON_RAMP (1 << 2) |
|
17 |
* INTERSECTION_OFF_RAMP (2 << 2) |
|
18 |
* INTERSECTION_DOUBLE_C (3 << 2) |
|
19 |
* INTERSECTION_DOUBLE_T (4 << 2) |
|
20 |
* |
|
15 | 21 |
********************************/ |
16 | 22 |
|
23 |
/******************************** |
|
24 |
* Turn TYPES: |
|
25 |
* |
|
26 |
* ISTRAIGHT 0 |
|
27 |
* ILEFT 1 |
|
28 |
* IRIGHT 2 |
|
29 |
* IUTURN 3 |
|
30 |
* |
|
31 |
********************************/ |
|
17 | 32 |
|
18 |
#define INTERSECTION_SINGLE (0 << 2) |
|
19 |
#define INTERSECTION_ON_RAMP (1 << 2) |
|
20 |
#define INTERSECTION_OFF_RAMP (2 << 2) |
|
21 |
#define INTERSECTION_DOUBLE_C (3 << 2) |
|
22 |
#define INTERSECTION_DOUBLE_T (4 << 2) |
|
23 | 33 |
|
24 |
|
|
25 | 34 |
/******************************** |
26 | 35 |
* Intersection ENTRYPOINTS: |
36 |
* INTERSECTION_DOUBLE_C |
|
37 |
* use T-Junction positions |
|
38 |
* |
|
39 |
* INTERSECTION_DOUBLE_T |
|
40 |
* TLEFT 0 |
|
41 |
* TRIGHT 1 |
|
42 |
* TMIDDLE 2 |
|
43 |
* |
|
44 |
* INTERSECTION_SINGLE |
|
45 |
* SACROSS 0 |
|
46 |
* SUP 1 |
|
47 |
* |
|
48 |
* INTERSECTION_ON_RAMP |
|
49 |
* R_LEFT 0 |
|
50 |
* R_RIGHT 1 |
|
51 |
* R_RAMP 2 |
|
52 |
* |
|
53 |
* INTERSECTION_OFF_RAMP |
|
54 |
* use On_ramp positions |
|
27 | 55 |
* |
28 |
********************************/ |
|
29 |
|
|
30 |
//DOUBLE intersection (Cross Intersection) positions |
|
31 |
//use T-Junction positions |
|
32 |
|
|
33 |
//DOUBLE intersection (T-Junction) positions |
|
34 |
/* |
|
35 |
TLEFT=======TRIGHT |
|
36 |
|| |
|
37 |
|| |
|
38 |
|| |
|
39 |
TMIDDLE |
|
40 |
*/ |
|
41 |
#define TLEFT 0 |
|
42 |
#define TRIGHT 1 |
|
43 |
#define TMIDDLE 2 |
|
44 |
|
|
45 |
//SINGLE intersection positions |
|
46 |
/* |
|
47 |
/\ |
|
48 |
/||\ |
|
49 |
|| |
|
50 |
SACROSS==========> |
|
51 |
|| |
|
52 |
|| |
|
53 |
|| |
|
54 |
SUP |
|
55 |
*/ |
|
56 |
#define SACROSS 0 |
|
57 |
#define SUP 1 |
|
58 |
|
|
59 |
|
|
60 |
//ON_RAMP and OFF_RAMP intersection positions |
|
61 |
/* |
|
62 |
R_LEFT================R_RIGHT |
|
63 |
|| |
|
64 |
|| |
|
65 |
|| |
|
66 |
R_RAMP |
|
67 |
*/ |
|
68 |
#define R_LEFT 0 |
|
69 |
#define R_RIGHT 1 |
|
70 |
#define R_RAMP 2 |
|
71 |
|
|
56 |
*****************************/ |
|
57 |
|
|
72 | 58 |
int validateTurn(int barcode, int turn_type); |
73 | 59 |
|
74 | 60 |
#endif |
Also available in: Unified diff