Statistics
| Revision:

root / demos / smart_run_around_fsm / src / smart_run_around_fsm.h @ 1784

History | View | Annotate | Download (1.1 KB)

1
//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 60
17
#define CRAZY_MAX 200       //The number of counts between "crazy moments"
18
#define STRAIT_SPEED 185    //The speed when going strait or backing up.
19
#define TURN_CONSTANT 2
20
#define PCONTROL_CRAZY_LIMIT 80
21

    
22
int avoid_state;
23
int prev_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