root / trunk / code / projects / traffic_navigation / mapping.c @ 1950
History | View | Annotate | Download (1.12 KB)
1 | 1950 | dgurjar | #include "mapping.h" |
---|---|---|---|
2 | #include "lineDrive.h" |
||
3 | #include <dragonfly_lib.h> |
||
4 | |||
5 | //The last intersection that we encountered
|
||
6 | int lastInt;
|
||
7 | |||
8 | //Current encoder reading
|
||
9 | int distance;
|
||
10 | |||
11 | |||
12 | /*
|
||
13 | * Traverses the map using DFS
|
||
14 | * Returns 0 if all of the intersections in the database were seen
|
||
15 | * 1 otherwise
|
||
16 | */
|
||
17 | int createMap(){
|
||
18 | |||
19 | int seen = 0 |
||
20 | int currInt = 0; |
||
21 | int barcode;
|
||
22 | int outEdges;
|
||
23 | struct node currInt;
|
||
24 | int i;
|
||
25 | |||
26 | /* Holds the number of intersections we have seen */
|
||
27 | char[] intseen;
|
||
28 | |||
29 | /* Drives to the nearest intersection */
|
||
30 | barcode = nextInt(); |
||
31 | |||
32 | while(seen < numIntersections)
|
||
33 | { |
||
34 | /* Given the barcode reading, returns the struct representing
|
||
35 | * the intersection */
|
||
36 | currInt = lookup(barcode); |
||
37 | |||
38 | /* Update the nodes that you have seen */
|
||
39 | intseen[currInt] = 1;
|
||
40 | |||
41 | outEdges = currInt.numOut; |
||
42 | |||
43 | //Go through every outgoing edge
|
||
44 | for(i = 0; i< outEdges; i++) |
||
45 | { |
||
46 | //Step out
|
||
47 | } |
||
48 | } |
||
49 | |||
50 | return 0; |
||
51 | } |
||
52 | |||
53 | /* Creates an edge in the graph */
|
||
54 | int insertEdge(){
|
||
55 | } |
||
56 | |||
57 | |||
58 | /*
|
||
59 | * Drives to the next intersection and returns its ID
|
||
60 | * If we are at a dead end, returns -1
|
||
61 | */
|
||
62 | int nextInt(){
|
||
63 | |||
64 | } |