Revision 120
Seems to work until we get to seeking, where there may be issues with the motors.
seeking.c | ||
---|---|---|
36 | 36 |
seeking_state = seek_station_with_homing_sensor(); |
37 | 37 |
} |
38 | 38 |
|
39 |
int old_reading = 0; |
|
40 |
|
|
39 | 41 |
int seek_station_with_bom(int station) |
40 | 42 |
{ |
41 | 43 |
int charging_loc = wl_token_get_my_sensor_reading(station); |
44 |
if (charging_loc != old_reading) |
|
45 |
{ |
|
46 |
RECHARGE_DEBUG_PRINT("BOM reading: "); |
|
47 |
RECHARGE_DEBUG_PUTI(charging_loc); |
|
48 |
RECHARGE_DEBUG_PRINT("\n"); |
|
49 |
old_reading = charging_loc; |
|
50 |
} |
|
42 | 51 |
|
43 | 52 |
//move to charging station if charging_loc != -1 |
44 | 53 |
//at this point, wl_csloc is set to the max bom reading |
... | ... | |
56 | 65 |
/*if( abs_int(err) > 2) |
57 | 66 |
v = SEEKING_BOM_VELOCITY_TURN; |
58 | 67 |
*/ |
68 |
//TODO: uncomment this line |
|
59 | 69 |
move_avoid(v, w, 5); |
60 | 70 |
} |
61 | 71 |
|
62 | 72 |
//data is fresh, use it |
63 |
int widthcount = recharge_i2c_get_homing_reading(); |
|
73 |
//TODO: uncomment to use homing sensor |
|
74 |
/*int widthcount = recharge_i2c_get_homing_reading(); |
|
64 | 75 |
|
65 | 76 |
if(widthcount>= 4) |
66 |
return SEEK_WITH_HOMING; |
|
77 |
return SEEK_WITH_HOMING;*/
|
|
67 | 78 |
return SEEK_WITH_BOM; |
68 | 79 |
} |
69 | 80 |
|
... | ... | |
71 | 82 |
{ |
72 | 83 |
//TODO: create function in homing.h to return LEFT, FORWARD, RIGHT, or NONE |
73 | 84 |
int widthcount = recharge_i2c_get_homing_reading(); |
85 |
RECHARGE_DEBUG_PRINT("Homing sensor: "); |
|
86 |
RECHARGE_DEBUG_PUTI(widthcount); |
|
87 |
RECHARGE_DEBUG_PRINT("\n"); |
|
74 | 88 |
|
75 | 89 |
if (widthcount < LEFT_LOW) //can't use beacon, switch to BOM |
76 | 90 |
return SEEK_WITH_BOM; |
Also available in: Unified diff