root / branches / autonomous_recharging / code / projects / autonomous_recharging / dragonfly / smart_run_around_fsm.h @ 593
History | View | Annotate | Download (1.1 KB)
1 | 321 | bcoltin | //Obstacle Avoid Numbers
|
---|---|---|---|
2 | |||
3 | |||
4 | #ifndef _RUN_AROUND_FSM_H_
|
||
5 | #define _RUN_AROUND_FSM_H_
|
||
6 | |||
7 | //The States:
|
||
8 | #define MOVING 12 //Move strait. |
||
9 | #define BACKWARDS 15 //Move backwards. (Front close to wall.) |
||
10 | #define STOP 16 //Stop. The default state, (Something broke). |
||
11 | #define CRAZY 40 //Erratic behavior that occurs more often when the robot is frequently trying to turn. (i.e. may be stuck.) |
||
12 | |||
13 | #define LEFT 37 //Left |
||
14 | #define RIGHT 39 //Right |
||
15 | |||
16 | #define BACKUP_MAX 20 |
||
17 | #define CRAZY_MAX 200 //The number of counts between "crazy moments" |
||
18 | 593 | cmar | #define STRAIT_SPEED 165 //The speed when going strait or backing up. <-- (WAS 185) |
19 | 337 | bcoltin | #define TURN_CONSTANT 4 |
20 | 321 | bcoltin | #define PCONTROL_CRAZY_LIMIT 80 |
21 | |||
22 | int avoid_state; /*State machine variable.*/ |
||
23 | int crazy_count; /*Counter for a 'get unstuck' behavior.*/ |
||
24 | |||
25 | int backup_count; /*Counter for backup duration.*/ |
||
26 | int pControl; /*Proportional control variable, determines turn direction.*/ |
||
27 | int d1,d2,d3,d4,d5; /*The five distances taken in by IR.*/ |
||
28 | |||
29 | void run_around_init(void); |
||
30 | void run_around_FSM(void); |
||
31 | void evaluate_state(void); |
||
32 | |||
33 | #endif |