Added safeguards that you can ONLY move to BUCKET state if the arm is in PARK state. This prevents the driver from hitting the high/low bucket actions while in the SUBMARINE area.

This commit is contained in:
2024-11-12 09:39:50 -08:00
parent de70c14c6e
commit 4bcfdc6e15

View File

@ -106,24 +106,24 @@ public class CometBotTeleopCompetition {
*/ */
public void toHighBucketScore() { public void toHighBucketScore() {
if (this.currentGP2.triangle && !this.previousGP2.triangle) { if (this.currentGP2.triangle && !this.previousGP2.triangle) {
fieldStates.setFieldLocation(FieldStates.FieldLocation.BUCKET); if (this.arm.getState() == ArmActionsSubsystem.ArmState.PARK) {
Actions.runBlocking(new SequentialAction( fieldStates.setFieldLocation(FieldStates.FieldLocation.BUCKET);
this.wrist.toFloorPosition(), Actions.runBlocking(new SequentialAction(
this.arm.toParkPosition(), this.lift.toHighBucketPosition(),
this.lift.toHighBucketPosition(), new SleepAction(.5),
new SleepAction(.5), this.arm.toBucketPosition(),
this.arm.toBucketPosition(), new SleepAction(.5),
new SleepAction(.5), this.wrist.toBucketPosition(),
this.wrist.toBucketPosition(), new SleepAction(.5),
new SleepAction(.5), this.claw.openClaw(),
this.claw.openClaw(), new SleepAction(.5),
new SleepAction(.5), this.wrist.toFloorPosition(),
this.wrist.toFloorPosition(), new SleepAction(.5),
new SleepAction(.5), this.arm.toParkPosition(),
this.arm.toParkPosition(), this.lift.toFloorPosition()
this.lift.toFloorPosition() ));
)); fieldStates.setFieldLocation(FieldStates.FieldLocation.TRAVELING);
fieldStates.setFieldLocation(FieldStates.FieldLocation.TRAVELING); }
} }
} }
@ -139,24 +139,24 @@ public class CometBotTeleopCompetition {
*/ */
public void toLowBucketScore() { public void toLowBucketScore() {
if (this.currentGP2.circle && !this.previousGP2.circle) { if (this.currentGP2.circle && !this.previousGP2.circle) {
fieldStates.setFieldLocation(FieldStates.FieldLocation.BUCKET); if (this.arm.getState() == ArmActionsSubsystem.ArmState.PARK) {
Actions.runBlocking(new SequentialAction( fieldStates.setFieldLocation(FieldStates.FieldLocation.BUCKET);
this.wrist.toFloorPosition(), Actions.runBlocking(new SequentialAction(
this.arm.toParkPosition(), this.lift.toLowBucketPosition(),
this.lift.toLowBucketPosition(), new SleepAction(.5),
new SleepAction(.5), this.arm.toBucketPosition(),
this.arm.toBucketPosition(), new SleepAction(.5),
new SleepAction(.5), this.wrist.toBucketPosition(),
this.wrist.toBucketPosition(), new SleepAction(.5),
new SleepAction(.5), this.claw.openClaw(),
this.claw.openClaw(), new SleepAction(.5),
new SleepAction(.5), this.wrist.toFloorPosition(),
this.wrist.toFloorPosition(), new SleepAction(.5),
new SleepAction(.5), this.arm.toParkPosition(),
this.arm.toParkPosition(), this.lift.toFloorPosition()
this.lift.toFloorPosition() ));
)); fieldStates.setFieldLocation(FieldStates.FieldLocation.TRAVELING);
fieldStates.setFieldLocation(FieldStates.FieldLocation.TRAVELING); }
} }
} }
@ -183,7 +183,10 @@ public class CometBotTeleopCompetition {
*/ */
public void toArmParkPosition() { public void toArmParkPosition() {
if (this.currentGP2.square && !this.previousGP2.square) { if (this.currentGP2.square && !this.previousGP2.square) {
Actions.runBlocking(this.arm.toParkPosition()); Actions.runBlocking(new SequentialAction(
this.wrist.toFloorPosition(),
this.arm.toParkPosition()
));
} }
} }