Revision 330
trunk/code/projects/colonet/followLeader/colonet_defs.h | ||
---|---|---|
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 |
// PacketGroup id for wireless library. |
|
12 |
#define COLONET_PACKET_GROUP_ID 8 |
|
13 |
#define COLONET_RESPONSE_PACKET_FRAME_ID COLONET_PACKET_GROUP_ID |
|
14 |
|
|
15 |
// Message types |
|
16 |
typedef enum {COLONET_COMMAND = 13, COLONET_REQUEST = 14, |
|
17 |
COLONET_RESPONSE = 15} ColonetMessageType; |
|
18 |
|
|
19 |
//Packet properties |
|
20 |
#define PACKET_DATA_LEN 7 |
|
21 |
|
|
22 |
#define WL_DEFAULT_PAN 3332 |
|
23 |
|
|
24 |
#define SERIAL_PORT "/dev/ttyS0" |
|
25 |
#define USB_PORT "/dev/ttyUSB0" |
|
26 |
|
|
27 |
// Message dests |
|
28 |
#define GLOBAL_DEST 200 |
|
29 |
//#define MAX_NUM_ROBOTS 7 |
|
30 |
#define COLONET_SERVER_RESPONSE_ADDR 201 |
|
31 |
|
|
32 |
#define USER_DEFINED_MSG_ID_START 0xF0 |
|
33 |
#define USER_DEFINED_MSG_ID_END 0xFF |
|
34 |
#define USER_DEFINED_MSG_TOTAL 0x0F |
|
35 |
|
|
36 |
/* This is the packet structure of the data buffer sent from the colonet |
|
37 |
* wireless library to the robots and from the robots to the colonet wireless |
|
38 |
* library. */ |
|
39 |
typedef struct { |
|
40 |
short client_id; // ID number of the client sending the packet. |
|
41 |
// Size of short is common to robots and server. |
|
42 |
unsigned char msg_code; // Specific instruction for the robot -- see below. |
|
43 |
unsigned char data[PACKET_DATA_LEN]; |
|
44 |
} ColonetRobotServerPacket; |
|
45 |
|
|
46 |
/* Message codes */ |
|
47 |
//BUZZER |
|
48 |
#define BUZZER_INIT 0x00 |
|
49 |
#define BUZZER_SET_VAL 0x01 |
|
50 |
#define BUZZER_SET_FREQ 0x02 |
|
51 |
#define BUZZER_CHIRP 0x03 |
|
52 |
#define BUZZER_OFF 0x04 |
|
53 |
|
|
54 |
//LCD |
|
55 |
#define LCD_INIT 0x05 |
|
56 |
#define LCD_CLEAR_SCREEN 0x06 |
|
57 |
#define LCD_PUTBYTE 0x07 |
|
58 |
#define LCD_PUTCHAR 0x08 |
|
59 |
#define LCD_PUTSTR 0x09 |
|
60 |
#define LCD_GOTOXY 0x0A |
|
61 |
#define LCD_PUTINT 0x0B |
|
62 |
|
|
63 |
//ORB |
|
64 |
#define ORB_INIT 0x0C |
|
65 |
#define ORB_SET 0x0D |
|
66 |
#define ORB_SET_COLOR 0x0E |
|
67 |
#define ORB_DISABLE 0x0F |
|
68 |
#define ORB_ENABLE 0x10 |
|
69 |
#define ORB_SET_DIO 0x11 |
|
70 |
#define LED_INIT 0x12 |
|
71 |
#define LED_USER 0x13 |
|
72 |
#define ORB_SET_NUM_NS 0x14 |
|
73 |
#define ORB_SET_NUM 0x15 |
|
74 |
#define ORB_SEND 0x16 |
|
75 |
|
|
76 |
//MOTORS |
|
77 |
#define MOTORS_INIT 0x17 |
|
78 |
#define MOTOR1_SET 0x18 |
|
79 |
#define MOTOR2_SET 0x19 |
|
80 |
#define MOTORS_OFF 0x1A |
|
81 |
#define MOVE 0x1B |
|
82 |
#define MOVE_AVOID 0x1C |
|
83 |
|
|
84 |
//SHARP |
|
85 |
#define READ_DISTANCE 0x24 |
|
86 |
#define LINEARIZE_DISTANCE 0x25 |
|
87 |
#define LOG_DISTANCE 0x26 |
|
88 |
#define ENABLE_IR 0x27 |
|
89 |
#define DISABLE_IR 0x28 |
|
90 |
|
|
91 |
//SERIAL |
|
92 |
#define XBEE_INIT 0x29 |
|
93 |
#define XBEE_PUTC 0x2A |
|
94 |
#define XBEE_GETC 0x2B |
|
95 |
|
|
96 |
#define USB_INIT 0x2D |
|
97 |
#define USB_PUTC 0x2E |
|
98 |
#define USB_GETC 0x2F |
|
99 |
|
|
100 |
|
|
101 |
|
|
102 |
//DELAY_MS |
|
103 |
#define DELAY_MS 0x31 |
|
104 |
|
|
105 |
//ANALOG |
|
106 |
#define ANALOG_INIT 0x32 |
|
107 |
#define SET_ADC_MUX 0x33 |
|
108 |
#define ENABLE_ANALOG 0x34 |
|
109 |
#define CALL_ANALOG8 0x35 |
|
110 |
#define CALL_ANALOG10 0x36 |
|
111 |
#define WHEEL 0x37 |
|
112 |
#define BATTERY 0x38 |
|
113 |
|
|
114 |
//BOM |
|
115 |
#define GETMAXBOM 0x39 |
|
116 |
#define BOM_ON 0x3A |
|
117 |
#define BOM_OFF 0x3B |
|
118 |
#define OUTPUT_HIGH 0x3C |
|
119 |
#define OUTPUT_LOW 0x3D |
|
120 |
|
|
121 |
//DIO |
|
122 |
#define DIGITAL_INPUT 0x3E |
|
123 |
#define DIGITAL_OUTPUT 0x3F |
|
124 |
#define BUTTON1_READ 0x41 |
|
125 |
#define BUTTON1_WAIT 0x42 |
|
126 |
#define BUTTON1_WAIT_LED 0x43 |
|
127 |
#define BUTTON2_READ 0x44 |
|
128 |
#define BUTTON2_WAIT 0x45 |
|
129 |
#define BUTTON2_WAIT_LED 0x46 |
|
130 |
|
|
131 |
//WL |
|
132 |
#define WL_INIT 0x47 |
|
133 |
#define PARSE_BUFFER 0x48 |
|
134 |
#define WL_SEND 0x49 |
|
135 |
|
|
136 |
//BUMPER |
|
137 |
#define DETECT_BUMP 0x50 |
|
138 |
|
|
139 |
//Other |
|
140 |
#define PRINTF 0x51 |
|
141 |
#define KILL_ROBOT 0x52 |
|
142 |
|
|
143 |
/* End low-level robot commands */ |
|
144 |
|
|
145 |
|
|
146 |
/////////////////////////// |
|
147 |
//Colonet specific commands |
|
148 |
////////////////////////// |
|
149 |
|
|
150 |
#define REQUEST_BOM_MATRIX 0x90 |
|
151 |
//request: REQUEST_FROM_SERVER REQUEST_BOM_MATRIX |
|
152 |
//response: RESPONSE_TO_CLIENT_REQUEST REQUEST_BOM_MATRIX <numRobots> <row by row, values separated by spaces> |
|
153 |
// if you don't know a value in the matrix, put -1 in there |
|
154 |
|
|
155 |
#define REQUEST_XBEE_IDS 0x91 |
|
156 |
//request: REQUEST_FROM_SERVER REQUEST_XBEE_IDS |
|
157 |
//response: RESPONSE_TO_CLIENT_REQUEST REQUEST_XBEE_IDS <numRobots> <id0> <id1> ... <idNumRobots> |
|
158 |
|
|
159 |
|
|
160 |
|
|
161 |
//Colonet Client commands |
|
162 |
//TODO: renamed these to end in LENGTH |
|
163 |
#define MAX_COMMAND_LEN 128 |
|
164 |
#define MAX_RESPONSE_LEN 1024 |
|
165 |
|
|
166 |
#define SEND_TO_ROBOT 0x00 |
|
167 |
#define REQUEST_FROM_SERVER 0x01 |
|
168 |
#define RESPONSE_TO_CLIENT_REQUEST 0x02 |
|
169 |
|
|
170 |
|
|
171 |
#endif |
Also available in: Unified diff