forked from FIRST-Tech-Challenge/FtcRobotController
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainTeleOp2Driver.java
More file actions
79 lines (65 loc) · 2.38 KB
/
MainTeleOp2Driver.java
File metadata and controls
79 lines (65 loc) · 2.38 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
package org.firstinspires.ftc.teamcode;
import android.text.style.DynamicDrawableSpan;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorImplEx;
import com.qualcomm.robotcore.hardware.CRServoImplEx;
import com.qualcomm.robotcore.hardware.HardwareMap;
import com.qualcomm.robotcore.hardware.DcMotorSimple;
import org.firstinspires.ftc.teamcode.subsystems.Drivetrain;
import org.firstinspires.ftc.teamcode.subsystems.Intake;
import org.firstinspires.ftc.teamcode.subsystems.LEDs;
/**
* A simple tele-op program I threw together so we could test our intake prototype
* The robot consists of a simple (very janky) chassis that looks kind of like a modified strafer chassis
* Hardware configuration
*/
@TeleOp(name="Tele-Op 2 drivers", group="test")
public class MainTeleOp2Driver extends OpMode {
private Drivetrain drivetrain;
private Intake intake;
private LEDs blinkin;
@Override
public void init() {
drivetrain = new Drivetrain(telemetry, hardwareMap);
intake = new Intake(telemetry, hardwareMap);
blinkin = new LEDs(telemetry, hardwareMap);
drivetrain.init();
intake.init();
blinkin.init();
}
@Override
public void loop() {
/**
* Put the joystick readings into variables so we can use short names instead of writing out
* gamepad1.left_stick_y four times
*/
double drive = gamepad1.left_stick_y;
double strafe = gamepad1.left_stick_x;
double steer = gamepad1.right_stick_x;
drivetrain.drive(drive, strafe, steer);
if (gamepad2.left_bumper) {
intake.setIntake(1);
blinkin.SetPattern(42);
} else if (gamepad2.right_bumper) {
intake.setIntake(-1);
blinkin.SetPattern(49);
} else {
intake.setIntake(0);
}
if (gamepad2.dpad_up) {
intake.raise();
} else if (gamepad2.dpad_down) {
intake.lower();
} else {
// nothing because periodic() will handle everything except no because we're not doing that rn
intake.freeze();
}
if (gamepad2.a) {
intake.stopSlide();
}
drivetrain.periodic();
intake.periodic();
}
}