-
Notifications
You must be signed in to change notification settings - Fork 3
/
TeleOp.java
98 lines (69 loc) · 2.11 KB
/
TeleOp.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
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
/*Authors:
*Adley: Debugging
*Oskar: Debugging
*Vikasni: Debugging
*Yvonne: Original Author
*Erika: stared at Yvonne while she made it
*/
package org.usfirst.frc.team2643.robot;
public class TeleOp extends Robot{
public static void intake(){
//change back to operatorGamePad
intakeMotor.set(intakeController.getY());
}
public static void shooter(){
shooterMotor.set(shooterStick.getRawAxis(1));
}
//add "boolean tankDrive = false" in final
public static void drive(){
if(gamePad.getRawButton(10)){ //update button numbers
isTankDrive = false;
System.out.println("arcade Drive");
}
else if(gamePad.getRawButton(9)){ //update button numbers
isTankDrive = true;
System.out.println("tank Drive");
}
if(isTankDrive){
tankDrive();
}else{
arcadeDrive();
}
}
public static void tankDrive(){
leftPosition = gamePad.getY() * 0.75;
rightPosition = gamePad.getRawAxis(3) * 0.75;
backLeftMotor.set(leftPosition);
backRightMotor.set(rightPosition);
frontLeftMotor.set(leftPosition);
frontRightMotor.set(rightPosition);
}
public static void arcadeDrive() {
double yPosition = gamePad.getY();
double xPosition = gamePad.getX();
frontRightMotor.set(yPosition+xPosition);
backRightMotor.set(yPosition+xPosition);
frontLeftMotor.set((yPosition-xPosition));
backLeftMotor.set((yPosition-xPosition));
}
public static void shiftGears()
{
if(gamePad.getRawButton(7)){
shiftSolenoid1.set(shiftSolenoid1.get());
shiftSolenoid2.set(shiftSolenoid2.get());
//Toggles only once when the button is pressed
}
if(gamePad.getRawButton(8)){
shiftSolenoid1.set(false);
shiftSolenoid2.set(false);
//Once you let go of button, alreadyPressed resets to false
}
}
}
/*public static void opticSensorTset() {
if(ballOpticSensor.get()) {
System.out.println("No ball");
}
else {
System.out.println("Ball");
} */