Revision 1592
Included working functionality for Beacon to get acks from each robot.
trunk/code/behaviors/formation_control/circle2/circle.c | ||
---|---|---|
84 | 84 |
} |
85 | 85 |
} |
86 | 86 |
|
87 |
void turn_to_beacon2(int max){ // like the previous but no stop() call |
|
87 |
void turn_to_beacon2(int max){ // like the previous but no stop() call' |
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
|
88 | 92 |
if (max>-1 && max<16){ |
89 | 93 |
int index = (max+12)%16; |
90 | 94 |
if (index==0) { |
... | ... | |
165 | 169 |
wl_set_channel(24); |
166 | 170 |
|
167 | 171 |
int robotid = get_robotid(); |
172 |
int used[16]; |
|
168 | 173 |
char send_buffer[2]; |
169 | 174 |
int data_length; |
170 | 175 |
unsigned char *packet_data=wl_basic_do_default(&data_length); |
... | ... | |
198 | 203 |
if(packet_data != 0 && data_length>=2 && packet_data[0]==CIRCLE_ACTION_EXIST) |
199 | 204 |
{ |
200 | 205 |
send_buffer[0]=CIRCLE_ACTION_ACK; |
201 |
send_buffer[1]=get_robotid();
|
|
206 |
send_buffer[1]=robotid;
|
|
202 | 207 |
|
203 | 208 |
wl_basic_send_global_packet(42,send_buffer,2); |
204 | 209 |
break; |
... | ... | |
262 | 267 |
if(packet_data!=0 && data_length>=2 && packet_data[0]==CIRCLE_ACTION_ACK) |
263 | 268 |
{ |
264 | 269 |
orb_set_color(WHITE); |
265 |
robotsRecieved++; |
|
270 |
if(used[packet_data[1]]==0){//only add to robots seen if you haven't gotten an ACK from this robot |
|
271 |
robotsRecieved++; |
|
272 |
used[packet_data[1]]=1; |
|
273 |
} |
|
266 | 274 |
} |
267 | 275 |
if(robotsRecieved==NUM_ROBOTS) |
268 | 276 |
beacon_State=3; |
trunk/code/behaviors/formation_control/circle2/Makefile | ||
---|---|---|
11 | 11 |
USE_WIRELESS = 1 |
12 | 12 |
|
13 | 13 |
# com1 = serial port. Use lpt1 to connect to parallel port. |
14 |
AVRDUDE_PORT = $(shell if uname -s |grep -i w32 >/dev/null; then echo 'COM7:'; else echo '/dev/ttyUSB0'; fi)
|
|
14 |
AVRDUDE_PORT = $(shell if uname -s |grep -i w32 >/dev/null; then echo 'COM10:'; else echo '/dev/ttyUSB0'; fi)
|
|
15 | 15 |
else |
16 | 16 |
COLONYROOT := ../$(COLONYROOT) |
17 | 17 |
endif |
Also available in: Unified diff