Project

General

Profile

Statistics
| Revision:

root / branches / slam / code / projects / slam / robot / smart_run_around_fsm.h @ 121

History | View | Annotate | Download (1.08 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 15
17
#define CRAZY_MAX 200       //The number of counts between "crazy moments"
18
#define STRAIT_SPEED 200    //The speed when going strait or backing up.
19
#define TURN_CONSTANT 2
20
#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