Project

General

Profile

Statistics
| Revision:

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

History | View | Annotate | Download (1.99 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
#include "intersectData.h"
8
#include "validTurns.h"
9

    
10
/*States*/
11
#define SROAD 0
12
#define SINTERSECTION 10
13
#define SHIGHWAY 20
14

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

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

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

    
62
#endif