Project

General

Profile

Statistics
| Revision:

root / trunk / code / projects / mapping / auto / smart_run_around_fsm.h @ 1161

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

    
19
int avoid_state;    /*State machine variable.*/
20
int crazy_count;    /*Counter for a 'get unstuck' behavior.*/
21

    
22
int backup_count;        /*Counter for backup duration.*/
23
int pControl;                /*Proportional control variable, determines turn direction.*/
24
int d1,d2,d3,d4,d5;        /*The five distances taken in by IR.*/
25

    
26
void run_around_init(void);
27
void run_around_FSM(void);
28
void evaluate_state(void);
29

    
30
#endif