From e7f6f92cafe2b00731c39bc805f0d427a672a490 Mon Sep 17 00:00:00 2001 From: Marcus Flusche Date: Mon, 20 Jan 2025 12:34:33 -0500 Subject: [PATCH] Started transitions between states --- .../frc/robot/statemachine/StateMachine.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/main/java/frc/robot/statemachine/StateMachine.java b/src/main/java/frc/robot/statemachine/StateMachine.java index fe7a5f5..c95f35f 100644 --- a/src/main/java/frc/robot/statemachine/StateMachine.java +++ b/src/main/java/frc/robot/statemachine/StateMachine.java @@ -65,9 +65,6 @@ public StateMachine(CommandXboxController driverController, CommandXboxControlle .withChild(goToIntake) .withChild(intakeGamePiece); - // Example, will be button board later - manual.withTransition(scoreGamePiece, () -> false, "Example"); - // Children inside children goToScoringPosition.withChild(goToScoreCoral) .withChild(goToScoreAlgae); @@ -88,6 +85,27 @@ public StateMachine(CommandXboxController driverController, CommandXboxControlle scoreAlgae.withChild(scoreAlgaeNet) .withChild(scoreAlgaeProcessor); + // Example, will be button board later + manual.withTransition(goToScoringPosition, () -> false, "Driver presses score") + .withTransition(goToIntake, () -> false, "Driver presses intake"); + + goToScoringPosition.withTransition(scoreGamePiece, () -> false, "Close to scoring location") + .withTransition(manual, () -> false, "Score button released"); + + scoreGamePiece.withTransition(goToScoringPosition, () -> false, "Scoring location changed") + .withTransition(manual, () -> false, "Score button released") + .withTransition(manual, () -> false, "No game piece in robot"); + + goToIntake.withTransition(intakeGamePiece, () -> false, "Close to intake location") + .withTransition(manual, () -> false, "Intake button released"); + + intakeGamePiece.withTransition(goToIntake, () -> false, "Intake location changed") + .withTransition(manual, () -> false, "Intake button released"); + + intakeCoral.withTransition(manual, () -> false, "Has coral"); + + intakeAlgae.withTransition(manual, () -> false, "Has algae"); + // Auto auto.withModeTransitions(disabled, teleop, auto, test);