forked from WPIRoboticsEngineering/RBE2002_template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLineFollower.h
59 lines (48 loc) · 1.87 KB
/
LineFollower.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* LineFollower.h
*
* Created on: Oct 15, 2020
* Author: gentov
*/
#include "DrivingChassis.h"
#include "config.h"
#ifndef LINEFOLLOWER_H_
#define LINEFOLLOWER_H_
// AS OF 6:57 on 11/15/2020, the working values are:
/*
* const int ON_BLACK = 3600;//3750;
const int ON_GREY = 2875;
const int ON_WHITE = 2150;
int lineFollowingSpeedForwards_mm_per_sec = 175;
float lineFollowingKpForwards = .35;
int lineCount = 0;
bool canCountLine = false; // so we can start on a line
*/
class LineFollower{
public:
LineFollower();
// //NOTE: The closer we want to be to black, the higher this gain needs to be. Since we will be staying on white 90% of the
// // time, I made it try to find grey, not wobble between black. This was an oversight on my part last time
// float lineFollowingKpForwards = .035; //1.6, was 1.3, 2.4, .4, .55
const int ON_BLACK_FOLLOW = 3600;//3750;
const int ON_GREY_FOLLOW = 3150;
const int ON_WHITE_FOLLOW = 2700;
const int ON_BLACK_DETECT = 3800;
const int ON_GREY_DETECT = 2800;
const int ON_WHITE_DETECT = 1800;
int lineFollowingSpeedForwards_mm_per_sec = 170; // was 150, 125 (& 1.6 below), was 100, 175
int lineFollowingSpeedBackwards_mm_per_sec = 175;
float lineFollowingKpBackwards = .002*lineFollowingSpeedBackwards_mm_per_sec;
//NOTE: The closer we want to be to black, the higher this gain needs to be. Since we will be staying on white 90% of the
// time, I made it try to find grey, not wobble between black. This was an oversight on my part last time
float lineFollowingKpForwards = .12; //1.6, was 1.3, 2.4, .4, .55
int lineCount = 0;
bool canCountLine = false; // so we can start on a line
int lineDebouncing = 100;
void resetLineCount();
bool onMarker();
bool onMarkerFront();
void calibrate();
private:
};
#endif /* LINEFOLLOWER_H_ */