root / branches / autonomous_recharging / code / projects / autonomous_recharging / dragonfly / smart_run_around_fsm.h @ 695
History | View | Annotate | Download (1.11 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 | 695 | cmar | #define STRAIT_SPEED 175 //The speed when going strait <-- (WAS 185) |
19 | #define BACK_SPEED -200 |
||
20 | 337 | bcoltin | #define TURN_CONSTANT 4 |
21 | 321 | bcoltin | #define PCONTROL_CRAZY_LIMIT 80 |
22 | |||
23 | int avoid_state; /*State machine variable.*/ |
||
24 | int crazy_count; /*Counter for a 'get unstuck' behavior.*/ |
||
25 | |||
26 | int backup_count; /*Counter for backup duration.*/ |
||
27 | int pControl; /*Proportional control variable, determines turn direction.*/ |
||
28 | int d1,d2,d3,d4,d5; /*The five distances taken in by IR.*/ |
||
29 | |||
30 | void run_around_init(void); |
||
31 | void run_around_FSM(void); |
||
32 | void evaluate_state(void); |
||
33 | |||
34 | #endif |