forked from FIRST-Tech-Challenge/FtcRobotController
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrimaryOpMode.java
More file actions
53 lines (43 loc) · 1.79 KB
/
PrimaryOpMode.java
File metadata and controls
53 lines (43 loc) · 1.79 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
package org.firstinspires.ftc.teamcode;
import com.arcrobotics.ftclib.drivebase.MecanumDrive;
import com.arcrobotics.ftclib.gamepad.GamepadEx;
import com.arcrobotics.ftclib.gamepad.GamepadKeys;
import com.arcrobotics.ftclib.hardware.motors.Motor;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.HardwareMap;
import org.firstinspires.ftc.teamcode.commands.RunIntake;
import org.firstinspires.ftc.teamcode.commands.RunShooter;
import org.firstinspires.ftc.teamcode.subsystems.Intake;
import org.firstinspires.ftc.teamcode.subsystems.Shooter;
@TeleOp(name = "PrimaryOpMode", group= "NormalOpModes")
public class PrimaryOpMode extends OpMode {
private Motor fL, fR, bL, bR;
private MecanumDrive drive;
private Shooter shooter;
private Intake intake;
private GamepadEx driverOp;
private GamepadEx coOp;
@Override
public void init() {
fL = new Motor(hardwareMap, "frontLeftDrive");
fR = new Motor(hardwareMap, "frontRightDrive");
bL = new Motor(hardwareMap, "backLeftDrive");
bR = new Motor(hardwareMap, "backRightDrive");
drive = new MecanumDrive(fL, fR, bL, bR);
driverOp = new GamepadEx(gamepad1);
coOp = new GamepadEx(gamepad2);
shooter = new Shooter(hardwareMap, "shooterMotor");
intake = new Intake(hardwareMap, "intakeMotor");
coOp.getGamepadButton(GamepadKeys.Button.A).whileHeld(new RunShooter(shooter, 1));
coOp.getGamepadButton(GamepadKeys.Button.B).whileHeld(new RunIntake(intake, 0.5));
}
@Override
public void loop() {
drive.driveRobotCentric(
driverOp.getLeftX(),
driverOp.getLeftY(),
driverOp.getRightX()
);
}
}