root / trunk / code / projects / traffic_navigation / mapping.h @ 2011
History | View | Annotate | Download (1.17 KB)
1 | 1980 | alevkoy | #ifndef __INTERSECTION_MAPPING_H__
|
---|---|---|---|
2 | #define __INTERSECTION_MAPPING_H__
|
||
3 | |||
4 | 1973 | dgurjar | #include "intersectData.h" |
5 | |||
6 | /* Data is sent in the following order
|
||
7 | * INT0_NUM OUTEDGE_0 OUTEDGE_1 ... \n
|
||
8 | * INT1_NUM OUTEDGE_0 ... \n
|
||
9 | * ...
|
||
10 | * ...
|
||
11 | */
|
||
12 | |||
13 | /* Representation of an edge (road) */
|
||
14 | typedef struct { |
||
15 | char to; /* Where does this edge lead to? */ |
||
16 | char dist; /* Where does it come from? */ |
||
17 | 1980 | alevkoy | } edge; |
18 | 1973 | dgurjar | |
19 | /* Representation of an intersection on the graph */
|
||
20 | typedef struct { |
||
21 | char type; /* Note that there are at most 5 intersection types */ |
||
22 | char intNum; /* What is the intersection number */ |
||
23 | char numOut; /* Note that we can have no more than 4 outgoing edges */ |
||
24 | char outSeen; /* The number of the outgoing edges that we have seen for this intersection */ |
||
25 | 1980 | alevkoy | edge outgoingEdges[4];
|
26 | } node; |
||
27 | 1973 | dgurjar | |
28 | /* A union that is used in wireless transmissions */
|
||
29 | typedef union { |
||
30 | node n; |
||
31 | char array[12]; |
||
32 | 1980 | alevkoy | }node_union; |
33 | 1973 | dgurjar | |
34 | 1984 | dgurjar | char driveToNextInt(void); |
35 | char createEdge(edge* newEdge, int type, int direction); |
||
36 | void initGraph(char* seen, char* seenout); |
||
37 | 1980 | alevkoy | int createMap(void); |
38 | int getNumOut(int type); |
||
39 | int insertEdge(void); |
||
40 | int nextInt(void); |
||
41 | int encodeNode(node n);
|
||
42 | void sendIntersectionGraph(void); |
||
43 | 1976 | pdeo | |
44 | 1980 | alevkoy | extern node intersections[NUM_FEATURES];
|
45 | |||
46 | #endif |