root / trunk / code / behaviors / bfs_fsm / bfs_fsm.h @ 678
History | View | Annotate | Download (1.36 KB)
1 | 672 | dsschult | // 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 | 678 | dsschult | #define BFS_CHECK_ID_TIME 100 |
25 | 672 | dsschult | |
26 | |||
27 | 678 | dsschult | |
28 | 672 | dsschult | int bfs_state; /*State machine variable.*/ |
29 | |||
30 | int bfs_otherRobot; /* the robot we are seeking */ |
||
31 | int bfs_my_id; /* my wireless id */ |
||
32 | int bfs_follow_id; /* robot to follow */ |
||
33 | 678 | dsschult | int bfs_check_id; /* timer to check robot id to follow */ |
34 | 672 | dsschult | |
35 | |||
36 | int bfs_pControl; /*Proportional control variable, determines turn direction.*/ |
||
37 | int bfs_d1,bfs_d2,bfs_d3,bfs_d4,bfs_d5; /*The five distances taken in by IR.*/ |
||
38 | int bfs_bom; /* bom data */ |
||
39 | int bfs_bom_count;
|
||
40 | |||
41 | #define BFS_MAX_BOM_COUNT 5 /* number of missing bom packets before reverting to seek state */ |
||
42 | |||
43 | /* bfs_init
|
||
44 | argument: robot_id that you want to find
|
||
45 | notes: must call before bfs_fsm
|
||
46 | */
|
||
47 | void bfs_init(int robot); |
||
48 | |||
49 | |||
50 | /* bfs_fsm
|
||
51 | argument: none
|
||
52 | notes: call in a while loop to perform FSM action
|
||
53 | */
|
||
54 | void bfs_fsm(void); |
||
55 | |||
56 | #endif |