root / branches / lemmings / code / behaviors / smart_run_around_fsm / orbit_fsm.h @ 536
History | View | Annotate | Download (1.41 KB)
1 |
//Obstacle Avoid Numbers
|
---|---|
2 |
|
3 |
|
4 |
#ifndef _ORBIT_FSM_H_
|
5 |
#define _ORBIT_FSM_H_
|
6 |
|
7 |
//The States:
|
8 |
#define ORBIT_SEEK 12 //Move straight towards robot |
9 |
#define ORBIT_INSERTION 13 //Rotate into orbit |
10 |
#define ORBIT_ORBITING 15 //Orbit robot |
11 |
#define ORBIT_STOP 16 //Stop. The default and ending state |
12 |
|
13 |
|
14 |
#define ORBIT_STRAIGHT_SPEED 160 |
15 |
|
16 |
|
17 |
#define ORBIT_DIRECTION 4 // if 4, then orbit to the right; if -4, then orbit to the left |
18 |
|
19 |
#define ORBIT_DISTANCE 250 // orbit distance as measured by rangefinders |
20 |
|
21 |
|
22 |
int orbit_state; /*State machine variable.*/ |
23 |
|
24 |
int orbit_otherRobot; /* must be set prior to running FSM */ |
25 |
|
26 |
|
27 |
int orbit_pControl; /*Proportional control variable, determines turn direction.*/ |
28 |
int orbit_d1,orbit_d2,orbit_d3,orbit_d4,orbit_d5; /*The five distances taken in by IR.*/ |
29 |
int orbit_bom; /* bom data */ |
30 |
int orbit_theta; /* number of degrees traveled in orbit */ |
31 |
int orbit_theta_stop; /* stop condition in number of degrees traveled */ |
32 |
|
33 |
/* orbit_init
|
34 |
argument: robot_id that you want to orbit
|
35 |
notes: must call before orbit_fsm
|
36 |
*/
|
37 |
void orbit_init(int robot); |
38 |
|
39 |
/* orbit_init_theta
|
40 |
argument: robot_id that you want to orbit
|
41 |
theta that you want to stop orbiting at
|
42 |
notes: must call before orbit_fsm
|
43 |
*/
|
44 |
void orbit_init_theta(int robot,int theta); |
45 |
|
46 |
/* orbit_fsm
|
47 |
argument: none
|
48 |
notes: call in a while loop to perform FSM action
|
49 |
*/
|
50 |
void orbit_fsm(void); |
51 |
|
52 |
#endif
|