forked from FIRST-Tech-Challenge/FtcRobotController
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTankTeleop.java
More file actions
77 lines (63 loc) · 2.55 KB
/
TankTeleop.java
File metadata and controls
77 lines (63 loc) · 2.55 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
//The source of my SDK knowledge: https://ftc-code.gitbook.io/tech-toolbox/getting-started/motors-and-encoders
//How to connect to on bot java: https://ftc-docs.firstinspires.org/en/latest/programming_resources/shared/program_and_manage_network/Connecting-a-Laptop-to-the-Program-%26-Manage-Network.html
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
@TeleOp(name = "TankTeleop")
public class TankTeleop extends LinearOpMode {
@Override
public void runOpMode() throws InterruptedException {
//Initialization Code Goes Here
//cool
DriveHardware tankDrive;
tankDrive = new DriveHardware();
tankDrive.tankDriveInit(hardwareMap);
double encoderTicksPerRevolution = 28/*125*0.72/180*/;
/*AuxHardware arm;
arm = new AuxHardware();
arm.simpleArmInit(hardwareMap, encoderTicksPerRevolution, 2, 130);
double armPosition = 0;
double armSpeed = 1;
boolean clawState = false;
boolean Lbumper = false;
double leftXMin = 0;*/
waitForStart();
while(opModeIsActive()){ //while loop for when program is active
//Code repeated during teleop goes here
//Analogous to loop() method in OpMode
//run a tank drive
tankDrive.tankDriveUpdate(gamepad1.right_stick_x, gamepad1.right_stick_y, gamepad1.right_bumper);
/*if (gamepad1.left_stick_y > 0) {
if (armPosition > 0) {
armPosition += -gamepad1.left_stick_y*armSpeed;
}
//arm.simpleArmMove(60);
} else if (gamepad1.left_stick_y < 0) {
if (armPosition <= 130) {
armPosition += -gamepad1.left_stick_y*armSpeed;
}
//arm.simpleArmMove(30);
}
telemetry.addData("degrees:", armPosition);
arm.simpleArmMove(armPosition, armSpeed);
if (gamepad1.left_bumper && !Lbumper) {
if (clawState) {
arm.clawClose();
clawState = false;
} else {
arm.clawOpen();
clawState = true;
}
Lbumper = true;
}
if (!gamepad1.left_bumper){
Lbumper = false;
}
if (gamepad1.b) {
arm.wrist = 40;
} else {
arm.wrist = 23;
}*/
}
}
}