Project

General

Profile

Statistics
| Revision:

root / trunk / code / projects / traffic_navigation / intersectData.h @ 1958

History | View | Annotate | Download (2.46 KB)

1
#ifndef _NODE_DATABASE_
2
#define _NODE_DATABASE_
3

    
4
#define NUM_FEATURES 8
5

    
6

    
7
/****************************
8
 * Node Information: 5-bit Integer
9
 *         3 bits of node type
10
 *         2 bits of entry information
11
 *         
12
 * Intersection Number stored in bits 6-12.
13
 *
14
 * Also contains a "feature id": 4 bits in positions 13,14,15,16
15
 * 
16
 ****************************/
17

    
18
 
19
 /********************************
20
 *  Feature TYPES:
21
 *
22
 ********************************/
23
#define INTERSECTION_NODE        0
24
#define ROAD_NODE                        1
25
#define MAPPING_MARKER                NUM_FEATURES
26
//Used when mapping to signify return to previously visited intersection while driving on the wrong side of the road.
27
 
28
 /********************************
29
 *  Node TYPES:
30
 *
31
 *
32
 *  SINGLE      0
33
 *  ON_RAMP     1
34
 *  OFF_RAMP    2
35
 *  DOUBLE_C    3
36
 *  DOUBLE_T    4
37
 *  ROAD                5
38
 * 
39
 ********************************/
40
 
41
 /********************************
42
 *  Turn TYPES:
43
 *  
44
 *  ISTRAIGHT        0
45
 *  ILEFT                1
46
 *  IRIGHT                2
47
 *  IUTURN                3
48
 *
49
 ********************************/
50

    
51
 /********************************
52
 *  Road TYPES:
53
 *
54
 ********************************/
55
#define ROAD_DOUBLE        0
56
#define ROAD_SINGLE        1
57
#define HIGHWAY                2
58

    
59
/********************************
60
 *  Intersection ENTRYPOINTS:
61
 *
62
 ********************************/
63

    
64
//DOUBLE_C intersection (Cross Intersection) positions
65
/*
66
        CTOP
67
        ||
68
        ||
69
        ||
70
CLEFT=======CRIGHT
71
        ||
72
        ||
73
        ||
74
        CBOT
75
*/
76
#define CTOP 0
77
#define CRIGHT 1
78
#define CBOT 2
79
#define CLEFT 3
80

    
81
//DOUBLE_T intersection (T-Junction) positions
82
/*
83
TLEFT=======TRIGHT
84
        ||
85
        ||
86
        ||
87
        TMIDDLE
88
*/
89
#define TLEFT                0                        
90
#define TRIGHT                1                        
91
#define TMIDDLE                2
92

    
93
//SINGLE intersection positions
94
/*
95
           /\
96
          /||\
97
           ||
98
SACROSS==========>
99
           ||
100
           ||
101
           ||
102
           SUP
103
*/
104
#define SACROSS                0
105
#define SUP                1
106

    
107

    
108
//ON_RAMP and OFF_RAMP intersection positions
109
/*
110
R_LEFT================R_RIGHT
111
            ||        
112
            ||
113
            ||
114
          R_RAMP
115
*/
116
#define R_LEFT                0
117
#define R_RIGHT                1
118
#define R_RAMP                2
119

    
120
// Global variable for the intersection database.
121
int NodeData[NUM_FEATURES];
122

    
123
void initializeData();
124

    
125
// Functions to get data from the Database:
126
int getFeatureId(int key); //Returns value in Feature TYPES (see above)
127
int getIntersectType(int key); //Returns value in Node TYPE (values 0-4) (see above)
128
int getIntersectPos(int key); //Returns value in Intersect ENTRYPOINTS (see above)
129
int getRoadType(int key);  //Returns value in Node TYPE (values 5) (see above) 
130
int getRoadInfo(int key);  //Returns value in Road TYPES (see above) 
131
int getIntersectNum(int key); //Returns number of intersection
132

    
133
#endif