-
Notifications
You must be signed in to change notification settings - Fork 0
/
ClawLatch.java
executable file
·50 lines (40 loc) · 1.41 KB
/
ClawLatch.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
package org.firstinspires.ftc.teamcode;
import org.firstinspires.ftc.robotcore.external.Telemetry;
public class ClawLatch {
static final double DELTA_POSITION = 0.1;
static final double OPENPOSITION = 1;
static final double CLOSEPOSITION = 0;
HardwarePlatter theHardwarePlatter;
ClawLatch(HardwarePlatter hwPlatter) {
theHardwarePlatter = hwPlatter;
theHardwarePlatter.clawServo.setPosition(1);
}
void open() {
double newPosition;
newPosition = theHardwarePlatter.clawServo.getPosition() + DELTA_POSITION;
if (newPosition > 1.0) {
newPosition = 1.0;
}
theHardwarePlatter.clawServo.setPosition(newPosition);
}
void close() {
double newPosition;
newPosition = theHardwarePlatter.clawServo.getPosition() - DELTA_POSITION;
if (newPosition < 0) {
newPosition = 0;
}
theHardwarePlatter.clawServo.setPosition(newPosition);
}
void closeAuton() {
theHardwarePlatter.clawServo.setPosition(0);
}
void display(Telemetry telemetry) {
telemetry.addData("clawsevo pos", theHardwarePlatter.clawServo.getPosition());
}
void autoClose() {
theHardwarePlatter.clawServo.setPosition(CLOSEPOSITION);
}
void autoOpen() {
theHardwarePlatter.clawServo.setPosition(OPENPOSITION);
}
}