This repository was archived by the owner on Aug 8, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathOI.java
More file actions
132 lines (111 loc) · 3.07 KB
/
Copy pathOI.java
File metadata and controls
132 lines (111 loc) · 3.07 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
package org.usfirst.frc.team2906.robot;
import org.usfirst.frc.team2906.robot.commands.*;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.JoystickBase;
import edu.wpi.first.wpilibj.buttons.Button;
import edu.wpi.first.wpilibj.buttons.JoystickButton;
public class OI {
public Joystick joystick1;
public Joystick joystick2;
public JoystickButton trigr1;
public JoystickButton trigr2;
public JoystickBase pov;
public JoystickButton jack;
public JoystickButton jill;
public JoystickButton dann;
public OI(){
joystick1 = new Joystick(0);
joystick2 = new Joystick(1);
trigr1 = new JoystickButton(joystick1, 1);
trigr1.whileHeld(new LEDsOn());
trigr1.whenReleased(new LEDsOff());
trigr2 = new JoystickButton(joystick2, 1);
trigr2.whileHeld(new CameraRotatePOV());
trigr2.whenReleased(new CameraStopRotation());
//pov = new JoystickButton(joystick1,);
jack = new JoystickButton(joystick1, 11);
jack.whenPressed(new PistonExtends());
jill = new JoystickButton(joystick1, 12);
jill.whenPressed(new PistonReverses());
dann = new JoystickButton(joystick1, 3);
dann.whileHeld(new PistonsOff());
}
public Joystick getJoystick1() {
return joystick1;
}
public double getJoystick1X(){
if(Math.abs(joystick1.getX())>RobotMap.sensitivity){
return -1*joystick1.getX();
}
else {
return 0.0;
}
}
public double getJoystick1Y(){
if(Math.abs(joystick1.getY())>RobotMap.sensitivity){
return -1*joystick1.getY();
}
else {
return 0.0;
}
}
public double getJoystick1R(){
if(Math.abs(joystick1.getRawAxis(2))>RobotMap.sensitivity){
return -1*joystick1.getRawAxis(2);
}
else {
return 0.0;
}
}
public Joystick getJoystick2(){
return joystick2;
}
public double getJoystick2Y(){
if(Math.abs(joystick2.getY())>RobotMap.sensitivity){
return .4*joystick2.getY();
}
else {
return 0.0;
}
}
public double getJoystick2X(){
if(Math.abs(joystick2.getY())>RobotMap.sensitivity){
return .4*joystick2.getY();
}
else {
return 0.0;
}
}
public double getJoystick1POV(){
if(joystick1.getPOV(0) == 0){
return 1.0;
} else if(joystick1.getPOV(0) == 90){
return 90;
} else if(joystick1.getPOV(0) == 180){
return -1.0;
}else if(joystick1.getPOV(0) == 270){
return -90;
} else if(joystick1.getPOV(0) == -1){
return 0.0;
}
else{
return 0.0;
}
}
public double getJoystick2POV(){
if(joystick2.getPOV(0) == 270){
return -10.0;
} else if(joystick2.getPOV(0) == 90){
return 10.0;
} else if(joystick2.getPOV(0) == 45){
return 0.25;
}else if(joystick2.getPOV(0) == 315){
return -0.25;
} else if(joystick2.getPOV(0) == -1){
return 0.0;
}
else{
return 0.0;
}
}
}