-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTuskGate.java
52 lines (37 loc) · 1.31 KB
/
TuskGate.java
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
package org.firstinspires.ftc.teamcode.Subsystems;
import com.qualcomm.robotcore.hardware.HardwareMap;
import com.qualcomm.robotcore.hardware.Servo;
/**
* Created by Owner_2 on 11/19/2016.
*/
public class TuskGate {
Servo tuskGateServo;
public boolean isOpen = false;
private enum tuskGateServoEnum {Release, Close}
tuskGateServoEnum tuskServoState = tuskGateServoEnum.Close;
public TuskGate(String tuskGateServo, HardwareMap hardwareMap) {
this.tuskGateServo = hardwareMap.servo.get(tuskGateServo);
this.closeGate();
}
public void closeGate() {
tuskGateServo.setPosition(0.9);
tuskServoState = tuskGateServoEnum.Close;
isOpen = false;
}
public void releaseTusks() {
tuskGateServo.setPosition(0.3);
tuskServoState = tuskGateServoEnum.Release;
isOpen = true;
}
@Override
public String toString() {
switch (tuskServoState) {
case Release:
return "Tusks Released";
case Close:
return "Tusk Gate Closed";
default:
return "unknown";
}
}
}