root / trunk / code / projects / traffic_navigation / sendGraph.h @ 1988
History | View | Annotate | Download (1.05 KB)
1 |
#include "intersectData.h" |
---|---|
2 |
#include "traffic_navigation.h" |
3 |
|
4 |
/* Data is sent in the following order
|
5 |
* INT0_NUM OUTEDGE_0 OUTEDGE_1 ... \n
|
6 |
* INT1_NUM OUTEDGE_0 ... \n
|
7 |
* ...
|
8 |
* ...
|
9 |
*/
|
10 |
void sendIntersectionGraph(void); |
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 |
}edge; |
18 |
|
19 |
/* Representation of an intersection on the graph */
|
20 |
typedef struct { |
21 |
char packetType;
|
22 |
char type; /* Note that there are at most 5 intersection types */ |
23 |
char intNum; /* What is the intersection number */ |
24 |
char numOut; /* Note that we can have no more than 4 outgoing edges */ |
25 |
char outSeen; /* The number of the outgoing edges that we have seen for this intersection */ |
26 |
edge outgoingEdges [4];
|
27 |
}node; |
28 |
|
29 |
/* A union that is used in wireless transmissions */
|
30 |
typedef union { |
31 |
node n; |
32 |
char array[13]; |
33 |
}node_union; |
34 |
|
35 |
/* This array holds all of the intersections that are represented in the graph
|
36 |
* after its creation, the graph is transmitted wirelessly */
|
37 |
node intersections [NUM_FEATURES]; |