Tentative fix for robot/runBlocking problem as per issue #2

This commit is contained in:
2024-11-13 09:13:24 -08:00
parent a362d2e004
commit 94144780b8

View File

@ -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();
}
}
}