From 94144780b8e1cb194fcb6b260872b9e85963dece Mon Sep 17 00:00:00 2001 From: Carlos Date: Wed, 13 Nov 2024 09:13:24 -0800 Subject: [PATCH] Tentative fix for robot/runBlocking problem as per issue #2 --- .../cometbots/CometBotAutoDevelopment.java | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/cometbots/CometBotAutoDevelopment.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/cometbots/CometBotAutoDevelopment.java index ddfaabe..9ffee06 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/cometbots/CometBotAutoDevelopment.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/cometbots/CometBotAutoDevelopment.java @@ -38,7 +38,6 @@ public class CometBotAutoDevelopment { private Follower follower; private HardwareMap hardwareMap; - private double currentPower = MAX_POWER; public CometBotAutoDevelopment(HardwareMap hardwareMap, Telemetry telemetry, Gamepad gp1, Gamepad gp2) { this.motors = new MotorsSubsystem(hardwareMap, telemetry); @@ -98,25 +97,35 @@ public class CometBotAutoDevelopment { this.previousGP2.copy(currentGP2); this.currentGP2.copy(this.GP2); - this.toFixMotorBlockingIssuer(); + this.toFixMotorBlockingIssueFirstMethod(); + this.toFixMotorBlockingIssueSecondMethod(); follower.setTeleOpMovementVectors(-this.GP1.left_stick_y, -this.GP1.left_stick_x, -this.GP1.right_stick_x, false); follower.update(); this.telemetry.addData("Field State", this.fieldStates.getFieldLocation()); - this.telemetry.addData("Current Power", currentPower); } - public void toFixMotorBlockingIssuer() { + public void toFixMotorBlockingIssueFirstMethod() { if (this.currentGP1.cross && !this.previousGP1.cross) { fieldStates.setFieldLocation(FieldStates.FieldLocation.BUCKET); Actions.runBlocking(new SequentialAction( - new SleepAction(2.5), this.zeroOutPower(), - new SleepAction(2.5), - this.returnToMaxPower(), - new SleepAction(2.5) + new SleepAction(3), + this.returnToMaxPower() )); fieldStates.setFieldLocation(FieldStates.FieldLocation.TRAVELING); } } + + public void toFixMotorBlockingIssueSecondMethod() { + if (this.currentGP1.circle && !this.previousGP1.circle) { + this.follower.breakFollowing(); + fieldStates.setFieldLocation(FieldStates.FieldLocation.BUCKET); + Actions.runBlocking(new SequentialAction( + new SleepAction(3) + )); + fieldStates.setFieldLocation(FieldStates.FieldLocation.TRAVELING); + this.follower.startTeleopDrive(); + } + } }