Statistics
| Revision:

root / trunk / code / projects / traffic_navigation / traffic_navigation.h @ 1877

History | View | Annotate | Download (1.94 KB)

1
#ifndef TRAFFIC_NAVIGATION_H
2

    
3
#include <dragonfly_lib.h>
4
#include <wl_basic.h>
5
#include "lineDrive.h"
6
#include "highways.h"
7

    
8
/*States*/
9
#define SROAD 0
10
#define SINTERSECTION 10
11
#define SHIGHWAY 20
12

    
13
/*Sign Codes
14
 * bitwise OR labels to create a barcode or read one
15
 * There should be macros to extract these probably
16
 * The bits will be stored in some variable (char or short)
17
 * Bits if road: ? ? ? NAME NAME NAME TYPE CROAD
18
 * Bits if intersection: ? ? ? ? DIR DIR #WAYS CINTERSECTION
19
 */
20
#define CROAD 0x0 //0b
21
#define CINTERSECTION 0x1 //1b
22
#define CNORMALROAD 0x0 //00b
23
#define CHIGHWAYROAD 0x2 //10b
24
#define C4WAY 0x0 //00b
25
#define C3WAY 0x2 //10b
26
#define CNORTH 0x0 //0000b
27
#define CEAST 0x4 //0100b
28
#define CSOUTH 0x8 //1000b
29
#define CWEST 0x12 //1100b
30

    
31
/*Wireless Packet Types
32
 * The first byte of any wireless packet should be one of these types.
33
 * Each type will have its own structure
34
 * The second byte should be the id of the bot sending the packet
35
 * The third byte should be the number of the intersection or road that
36
 *   the packet pertains to
37
 */
38
#define PACKET_LENGTH 5
39
#define WROADENTRY 0 //[type, bot, road]
40
#define WROADREPLY 1 //[type, fromBot, road, toBot]
41
#define WROADEXIT 2 //[type, bot, road]
42
#define WROADSTOP 3 //[type, bot, road]
43
#define WINTERSECTIONENTRY 10 //[type, bot, intersection, fromDir, toDir]
44
#define WINTERSECTIONREPLY 11 //[type, fromBot, intersection, toBot]
45
#define WINTERSECTIONEXIT 12 //[type, bot, intersection]
46
#define WINTERSECTIONGO 13 //[type, bot, intersection]
47
#define WINTERSECTIONPOLICEENTRY 14
48
#define WHIGHWAYENTRY 20 //[type, bot, highway]
49
#define WHIGHWAYREPLY 21 //[type, fromBot, highway, toBot]
50
#define WHIGHWAYEXIT 22 //[type, bot, highway]
51
#define WPINGGLOBAL 30 //[type, bot]
52
#define WPINGBOT 31 //[type, fromBot, toBot]
53
#define WPINGQUEUE 32 //[type, fromBot, toBot]
54
#define WPINGREPLY 33 //[type, fromBot, toBot]
55

    
56
/*Macros
57
 */
58
#define ISPING(p) ((p)[0]==WPINGGLOBAL || (p)[0]==WPINGBOT || (p)[0]==WPINGQUEUE)
59

    
60
#endif