root / trunk / code / projects / colonet / lib / colonet_defs.h @ 11
History | View | Annotate | Download (3.2 KB)
1 |
/* Eugene Marinelli, Fan
|
---|---|
2 |
* 10/27/06
|
3 |
*
|
4 |
* Colonet Definitions - common definitions and structs used in all colonet
|
5 |
* applications
|
6 |
*/
|
7 |
|
8 |
#ifndef COLONET_DEFS_H_
|
9 |
#define COLONET_DEFS_H_
|
10 |
|
11 |
//Message types
|
12 |
#define COLONET_COMMAND 0x0D |
13 |
#define COLONET_REQUEST 0x0E |
14 |
#define COLONET_RESPONSE 0x0F |
15 |
|
16 |
//Packet properties
|
17 |
#define PACKET_DATA_LEN 7 |
18 |
#define PACKET_SIZE 16 |
19 |
|
20 |
//Packet error codes
|
21 |
#define WL_ERRCODE_ROBOTDEATH 123 //For timeouts |
22 |
#define WL_ERRCODE_NEEDTOCHARGE 250 //For pinging charging station |
23 |
#define WL_ERRCODE_CHARGESTATION 251 //Charging station response to ping |
24 |
#define WL_ERR_DEAD_LOC 5 |
25 |
#define WL_ERROR_DEST 255 |
26 |
#define WL_ERROR_LOC 4 |
27 |
|
28 |
#define WL_DEFAULT_PAN 3332 |
29 |
|
30 |
typedef struct { |
31 |
unsigned char prefix[2]; |
32 |
unsigned char token_src; |
33 |
unsigned char token_dest; |
34 |
unsigned char msg_dest; |
35 |
unsigned char msg_type; |
36 |
unsigned char msg_code; |
37 |
unsigned char data[PACKET_DATA_LEN]; |
38 |
unsigned char num_robots; |
39 |
unsigned char checksum; |
40 |
} ColonetPacket; |
41 |
|
42 |
#define SERIAL_PORT "/dev/ttyS0" |
43 |
#define USB_PORT "/dev/ttyUSB0" |
44 |
|
45 |
// Message dests
|
46 |
#define GLOBAL_DEST 200 |
47 |
#define MAX_NUM_ROBOTS 7 |
48 |
#define COLONET_SERVER_RESPONSE_ADDR 201 |
49 |
|
50 |
#define USER_DEFINED_MSG_ID_START 0xF0 |
51 |
#define USER_DEFINED_MSG_ID_END 0xFF |
52 |
#define USER_DEFINED_MSG_TOTAL 0x0F |
53 |
|
54 |
/* Low level robot commands */
|
55 |
//BUZZER
|
56 |
#define BUZZER_INIT 0x00 |
57 |
#define BUZZER_SET_VAL 0x01 |
58 |
#define BUZZER_SET_FREQ 0x02 |
59 |
#define BUZZER_CHIRP 0x03 |
60 |
#define BUZZER_OFF 0x04 |
61 |
|
62 |
//LCD
|
63 |
#define LCD_INIT 0x05 |
64 |
#define LCD_CLEAR_SCREEN 0x06 |
65 |
#define LCD_PUTBYTE 0x07 |
66 |
#define LCD_PUTCHAR 0x08 |
67 |
#define LCD_PUTSTR 0x09 |
68 |
#define LCD_GOTOXY 0x0A |
69 |
#define LCD_PUTINT 0x0B |
70 |
|
71 |
//ORB
|
72 |
#define ORB_INIT 0x0C |
73 |
#define ORB_SET 0x0D |
74 |
#define ORB_SET_COLOR 0x0E |
75 |
#define ORB_DISABLE 0x0F |
76 |
#define ORB_ENABLE 0x10 |
77 |
#define ORB_SET_DIO 0x11 |
78 |
#define LED_INIT 0x12 |
79 |
#define LED_USER 0x13 |
80 |
#define ORB_SET_NUM_NS 0x14 |
81 |
#define ORB_SET_NUM 0x15 |
82 |
#define ORB_SEND 0x16 |
83 |
|
84 |
//MOTORS
|
85 |
#define MOTORS_INIT 0x17 |
86 |
#define MOTOR1_SET 0x18 |
87 |
#define MOTOR2_SET 0x19 |
88 |
#define MOTORS_OFF 0x1A |
89 |
#define MOVE 0x1B |
90 |
#define MOVE_AVOID 0x1C |
91 |
|
92 |
//SHARP
|
93 |
#define READ_DISTANCE 0x24 |
94 |
#define LINEARIZE_DISTANCE 0x25 |
95 |
#define LOG_DISTANCE 0x26 |
96 |
#define ENABLE_IR 0x27 |
97 |
#define DISABLE_IR 0x28 |
98 |
|
99 |
//SERIAL
|
100 |
#define XBEE_INIT 0x29 |
101 |
#define XBEE_PUTC 0x2A |
102 |
#define XBEE_GETC 0x2B |
103 |
|
104 |
#define USB_INIT 0x2D |
105 |
#define USB_PUTC 0x2E |
106 |
#define USB_GETC 0x2F |
107 |
|
108 |
|
109 |
|
110 |
//DELAY_MS
|
111 |
#define DELAY_MS 0x31 |
112 |
|
113 |
//ANALOG
|
114 |
#define ANALOG_INIT 0x32 |
115 |
#define SET_ADC_MUX 0x33 |
116 |
#define ENABLE_ANALOG 0x34 |
117 |
#define CALL_ANALOG8 0x35 |
118 |
#define CALL_ANALOG10 0x36 |
119 |
#define WHEEL 0x37 |
120 |
#define BATTERY 0x38 |
121 |
|
122 |
//BOM
|
123 |
#define GETMAXBOM 0x39 |
124 |
#define BOM_ON 0x3A |
125 |
#define BOM_OFF 0x3B |
126 |
#define OUTPUT_HIGH 0x3C |
127 |
#define OUTPUT_LOW 0x3D |
128 |
|
129 |
//DIO
|
130 |
#define DIGITAL_INPUT 0x3E |
131 |
#define DIGITAL_OUTPUT 0x3F |
132 |
#define BUTTON1_READ 0x41 |
133 |
#define BUTTON1_WAIT 0x42 |
134 |
#define BUTTON1_WAIT_LED 0x43 |
135 |
#define BUTTON2_READ 0x44 |
136 |
#define BUTTON2_WAIT 0x45 |
137 |
#define BUTTON2_WAIT_LED 0x46 |
138 |
|
139 |
//WL
|
140 |
#define WL_INIT 0x47 |
141 |
#define PARSE_BUFFER 0x48 |
142 |
#define WL_SEND 0x49 |
143 |
|
144 |
//BUMPER
|
145 |
#define DETECT_BUMP 0x50 |
146 |
|
147 |
//Other
|
148 |
#define PRINTF 0x51 |
149 |
#define KILL_ROBOT 0x52 |
150 |
|
151 |
|
152 |
|
153 |
|
154 |
/* End low-level robot commands */
|
155 |
|
156 |
|
157 |
//Colonet Client commands
|
158 |
#define MAX_COMMAND_LEN 128 |
159 |
#define MAX_RESPONSE_LEN 512 |
160 |
|
161 |
#define SEND_TO_ROBOT 0x00 |
162 |
#define REQUEST_FROM_ROBOT 0x01 |
163 |
#define RESPONSE_TO_CLIENT_REQUEST 0x02 |
164 |
|
165 |
#endif
|