|
| 1 | +package org.firstinspires.ftc.teamcode.opmode.components; |
| 2 | + |
| 3 | +import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; |
| 4 | +import com.qualcomm.robotcore.eventloop.opmode.TeleOp; |
| 5 | +import com.qualcomm.robotcore.hardware.CRServo; |
| 6 | +import com.qualcomm.robotcore.hardware.DcMotor; |
| 7 | +import com.qualcomm.robotcore.hardware.DcMotorSimple; |
| 8 | +import com.qualcomm.robotcore.hardware.Servo; |
| 9 | +import com.qualcomm.robotcore.hardware.ServoController; |
| 10 | + |
| 11 | +import org.firstinspires.ftc.robotcore.internal.camera.delegating.DelegatingCaptureSequence; |
| 12 | + |
| 13 | + |
| 14 | +@TeleOp |
| 15 | + |
| 16 | +public class TrumanLearnsTeleOP extends LinearOpMode { |
| 17 | + private DcMotor topLeftMotor; |
| 18 | + private DcMotor topRightMotor; |
| 19 | + private DcMotor bottomLeftMotor; |
| 20 | + private DcMotor bottomRightMotor; |
| 21 | + private CRServo tail; |
| 22 | + @Override |
| 23 | + public void runOpMode() throws InterruptedException { |
| 24 | + float ly; |
| 25 | + float lx; |
| 26 | + float rx; |
| 27 | + topLeftMotor = hardwareMap.get(DcMotor.class,"FL"); |
| 28 | + topRightMotor = hardwareMap.get(DcMotor.class,"FR"); |
| 29 | + bottomLeftMotor = hardwareMap.get(DcMotor.class,"BL"); |
| 30 | + bottomRightMotor = hardwareMap.get(DcMotor.class,"BR"); |
| 31 | + topLeftMotor.setDirection(DcMotorSimple.Direction.REVERSE); |
| 32 | + bottomLeftMotor.setDirection(DcMotorSimple.Direction.REVERSE); |
| 33 | + //tail = hardwareMap.get(CRServo.class,"servo"); ONLY FOR DOG |
| 34 | + int tailAngle = 1; |
| 35 | + double motorSpeed = 0.3; |
| 36 | + waitForStart(); |
| 37 | + while (opModeIsActive()){ |
| 38 | + lx=gamepad1.left_stick_x; |
| 39 | + ly=gamepad1.left_stick_y; |
| 40 | + rx=gamepad1.right_stick_x; |
| 41 | + topLeftMotor.setPower((ly-lx-rx)*motorSpeed); |
| 42 | + // topRightMotor.setPower((ly-lx-rx)*motorSpeed); |
| 43 | + // bottomLeftMotor.setPower((ly-lx+rx)*motorSpeed); |
| 44 | + // bottomRightMotor.setPower((-rx+lx+ly)*motorSpeed); |
| 45 | + /* |
| 46 | + if (gamepad1.a) { |
| 47 | + tail.setDirection(DcMotorSimple.Direction.FORWARD); |
| 48 | + } |
| 49 | + else { |
| 50 | + tail.setDirection(DcMotorSimple.Direction.REVERSE); |
| 51 | + } |
| 52 | +
|
| 53 | + */ |
| 54 | +// System.out.println(); |
| 55 | + } |
| 56 | + } |
| 57 | +} |
| 58 | + |
0 commit comments