RobotCore
Robot Core Documentation
Public Member Functions | Protected Attributes | List of all members
edu.wpi.first.wpilibj2.command.CommandBase Class Referenceabstract
Inheritance diagram for edu.wpi.first.wpilibj2.command.CommandBase:
edu.wpi.first.wpilibj2.command.Command edu.wpi.first.wpilibj2.command.CommandGroupBase edu.wpi.first.wpilibj2.command.ConditionalCommand edu.wpi.first.wpilibj2.command.FunctionalCommand edu.wpi.first.wpilibj2.command.InstantCommand edu.wpi.first.wpilibj2.command.PerpetualCommand edu.wpi.first.wpilibj2.command.ProxyScheduleCommand edu.wpi.first.wpilibj2.command.RunCommand edu.wpi.first.wpilibj2.command.ScheduleCommand edu.wpi.first.wpilibj2.command.SelectCommand edu.wpi.first.wpilibj2.command.StartEndCommand edu.wpi.first.wpilibj2.command.WaitCommand edu.wpi.first.wpilibj2.command.WaitUntilCommand

Public Member Functions

final void addRequirements (Subsystem... requirements)
 
Set< SubsystemgetRequirements ()
 
- Public Member Functions inherited from edu.wpi.first.wpilibj2.command.Command
default void initialize ()
 
default void execute ()
 
default void end (boolean interrupted)
 
default boolean isFinished ()
 
default ParallelRaceGroup withTimeout (double seconds)
 
default ParallelRaceGroup withInterrupt (BooleanSupplier condition)
 
default SequentialCommandGroup beforeStarting (Runnable toRun, Subsystem... requirements)
 
default SequentialCommandGroup andThen (Runnable toRun, Subsystem... requirements)
 
default SequentialCommandGroup andThen (Command... next)
 
default ParallelDeadlineGroup deadlineWith (Command... parallel)
 
default ParallelCommandGroup alongWith (Command... parallel)
 
default ParallelRaceGroup raceWith (Command... parallel)
 
default PerpetualCommand perpetually ()
 
default ProxyScheduleCommand asProxy ()
 
default void schedule (boolean interruptible)
 
default void schedule ()
 
default void cancel ()
 
default boolean isScheduled ()
 
default boolean hasRequirement (Subsystem requirement)
 
default boolean runsWhenDisabled ()
 
default String getName ()
 

Protected Attributes

Set< Subsystemm_requirements = new HashSet<>()
 

Detailed Description

A Sendable base class for Commands.

Member Function Documentation

◆ addRequirements()

final void edu.wpi.first.wpilibj2.command.CommandBase.addRequirements ( Subsystem...  requirements)

Adds the specified requirements to the command.

Parameters
requirementsthe requirements to add

◆ getRequirements()

Set<Subsystem> edu.wpi.first.wpilibj2.command.CommandBase.getRequirements ( )

Specifies 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.

Returns
the set of subsystems that are required

Implements edu.wpi.first.wpilibj2.command.Command.


The documentation for this class was generated from the following file: