Project

General

Profile

Statistics
| Revision:

root / trunk / code / behaviors / orbit_fsm / orbit_fsm.h @ 1390

History | View | Annotate | Download (1.43 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
#define ORBIT_CORRECTION 9
16

    
17

    
18
#define ORBIT_DIRECTION 4     // if 4, then orbit to the right; if -4, then orbit to the left
19

    
20
#define ORBIT_DISTANCE 250 // orbit distance as measured by rangefinders
21

    
22

    
23
int orbit_state;    /*State machine variable.*/
24

    
25
int orbit_otherRobot; /* must be set prior to running FSM */
26

    
27

    
28
int orbit_pControl;                /*Proportional control variable, determines turn direction.*/
29
int orbit_d1,orbit_d2,orbit_d3,orbit_d4,orbit_d5;        /*The five distances taken in by IR.*/
30
int orbit_bom; /* bom data */
31
int orbit_theta; /* number of degrees traveled in orbit */
32
int orbit_theta_stop; /* stop condition in number of degrees traveled */
33

    
34
/* orbit_init
35
   argument: robot_id that you want to orbit
36
   notes: must call before orbit_fsm
37
*/
38
void orbit_init(int robot);
39

    
40
/* orbit_init_theta
41
   argument: robot_id that you want to orbit
42
             theta that you want to stop orbiting at
43
   notes: must call before orbit_fsm
44
*/
45
void orbit_init_theta(int robot,int theta);
46

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

    
53
#endif