Project

General

Profile

Statistics
| Revision:

root / trunk / code / projects / object_manipulation / obj_detect_swarm / bfs_fsm.h @ 741

History | View | Annotate | Download (1.43 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 170
15

    
16
#define BFS_SLOW_DISTANCE 250
17
#define BFS_SLOW_SPEED    160
18

    
19
#define BFS_ORBIT_DISTANCE 175 /* distance to start orbit around robot */
20

    
21
#define BFS_STOP_DISTANCE 120 /* distance to stop for object */
22

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

    
25
#define BFS_NO_VAL 255
26

    
27
#define BFS_CHECK_ID_TIME 100
28

    
29

    
30

    
31
int bfs_state;    /*State machine variable.*/
32
int bfs_speed;
33

    
34
int bfs_otherRobot; /* the robot we are seeking */
35
int bfs_my_id; /* my wireless id */
36
int bfs_follow_id; /* robot to follow */
37
int bfs_check_id; /* timer to check robot id to follow */
38

    
39

    
40
int bfs_pControl;                /*Proportional control variable, determines turn direction.*/
41
int bfs_d1,bfs_d2,bfs_d3,bfs_d4,bfs_d5;        /*The five distances taken in by IR.*/
42
int bfs_bom; /* bom data */
43
int bfs_bom_count;
44

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

    
47
/* bfs_init
48
   argument: robot_id that you want to find
49
   notes: must call before bfs_fsm
50
*/
51
void bfs_init(int robot);
52

    
53

    
54
/* bfs_fsm
55
   argument: none
56
   notes: call in a while loop to perform FSM action
57
*/
58
void bfs_fsm(void);
59

    
60
#endif