Project

General

Profile

Revision 1872

Added by Joseph Lee over 13 years ago

Uploaded traffic_navigation.h

View differences:

main.c
5 5
 * Author: Colony Project, CMU Robotics Club
6 6
 */
7 7

  
8
#include <dragonfly_lib.h>
9
#include <wl_basic.h>
10
#include "../linefollowing/lineDrive.h"
8
#include "traffic_navigation.h"
11 9

  
12

  
13

  
14
/*States*/
15
#define SROAD 0
16
#define SINTERSECTION 10
17
#define SHIGHWAY 20
18

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

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

  
62
/*Macros
63
 */
64
#define ISPING(p) ((p)[0]==WPINGGLOBAL || (p)[0]==WPINGBOT || (p)[0]==WPINGQUEUE)
65

  
66 10
int main (void) {
67 11

  
68 12
	int state, sign, dataLength, pingWaitTime;

Also available in: Unified diff