This repository was archived by the owner on Jun 9, 2025. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathPneumatics.java
More file actions
112 lines (82 loc) · 3.56 KB
/
Copy pathPneumatics.java
File metadata and controls
112 lines (82 loc) · 3.56 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
package frc.robot.subsystems;
import edu.wpi.first.wpilibj.AnalogPotentiometer;
import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.DoubleSolenoid;
import edu.wpi.first.wpilibj.PneumaticsModuleType;
import edu.wpi.first.wpilibj.DoubleSolenoid.Value;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
public class Pneumatics extends SubsystemBase {
//uncomment this for pneumatics
//Compressor pcmCompressor = new Compressor(0, PneumaticsModuleType.REVPH);
static DoubleSolenoid doubleSolenoidLeft1 = new DoubleSolenoid(PneumaticsModuleType.REVPH, 1, 2);
static DoubleSolenoid doubleSolenoidleft2 = new DoubleSolenoid(PneumaticsModuleType.REVPH, 4, 5);
static DoubleSolenoid doubleSolenoidRight1 = new DoubleSolenoid(PneumaticsModuleType.REVPH, 6, 7);
static DoubleSolenoid doubleSolenoidRight2 = new DoubleSolenoid(PneumaticsModuleType.REVPH, 8, 9);
static AnalogPotentiometer potentiometerLeft = new AnalogPotentiometer(0, 90, 0);
static AnalogPotentiometer potentiometerRight = new AnalogPotentiometer(1, 90, 0);
public Pneumatics(){
doubleSolenoidLeft1.set(Value.kOff);
doubleSolenoidleft2.set(Value.kOff);
doubleSolenoidRight1.set(Value.kOff);
doubleSolenoidRight2.set(Value.kOff);
}
public static void runForward(){
doubleSolenoidLeft1.set(Value.kForward);
doubleSolenoidleft2.set(Value.kReverse);
doubleSolenoidRight1.set(Value.kForward);
doubleSolenoidRight2.set(Value.kReverse);
}
public static void leftRunForward(){
doubleSolenoidLeft1.set(Value.kForward);
doubleSolenoidleft2.set(Value.kReverse);
}
public static void rightRunForward(){
doubleSolenoidRight1.set(Value.kForward);
doubleSolenoidRight2.set(Value.kReverse);
}
public static void runReverse(){
doubleSolenoidLeft1.set(Value.kReverse);
doubleSolenoidleft2.set(Value.kForward);
doubleSolenoidRight1.set(Value.kReverse);
doubleSolenoidRight2.set(Value.kForward);
}
public static void leftRunReverse(){
doubleSolenoidLeft1.set(Value.kReverse);
doubleSolenoidleft2.set(Value.kForward);
}
public static void rightRunReverse(){
doubleSolenoidRight1.set(Value.kReverse);
doubleSolenoidRight2.set(Value.kForward);
}
// public void middle(){
// double angle = potentiometerLeft.get() * 90;
// if (angle < 39 && angle > 0){
// //System.out.println(1.0);
// doubleSolenoidLeft1.set(Value.kForward);
// doubleSolenoidleft2.set(Value.kReverse);
// }
// if (angle > 51 && angle < 90){
// //System.out.println(2.0);
// doubleSolenoidLeft1.set(Value.kReverse);
// doubleSolenoidleft2.set(Value.kForward);
// }
// if (angle > 40 && angle < 50){
// //System.out.println(3.0);
// doubleSolenoidLeft1.set(Value.kOff);
// }
// }
public static void leftEqualize(){
doubleSolenoidLeft1.set(Value.kForward);
doubleSolenoidleft2.set(Value.kForward);
}
public static void rightEqualize(){
doubleSolenoidRight1.set(Value.kForward);
doubleSolenoidRight2.set(Value.kForward);
}
public static double getPotentiometerLeftAngle(){
return potentiometerLeft.get();
}
public static double getPotentiometerRightAngle(){
return potentiometerRight.get();
}
}