-
Notifications
You must be signed in to change notification settings - Fork 0
/
TwoWheelArcadeDrive.java
31 lines (27 loc) · 1.02 KB
/
TwoWheelArcadeDrive.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
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
/**
* Example OpMode. Controls robot using left joystick, with arcade drive.
*/
//@Disabled
@TeleOp(name = "two wheel arcade drive", group = "TwoWheel")
public class TwoWheelArcadeDrive extends LinearOpMode {
public void runOpMode(){
DcMotor left = hardwareMap.dcMotor.get("left_motor");
DcMotor right = hardwareMap.dcMotor.get("right_motor");
left.setDirection(DcMotor.Direction.REVERSE);
telemetry.addData("Press Start When Ready","");
telemetry.update();
waitForStart();
while (opModeIsActive()){
float fwd = -gamepad1.left_stick_y;
float steer = gamepad1.right_trigger - gamepad1.left_trigger;
left.setPower(fwd + steer);
right.setPower(fwd - steer);
}
left.setPower(0);
right.setPower(0);
}
}