diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/DriverControl.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/DriverControl.java index 008c26623388..2a866731a015 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/DriverControl.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/DriverControl.java @@ -21,6 +21,24 @@ public void runOpModeImpl() { while(true) { // Gamepad 1 controls: + if (gamepad2.a) + while (gamepad2.a) { + intake.setPower(1); + } + else{ + intake.setPower(0); + } + + if (gamepad2.x) { + intake.setPower(1); + } + + if (gamepad2.y) { + intake.setPower(0); + } + + + // Left trigger - to move left sideways strafeRight(-gamepad1.right_trigger, 0); @@ -46,38 +64,6 @@ public void runOpModeImpl() { // left bumper - to close claw (front servo) - if(gamepad2.a){ - intake.setPower(1); - } - - if (gamepad2.dpad_up) { - - arm.setPosition(1); - sleep(100); - telemetry.addData("front servo open", "clawposition: 0.4" ); - } - - // right bumper - to open claw (front servo) - if (gamepad2.dpad_down) { - - arm.setPosition(0.0); - sleep(100); - telemetry.addData("front servo closed", "clawposition: 0.1" ); - } - - if (gamepad2.dpad_left) { - - clamp.setPosition(1); - sleep(100); - telemetry.addData("front servo closed", "clawposition: 0.1" ); - } - - if (gamepad2.dpad_right) { - - clamp.setPosition(0.0); - sleep(100); - telemetry.addData("front servo closed", "clawposition: 0.1" ); - } /* // Gamepad 2 Controls diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Forward.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Forward.java index 685f8c58687f..bce7f38b3d49 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Forward.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Forward.java @@ -15,7 +15,8 @@ public class Forward extends Movement { waitForStart(); runtime.reset(); - strafeRight(1, 20); + sleep(50); + goForward(1, 20); /*sense*/ goForward(1, 20); diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/IntakeClass.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/IntakeClass.java index 15b42e3bb35b..12a8998889cf 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/IntakeClass.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/IntakeClass.java @@ -12,17 +12,6 @@ abstract class IntakeClass extends LinearOpMode { protected DcMotor intake; - protected DcMotor shooter; - protected DcMotor hopper; - - - - protected Servo arm; - protected Servo clamp; - - boolean hoppertrue = true; - boolean shootertrue = true; - boolean intaketrue = true; public void runOpMode() { setupDriveMotors(); @@ -37,20 +26,13 @@ protected void setupDriveMotors() { updateTelemetryMessage("Initializing Motors"); intake = hardwareMap.get(DcMotor.class, "intake"); - shooter = hardwareMap.get(DcMotor.class, "shooter"); - hopper = hardwareMap.get(DcMotor.class, "hopper"); - - //Servos - arm = hardwareMap.get(Servo.class, "arm"); - clamp = hardwareMap.get(Servo.class, "clamp"); // Most robots need the motor on one side to be reve`rsed to drive goBackward // Reverse the motor that runs backwards when connected directly to the battery intake.setDirection(DcMotor.Direction.FORWARD); - shooter.setDirection(DcMotor.Direction.FORWARD); - hopper.setDirection(DcMotor.Direction.REVERSE); + /* */ @@ -100,35 +82,7 @@ public void intake(final double intakepower, final int duration){ sleep(duration); } - public void shooter(final double intakepower, final int duration){ - shooter.setPower(intakepower); - sleep(duration); - } - public void hopper(final double intakepower, final int duration){ - hopper.setPower(intakepower); - sleep(duration); - } - - public void armdown() { - arm.setPosition(1); - sleep(200); - } - - public void armup() { - arm.setPosition(0); - sleep(200); - } - - public void clampdown() { - clamp.setPosition(1); - sleep(200); - } - - public void clampup() { - clamp.setPosition(0); - sleep(200); - } /* public void armUp(final double armpower, final int duration) { diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Movement.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Movement.java index 2b0f11ab1fdb..72c0a9709e3c 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Movement.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Movement.java @@ -14,13 +14,8 @@ abstract class Movement extends LinearOpMode protected DcMotor rightFront; protected DcMotor leftBack; protected DcMotor rightBack; - protected DcMotor shooter; - protected DcMotor hopper; protected DcMotor intake; - protected Servo arm; - protected Servo clamp; - public void runOpMode() { setupDriveMotors(); runOpModeImpl(); @@ -37,8 +32,6 @@ protected void setupDriveMotors() { rightFront = hardwareMap.get(DcMotor.class, "rightFront"); rightBack = hardwareMap.get(DcMotor.class, "rightBack"); leftBack = hardwareMap.get(DcMotor.class, "leftBack"); - shooter = hardwareMap.get(DcMotor.class, "shooter"); - hopper = hardwareMap.get(DcMotor.class, "hopper"); intake = hardwareMap.get(DcMotor.class, "intake"); // Most robots need the motor on one side to be reve`rsed to drive goBackward @@ -47,12 +40,9 @@ protected void setupDriveMotors() { rightFront.setDirection(DcMotor.Direction.REVERSE); leftBack.setDirection(DcMotor.Direction.FORWARD); rightBack.setDirection(DcMotor.Direction.REVERSE); - shooter.setDirection(DcMotor.Direction.FORWARD); - hopper.setDirection(DcMotor.Direction.FORWARD); intake.setDirection(DcMotor.Direction.FORWARD); - arm = hardwareMap.servo.get("arm"); - clamp = hardwareMap.servo.get("clamp"); + /* */ updateTelemetryMessage("Initialized Motors"); @@ -103,7 +93,6 @@ public void goForward(final double power, final int duration) { public void strafeRight(final double power, final int duration) { //TODO - clarify how these motor powers are distributed for strafeRight movement leftFront.setPower(-power); - rightFront.setPower(power); rightBack.setPower(-power); leftBack.setPower(power); sleep(duration); @@ -149,35 +138,12 @@ protected void turnLeft(final double leftwheelsbackwardpower, final double right updateTelemetryMessage("Turning Left"); } - public void shooter(final double shooterpower, final int duration) { - shooter.setPower(shooterpower); - sleep(duration); - } public void intake(final double intakepower, final int duration){ intake.setPower(intakepower); sleep(duration); } - public void armdown() { - arm.setPosition(1); - sleep(200); - } - - public void armup() { - arm.setPosition(0); - sleep(200); - } - - public void clampdown() { - clamp.setPosition(1); - sleep(200); - } - - public void clampup() { - clamp.setPosition(0); - sleep(200); - } /* public void armUp(final double armpower, final int duration) { arm.setPower(armpower); diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/testing.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/testing.java index 937a2370ed73..c494ae4fd2d1 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/testing.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/testing.java @@ -19,38 +19,18 @@ public void runOpModeImpl() { while(opModeIsActive()) { while(true) { - // left bumper - to close claw (front servo) - - - if(gamepad1.a){ - intaketrue = !intaketrue; - } - if(intaketrue){ + if (gamepad1.a) { intake.setPower(1); } - else if(!intaketrue){ + + if (gamepad1.b) { intake.setPower(0); } - if(gamepad1.b){ - shootertrue = !shootertrue; - } - if(shootertrue){ - shooter.setPower(1); - } - if(!shootertrue){ - shooter.setPower(0); - } + // left bumper - to close claw (front servo) + + - if(gamepad1.x){ - hoppertrue = !hoppertrue; - } - if(hoppertrue){ - hopper.setPower(1); - } - else if(!hoppertrue){ - hopper.setPower(0); - } telemetry.addData("Status", "Run Time: " + runtime.toString()); telemetry.update();