Project

General

Profile

Statistics
| Branch: | Revision:

scoutos / scout / libscout / src / behaviors / lineDrive.h @ 60b98383

History | View | Annotate | Download (876 Bytes)

1
#ifndef _LINE_DRIVE_H_
2
#define _LINE_DRIVE_H_
3

    
4
#include "../Behavior.h"
5
#include "lineFollow.h"
6

    
7
/*
8
 * Defines whether your making a turn from the main two-way road
9
 * or from a one-way sub road.
10
*/
11
#define ON_ROAD                0
12
#define OFF_ROAD        0
13

    
14
/*
15
 * The type of turn you are making from the road you are on.
16
*/
17
#define ISTRAIGHT        0
18
#define ILEFT                1
19
#define IRIGHT                2
20
#define IUTURN                3
21

    
22
#define NORMAL                -1
23
#define FINISHED        -2
24
#define LOST                -3
25
#define ERROR                -4
26

    
27
class line_drive : Behavior{
28
        line_drive(String scoutname);
29
        run();
30

    
31
        void line_drive_init(void);
32

    
33
        int doDrive(int speed);
34

    
35
        void start(void);
36
        void stop(void);
37

    
38

    
39
        int turn(int type, iint dir);
40

    
41
  private:
42
  int state[5];       //! Stores a queue of sub-commands to be executed
43
  int stateCounter;
44
  int stateLength;
45

    
46
  //! Whether line_drive is currently paused. Set to 0 on initialization.
47
  int stopped=1;
48

    
49
};
50

    
51
#endif