Project

General

Profile

Statistics
| Revision:

root / trunk / code / behaviors / bfs_fsm / bfs_fsm.h @ 672

History | View | Annotate | Download (1.27 KB)

1
// BFS FSM header file
2

    
3

    
4
#ifndef _BFS_FSM_H_
5
#define _BFS_FSM_H_
6

    
7
//The States: 
8
#define BFS_SEEK      12           //do run around
9
#define BFS_FOLLOW    13           //follow other robots to location
10
#define BFS_ORBIT     15           //Orbit robot
11
#define BFS_STOP      16           //Stop.  The default and ending state
12

    
13

    
14
#define BFS_STRAIGHT_SPEED 160
15

    
16
#define BFS_ORBIT_DISTANCE 120 /* distance to start orbit around robot */
17

    
18
#define BFS_STOP_DISTANCE 100 /* distance to stop for object */
19

    
20
#define BFS_MAX_ROBOTS 20 /* max id of robot in project */
21

    
22
#define BFS_NO_VAL 255
23

    
24

    
25

    
26
int bfs_state;    /*State machine variable.*/
27

    
28
int bfs_otherRobot; /* the robot we are seeking */
29
int bfs_my_id; /* my wireless id */
30
int bfs_follow_id; /* robot to follow */
31

    
32

    
33
int bfs_pControl;                /*Proportional control variable, determines turn direction.*/
34
int bfs_d1,bfs_d2,bfs_d3,bfs_d4,bfs_d5;        /*The five distances taken in by IR.*/
35
int bfs_bom; /* bom data */
36
int bfs_bom_count;
37

    
38
#define BFS_MAX_BOM_COUNT 5 /* number of missing bom packets before reverting to seek state */
39

    
40
/* bfs_init
41
   argument: robot_id that you want to find
42
   notes: must call before bfs_fsm
43
*/
44
void bfs_init(int robot);
45

    
46

    
47
/* bfs_fsm
48
   argument: none
49
   notes: call in a while loop to perform FSM action
50
*/
51
void bfs_fsm(void);
52

    
53
#endif