Package frc.robot.systems
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
A superclass that all FSM systems should inherit from.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the current FSM state.protected abstract SGet the next state for the FSM based on inputs.abstract voidreset()Reset the current FSM state.voidsetCurrentState(S newState) Set the current FSM state.abstract voidUpdate the FSM state periodically based on inputs.watchForStatesCommand(S... states) Get a command that waits for a sequence of states to be observed.
-
Constructor Details
-
FSMSystem
public FSMSystem()
-
-
Method Details
-
getCurrentState
Get the current FSM state.- Returns:
- the current FSM state
-
setCurrentState
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
Update the FSM state periodically based on inputs.- Parameters:
input- the input object
-
nextState
Get the next state for the FSM based on inputs.- Parameters:
input- the input object- Returns:
- the next state
-