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,10 +106,9 @@ public class CometBotTeleopCompetition {
*/ */
public void toHighBucketScore() { public void toHighBucketScore() {
if (this.currentGP2.triangle && !this.previousGP2.triangle) { if (this.currentGP2.triangle && !this.previousGP2.triangle) {
if (this.arm.getState() == ArmActionsSubsystem.ArmState.PARK) {
fieldStates.setFieldLocation(FieldStates.FieldLocation.BUCKET); fieldStates.setFieldLocation(FieldStates.FieldLocation.BUCKET);
Actions.runBlocking(new SequentialAction( Actions.runBlocking(new SequentialAction(
this.wrist.toFloorPosition(),
this.arm.toParkPosition(),
this.lift.toHighBucketPosition(), this.lift.toHighBucketPosition(),
new SleepAction(.5), new SleepAction(.5),
this.arm.toBucketPosition(), this.arm.toBucketPosition(),
@ -126,6 +125,7 @@ public class CometBotTeleopCompetition {
fieldStates.setFieldLocation(FieldStates.FieldLocation.TRAVELING); fieldStates.setFieldLocation(FieldStates.FieldLocation.TRAVELING);
} }
} }
}
/* /*
Type: PS4 / Logitech Type: PS4 / Logitech
@ -139,10 +139,9 @@ public class CometBotTeleopCompetition {
*/ */
public void toLowBucketScore() { public void toLowBucketScore() {
if (this.currentGP2.circle && !this.previousGP2.circle) { if (this.currentGP2.circle && !this.previousGP2.circle) {
if (this.arm.getState() == ArmActionsSubsystem.ArmState.PARK) {
fieldStates.setFieldLocation(FieldStates.FieldLocation.BUCKET); fieldStates.setFieldLocation(FieldStates.FieldLocation.BUCKET);
Actions.runBlocking(new SequentialAction( Actions.runBlocking(new SequentialAction(
this.wrist.toFloorPosition(),
this.arm.toParkPosition(),
this.lift.toLowBucketPosition(), this.lift.toLowBucketPosition(),
new SleepAction(.5), new SleepAction(.5),
this.arm.toBucketPosition(), this.arm.toBucketPosition(),
@ -159,6 +158,7 @@ public class CometBotTeleopCompetition {
fieldStates.setFieldLocation(FieldStates.FieldLocation.TRAVELING); fieldStates.setFieldLocation(FieldStates.FieldLocation.TRAVELING);
} }
} }
}
/* /*
Type: PS4 / Logitech Type: PS4 / Logitech
@ -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()
));
} }
} }