Revision 584
added a define value for the change in direction used by the fsm.
code worked in my trail w/ robot 1 as the decoy, robo 7 as the driver
branches/orbit/code/behaviors/orbit_fsm/decoy/decoy.c | ||
---|---|---|
15 | 15 |
orb_init(); |
16 | 16 |
orb_set_color(PURPLE); |
17 | 17 |
wl_init(); |
18 |
wl_set_channel("O"); |
|
18 | 19 |
wl_token_ring_register(); |
19 | 20 |
wl_token_ring_join(); // join token ring |
20 | 21 |
usb_init(); |
21 | 22 |
usb_puts("start"); |
22 | 23 |
usb_puti(wl_get_xbee_id()); |
23 | 24 |
usb_puts("end"); |
25 |
|
|
24 | 26 |
|
25 | 27 |
|
26 | 28 |
while(1) { |
branches/orbit/code/behaviors/orbit_fsm/orbit_fsm.c | ||
---|---|---|
35 | 35 |
orbit_pControl=0; |
36 | 36 |
orbit_bom = 0; |
37 | 37 |
orbit_theta = 0; |
38 |
orbit_theta_stop = -1;
|
|
38 |
orbit_theta_stop = 1000;
|
|
39 | 39 |
|
40 | 40 |
/*Initialize distances to zero.*/ |
41 | 41 |
orbit_d1=1000; orbit_d2=1000; orbit_d3=1000; orbit_d4=1000; orbit_d5=1000; |
... | ... | |
133 | 133 |
if (orbit_bom == ORBIT_DIRECTION) |
134 | 134 |
orbit_pControl = ORBIT_DIRECTION; |
135 | 135 |
else if (orbit_bom < ORBIT_DIRECTION) |
136 |
orbit_pControl = ORBIT_DIRECTION-5;
|
|
136 |
orbit_pControl = ORBIT_DIRECTION-ORBIT_CORRECTION;
|
|
137 | 137 |
else |
138 |
orbit_pControl = ORBIT_DIRECTION+5;
|
|
138 |
orbit_pControl = ORBIT_DIRECTION+ORBIT_CORRECTION;
|
|
139 | 139 |
|
140 | 140 |
move(ORBIT_STRAIGHT_SPEED,orbit_pControl); |
141 | 141 |
break; |
branches/orbit/code/behaviors/orbit_fsm/orbit_fsm.h | ||
---|---|---|
12 | 12 |
|
13 | 13 |
|
14 | 14 |
#define ORBIT_STRAIGHT_SPEED 160 |
15 |
#define ORBIT_CORRECTION 9 |
|
15 | 16 |
|
16 | 17 |
|
17 | 18 |
#define ORBIT_DIRECTION 4 // if 4, then orbit to the right; if -4, then orbit to the left |
branches/orbit/code/behaviors/orbit_fsm/driver.c | ||
---|---|---|
15 | 15 |
orb_init(); |
16 | 16 |
orb_set_color(PURPLE); |
17 | 17 |
wl_init(); |
18 |
wl_set_channel("O"); |
|
18 | 19 |
wl_token_ring_register(); |
19 | 20 |
wl_token_ring_join(); // join token ring |
20 | 21 |
|
... | ... | |
28 | 29 |
break; |
29 | 30 |
}*/ |
30 | 31 |
|
31 |
orbit_init(9);//robot);
|
|
32 |
orbit_init(1);//robot);
|
|
32 | 33 |
|
33 | 34 |
while(1) { |
34 | 35 |
orbit_fsm(); // do orbit |
Also available in: Unified diff