Package edu.wpi.first.wpilibj2.command
Class CommandBase
java.lang.Object
edu.wpi.first.wpilibj2.command.CommandBase
- All Implemented Interfaces:
Command
- Direct Known Subclasses:
CommandGroupBase,ConditionalCommand,FunctionalCommand,InstantCommand,NotifierCommand,PerpetualCommand,PIDCommand,ProxyScheduleCommand,RunCommand,ScheduleCommand,SelectCommand,StartEndCommand,WaitCommand,WaitUntilCommand
public abstract class CommandBase extends java.lang.Object implements Command
A
Sendable base class for Commands.-
Method Summary
Modifier and Type Method Description voidaddRequirements(Subsystem... requirements)Adds the specified requirements to the command.java.util.Set<Subsystem>getRequirements()Specifies the set of subsystems used by this command.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface edu.wpi.first.wpilibj2.command.Command
alongWith, andThen, asProxy, beforeStarting, cancel, deadlineWith, end, execute, getName, hasRequirement, initialize, interruptOn, isFinished, isScheduled, perpetually, raceWith, runsWhenDisabled, schedule, schedule, whenFinished, withTimeout
-
Method Details
-
addRequirements
Adds the specified requirements to the command.- Parameters:
requirements- the requirements to add
-
getRequirements
Description copied from interface:CommandSpecifies the set of subsystems used by this command. Two commands cannot use the same subsystem at the same time. If the command is scheduled as interruptible and another command is scheduled that shares a requirement, the command will be interrupted. Else, the command will not be scheduled. If no subsystems are required, return an empty set.Note: it is recommended that user implementations contain the requirements as a field, and return that field here, rather than allocating a new set every time this is called.
- Specified by:
getRequirementsin interfaceCommand- Returns:
- the set of subsystems that are required
-