Statistics
| Revision:

root / trunk / code / projects / traffic_navigation / sendGraph.c @ 1979

History | View | Annotate | Download (957 Bytes)

1
#include <dragonfly_lib.h>
2
#include <wl_basic.h>
3
#include "sendGraph.h"
4

    
5
int main(void){
6

    
7
    dragonfly_init(ALL_ON);
8
    wl_basic_init_default();
9
    wl_set_channel(12);
10

    
11
        node a;
12
        node b;
13
                        
14
        edge aTob;
15
        edge bToa;
16
        
17
        //Create the edges
18
        aTob.to = 'b';
19
        aTob.dist = 25;
20
        
21
        bToa.to = 'a'; 
22
        bToa.dist = 25;
23
        
24
        
25
        a.outgoingEdges[0] = aTob;
26
        b.outgoingEdges[0] = bToa;
27
        
28
        
29
        a.type = 1;
30
        a.intNum = 1;
31
        a.numOut = 1;
32
        a.outSeen = 1;
33

    
34
        
35
        b.type = 1;
36
        b.intNum = 2;
37
        b.numOut = 1;
38
        b.outSeen = 1;
39

    
40
        intersections[0] = a;
41
        intersections[1] = b;
42
        
43
        sendIntersectionGraph();
44
}
45

    
46

    
47

    
48

    
49

    
50
/*
51
 * Uses wireless to send the graph sructure
52
 * to other robots
53
 *
54
 * @return 
55
 *
56
 */
57
void sendIntersectionGraph() {
58
        int i;
59
        node_union graph;
60

    
61
        for(i=0; i< NUM_FEATURES; i++){
62
                graph.n = intersections[i];
63
                wl_basic_send_global_packet(42, graph.array, 12);
64
                wl_basic_send_global_packet(42, '\n', 1);
65
        }
66
}