Revision 1885
Changed index of INTERSECTION variables and got rid of getCrossPos and
getCrossType that are being implemented in the database.
trunk/code/projects/traffic_navigation/validTurns.h | ||
---|---|---|
2 | 2 |
#define _VALID_TURNS_ |
3 | 3 |
|
4 | 4 |
|
5 |
#include "lineDrive.h" |
|
6 |
|
|
7 | 5 |
/**************************** |
8 | 6 |
* Intersection Information: 5-bit Integer |
9 | 7 |
* 3 bits of intersection type |
... | ... | |
17 | 15 |
********************************/ |
18 | 16 |
|
19 | 17 |
|
20 |
#define INTERSECTION_SINGLE (1 << 2)
|
|
21 |
#define INTERSECTION_ON_RAMP (2 << 2)
|
|
22 |
#define INTERSECTION_OFF_RAMP (3 << 2)
|
|
23 |
#define INTERSECTION_DOUBLE_C (4 << 2)
|
|
24 |
#define INTERSECTION_DOUBLE_T (5 << 2)
|
|
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)
|
|
25 | 23 |
|
26 | 24 |
|
27 | 25 |
/******************************** |
... | ... | |
71 | 69 |
#define R_RIGHT 1 |
72 | 70 |
#define R_RAMP 2 |
73 | 71 |
|
74 |
int getCrossType(int barcode); |
|
75 |
|
|
76 |
int getCrossPos(int barcode, int max); |
|
77 |
|
|
78 | 72 |
int validateTurn(int barcode, int turn_type); |
79 | 73 |
|
80 | 74 |
#endif |
trunk/code/projects/traffic_navigation/validTurns.c | ||
---|---|---|
38 | 38 |
{ |
39 | 39 |
return randomNumGen(4); |
40 | 40 |
} |
41 |
*/ |
|
42 | 41 |
|
43 | 42 |
int getCrossType(int barcode){ |
44 | 43 |
int crosstype = (barcode>>2)&7; |
45 | 44 |
return crosstype; |
46 | 45 |
} |
47 |
int getCrossPos(int barcode, int max){ |
|
48 |
//@TODO: implement some max checking |
|
46 |
int getCrossPos(int barcode){ |
|
49 | 47 |
return (barcode)&3; |
50 | 48 |
} |
51 | 49 |
|
50 |
*/ |
|
51 |
|
|
52 | 52 |
int validateTurn(int barcode, int turn_type) |
53 | 53 |
{ |
54 | 54 |
int cross_type; |
... | ... | |
63 | 63 |
return turn_type; |
64 | 64 |
break; |
65 | 65 |
} |
66 |
case DOUBLE: //Implements DOUBLE as DOUBLE_T |
|
67 |
//@TODO: we really shouldn't use DOUBLE, it's part of another system. but it equals 0, so error checking. |
|
68 | 66 |
case INTERSECTION_DOUBLE_T: |
69 | 67 |
{ |
70 | 68 |
cross_pos = getCrossPos(barcode, 3); |
Also available in: Unified diff