Revision 137
Updated recharing, software somewhat works.
departing.c | ||
---|---|---|
3 | 3 |
#include <rangefinder.h> |
4 | 4 |
#include <move.h> |
5 | 5 |
|
6 |
#include "recharge_defs.h" |
|
7 |
|
|
6 | 8 |
/** We stop backing up when this is our distance from the wall |
7 | 9 |
* in our front rangefinder. |
8 | 10 |
**/ |
9 |
#define LEAVE_HIT_WALL_DIST_THRESH 10
|
|
11 |
#define LEAVE_HIT_WALL_DIST_THRESH 70
|
|
10 | 12 |
|
11 | 13 |
/** |
12 | 14 |
* The velocity we travel at when leaving the station. |
... | ... | |
29 | 31 |
**/ |
30 | 32 |
int depart_station(void) |
31 | 33 |
{ |
32 |
int front_distance = range_read_distance(IR2); |
|
34 |
//TODO: use rangefinders to depart |
|
35 |
//int front_distance = range_read_distance(IR2); |
|
36 |
//RECHARGE_DEBUG_PUTI(front_distance); |
|
37 |
//RECHARGE_DEBUG_PRINT("\n"); |
|
33 | 38 |
|
34 |
if(front_distance > LEAVE_HIT_WALL_DIST_THRESH)
|
|
39 |
//if(front_distance != -1 && front_distance < 160)
|
|
35 | 40 |
leave_station_count++; |
36 |
else |
|
37 |
leave_station_count = 0; |
|
41 |
//else
|
|
42 |
// leave_station_count = 0;
|
|
38 | 43 |
|
39 |
if(leave_station_count > 5)
|
|
44 |
if(leave_station_count > 1000)
|
|
40 | 45 |
{ |
41 | 46 |
//stop |
42 | 47 |
move(0,0); |
Also available in: Unified diff