-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBasicFunctions.java
More file actions
57 lines (51 loc) · 1.31 KB
/
BasicFunctions.java
File metadata and controls
57 lines (51 loc) · 1.31 KB
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
package frc.robot.SyncedLibraries;
import frc.robot.SyncedLibraries.SystemBases.ControllerBase;
import frc.robot.SyncedLibraries.SystemBases.Estopable;
public class BasicFunctions {
/**
* Deadband that includes increased slope for full range of motion
* <p>
* Inputs must be from -1 to 1
*/
public static double deadband(double input, double deadband) {
if (Math.abs(input) < deadband) {
return 0;
} else {
return (input - (Math.abs(input) / input * deadband)) / (1 - deadband);
}
}
/** Exponent that keeps the sign of the input */
public static double smartExp(double x, double exponent) {
double result = Math.pow(x, exponent);
if (Math.signum(result) == Math.signum(x)) {
return result;
}
return -result;
}
@Deprecated
public static interface ControllerRunnable {
public void run(ControllerBase controller);
}
/**
* <b>ONLY FOR USE IN EMERGENCY</b>
* <p>
* YES, ACTUALLY
*
* @deprecated Use {@link @Estopable#KILLIT()} instead
*/
@Deprecated
public static void KILLIT(Estopable DriveTrain) {
Estopable.KILLIT();
}
/**
* <b>ONLY FOR USE IN EMERGENCY</b>
* <p>
* YES, ACTUALLY
*
* @deprecated Use "Estoppable.KILLIT()" instead
*/
@Deprecated
public static void KILLIT() {
Estopable.KILLIT();
}
}