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