Class FSMSystem<S>

java.lang.Object
frc.robot.systems.FSMSystem<S>
Type Parameters:
S - the enum containing all FSM states
Direct Known Subclasses:
ClimberFSMSystem, Drivetrain, ExampleFSMSystem, IntakeFSMSystem, PlaceholderFSMSystem, ShooterFSMSystem

public abstract class FSMSystem<S> extends Object
A superclass that all FSM systems should inherit from.
  • Constructor Details

    • FSMSystem

      public FSMSystem()
  • Method Details

    • getCurrentState

      public S getCurrentState()
      Get the current FSM state.
      Returns:
      the current FSM state
    • setCurrentState

      public void setCurrentState(S newState)
      Set the current FSM state.
      Parameters:
      newState - the new state
    • watchForStatesCommand

      public FSMSystem<S>.frc.robot.systems.FSMSystem.ObservedStateCommand watchForStatesCommand(S... states)
      Get a command that waits for a sequence of states to be observed.
      Parameters:
      states - the sequence of states
      Returns:
      the command
    • reset

      public abstract void reset()
      Reset the current FSM state.
    • update

      public abstract void update(Input input)
      Update the FSM state periodically based on inputs.
      Parameters:
      input - the input object
    • nextState

      protected abstract S nextState(Input input)
      Get the next state for the FSM based on inputs.
      Parameters:
      input - the input object
      Returns:
      the next state