Project

General

Profile

Revision 1873

Added by Joseph Lee over 13 years ago

adding traffic_navigation.h

View differences:

trunk/code/projects/traffic_navigation/traffic_navigation.h
1
#ifndef TRAFFIC_NAVIGATION_H
2

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

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

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

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

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

  
59
#endif

Also available in: Unified diff