- All Known Implementing Classes:
public interface Subsystem
Commands. Subsystems are used by the
CommandScheduler's resource management system to ensure multiple robot actions are not "fighting" over the same hardware; Commands that use a subsystem should include that subsystem in their
Command.getRequirements()method, and resources used within a subsystem should generally remain encapsulated and not be shared by other parts of the robot.
Subsystems must be registered with the scheduler with the
CommandScheduler.registerSubsystem(Subsystem...) method in order for the
periodic() method to be called. It is recommended that this method be called from the
constructor of users' Subsystem implementations. The
SubsystemBase class offers a simple
base for user implementations that handles this.
This class is provided by the NewCommands VendorDep
Modifier and Type Method Description
getCurrentCommand()Returns the command currently running on this subsystem.
getDefaultCommand()Gets the default command for this subsystem.
periodic()This method is called periodically by the
setDefaultCommand(Command defaultCommand)Sets the default
Commandof the subsystem.
simulationPeriodic()This method is called periodically by the
default void periodic()This method is called periodically by the
CommandScheduler. Useful for updating subsystem-specific state that you don't want to offload to a
Command. Teams should try to be consistent within their own codebases about which responsibilities will be handled by Commands, and which will be handled here.
default void simulationPeriodic()
Sets the default
Commandof the subsystem. The default command will be automatically scheduled when no other commands are scheduled that require the subsystem. Default commands should generally not end on their own, i.e. their
Command.isFinished()method should always return false. Will automatically register this subsystem with the
defaultCommand- the default command to associate with this subsystem
Gets the default command for this subsystem. Returns null if no default command is currently associated with the subsystem.
- the default command associated with this subsystem
Returns the command currently running on this subsystem. Returns null if no command is currently scheduled that requires this subsystem.
- the scheduled command currently requiring this subsystem
default void register()