root / trunk / code / projects / traffic_navigation / traffic_navigation.h @ 1992
History | View | Annotate | Download (3.44 KB)
1 | 1873 | josephle | #ifndef TRAFFIC_NAVIGATION_H
|
---|---|---|---|
2 | |||
3 | 1972 | azl | /* Debug Options - These must go before includes */
|
4 | 1977 | azl | #define MAIN_NEW
|
5 | 1972 | azl | #define ORB_INTERSECTION
|
6 | 1988 | bwasserm | //#define SENDGRAPH
|
7 | 1972 | azl | |
8 | 1873 | josephle | #include <dragonfly_lib.h> |
9 | #include <wl_basic.h> |
||
10 | 1966 | alevkoy | #include "../linefollowing/lineDrive.h" |
11 | 1877 | markwill | #include "highways.h" |
12 | 1891 | bwasserm | #include "intersectData.h" |
13 | #include "validTurns.h" |
||
14 | 1873 | josephle | |
15 | /*States*/
|
||
16 | #define SROAD 0 |
||
17 | 1969 | azl | #define SINTERSECTION 9 /* for old version */ |
18 | #define SINTERSECTION_ENTER 10 |
||
19 | #define SINTERSECTION_ENTER_RESOLV 11 |
||
20 | #define SINTERSECTION_WAIT 12 |
||
21 | #define SINTERSECTION_DRIVE 13 |
||
22 | 1873 | josephle | #define SHIGHWAY 20 |
23 | 1969 | azl | #define SCLEARPACKET 30 |
24 | 1873 | josephle | |
25 | /*Sign Codes
|
||
26 | * bitwise OR labels to create a barcode or read one
|
||
27 | * There should be macros to extract these probably
|
||
28 | * The bits will be stored in some variable (char or short)
|
||
29 | * Bits if road: ? ? ? NAME NAME NAME TYPE CROAD
|
||
30 | * Bits if intersection: ? ? ? ? DIR DIR #WAYS CINTERSECTION
|
||
31 | */
|
||
32 | #define CROAD 0x0 //0b |
||
33 | #define CINTERSECTION 0x1 //1b |
||
34 | #define CNORMALROAD 0x0 //00b |
||
35 | #define CHIGHWAYROAD 0x2 //10b |
||
36 | #define C4WAY 0x0 //00b |
||
37 | #define C3WAY 0x2 //10b |
||
38 | #define CNORTH 0x0 //0000b |
||
39 | #define CEAST 0x4 //0100b |
||
40 | #define CSOUTH 0x8 //1000b |
||
41 | #define CWEST 0x12 //1100b |
||
42 | |||
43 | /*Wireless Packet Types
|
||
44 | * The first byte of any wireless packet should be one of these types.
|
||
45 | * Each type will have its own structure
|
||
46 | * The second byte should be the id of the bot sending the packet
|
||
47 | * The third byte should be the number of the intersection or road that
|
||
48 | * the packet pertains to
|
||
49 | */
|
||
50 | #define PACKET_LENGTH 5 |
||
51 | #define WROADENTRY 0 //[type, bot, road] |
||
52 | #define WROADREPLY 1 //[type, fromBot, road, toBot] |
||
53 | #define WROADEXIT 2 //[type, bot, road] |
||
54 | #define WROADSTOP 3 //[type, bot, road] |
||
55 | 1969 | azl | #define WINTERSECTIONENTRY 10 //[type, bot, intersection, fromDir, toDir] |
56 | #define WINTERSECTIONREPLY 11 //[type, fromBot, intersection, toBot] |
||
57 | #define WINTERSECTIONEXIT 12 //[type, bot, intersection] |
||
58 | #define WINTERSECTIONGO 13 //[type, bot, intersection] |
||
59 | 1873 | josephle | #define WINTERSECTIONPOLICEENTRY 14 |
60 | 1969 | azl | #define WINTERSECTIONRESOLVERACE 15 //[type, bot, intersection, num] |
61 | 1873 | josephle | #define WHIGHWAYENTRY 20 //[type, bot, highway] |
62 | #define WHIGHWAYREPLY 21 //[type, fromBot, highway, toBot] |
||
63 | #define WHIGHWAYEXIT 22 //[type, bot, highway] |
||
64 | #define WPINGGLOBAL 30 //[type, bot] |
||
65 | #define WPINGBOT 31 //[type, fromBot, toBot] |
||
66 | #define WPINGQUEUE 32 //[type, fromBot, toBot] |
||
67 | #define WPINGREPLY 33 //[type, fromBot, toBot] |
||
68 | 1892 | azl | #define WCOLLISIONAVOID 41 //[type, bot, intersection, collision-int] //Note: collision is an int and thus takes two spaces |
69 | 1988 | bwasserm | #define WGRAPHDATA 80 |
70 | 1873 | josephle | |
71 | 1969 | azl | /*Wireless Parsing Status
|
72 | * For wireless parsing - status codes describing various errors/statuses with wireless
|
||
73 | * parsing.
|
||
74 | * Errors begin with E - Note that all of these errors are actually returned as negative.
|
||
75 | * - values of >= 100 indicate a serious error
|
||
76 | * Non-Errors begin with K - returned as positive. (don't start with S because S
|
||
77 | * is for state)
|
||
78 | */
|
||
79 | #define ENOPACKET -10 //The received packet doesn't exist. |
||
80 | #define ENOACTION -15 //The received packet has no defined action, and this is OK |
||
81 | #define ENOIMPLEMENT -20 //The received packet has no defined action and needs to be implemented. |
||
82 | #define EPACKETLEN -100 //The received packet was the wrong length |
||
83 | #define KOK 1 |
||
84 | #define KPLACEDINQUEUE 20 |
||
85 | #define KFAILEDTOQUEUE 21 |
||
86 | #define KFIRSTINQUEUE 22 |
||
87 | #define KREPLIEDTOENTER 23 |
||
88 | #define KRESOLVINGENTER 24 //resolving a race between bots trying to enter intersection at the same time. |
||
89 | |||
90 | 1873 | josephle | /*Macros
|
91 | */
|
||
92 | #define ISPING(p) ((p)[0]==WPINGGLOBAL || (p)[0]==WPINGBOT || (p)[0]==WPINGQUEUE) |
||
93 | |||
94 | 1877 | markwill | #endif |