Project

General

Profile

Statistics
| Revision:

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

History | View | Annotate | Download (1.43 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 740 dsschult
#define BFS_STRAIGHT_SPEED 170
15 672 dsschult
16 740 dsschult
#define BFS_SLOW_DISTANCE 250
17
#define BFS_SLOW_SPEED    160
18 672 dsschult
19 740 dsschult
#define BFS_ORBIT_DISTANCE 175 /* distance to start orbit around robot */
20 672 dsschult
21 711 dsschult
#define BFS_STOP_DISTANCE 120 /* distance to stop for object */
22
23 672 dsschult
#define BFS_MAX_ROBOTS 20 /* max id of robot in project */
24
25
#define BFS_NO_VAL 255
26
27 678 dsschult
#define BFS_CHECK_ID_TIME 100
28 672 dsschult
29
30 678 dsschult
31 672 dsschult
int bfs_state;    /*State machine variable.*/
32 711 dsschult
int bfs_speed;
33 672 dsschult
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 678 dsschult
int bfs_check_id; /* timer to check robot id to follow */
38 672 dsschult
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