-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArm.java
More file actions
43 lines (34 loc) · 1.01 KB
/
Arm.java
File metadata and controls
43 lines (34 loc) · 1.01 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
package org.firstinspires.ftc.teamcode.Subsystems;
import com.qualcomm.robotcore.hardware.HardwareMap;
import com.qualcomm.robotcore.hardware.Servo;
public class Arm {
Servo armServo;
public boolean isUp = false;
private enum armServoStateEnum {Up, Down};
armServoStateEnum armServoState;
public Arm(String armServo, HardwareMap hardwareMap) {
this.armServo = hardwareMap.servo.get(armServo);
this.goDown();
}
public void goUp() {
armServo.setPosition(0.9);
armServoState = armServoStateEnum.Up;
isUp = true;
}
public void goDown() {
armServo.setPosition(0.3);
armServoState = armServoStateEnum.Down;
isUp = false;
}
@Override
public String toString() {
switch (armServoState) {
case Up:
return "Arm Up";
case Down:
return "Arm Down";
default:
return "unknown";
}
}
}