RobotCore
Robot Core Documentation
Public Member Functions | List of all members
edu.wpi.first.wpilibj2.command.InstantCommand Class Reference
Inheritance diagram for edu.wpi.first.wpilibj2.command.InstantCommand:
edu.wpi.first.wpilibj2.command.CommandBase edu.wpi.first.wpilibj2.command.Command edu.wpi.first.wpilibj2.command.PrintCommand

Public Member Functions

 InstantCommand (Runnable toRun, Subsystem... requirements)
 
 InstantCommand ()
 
void initialize ()
 
final boolean isFinished ()
 
- Public Member Functions inherited from edu.wpi.first.wpilibj2.command.CommandBase
final void addRequirements (Subsystem... requirements)
 
Set< SubsystemgetRequirements ()
 
- Public Member Functions inherited from edu.wpi.first.wpilibj2.command.Command
default void execute ()
 
default void end (boolean interrupted)
 
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 ()
 

Additional Inherited Members

- Protected Attributes inherited from edu.wpi.first.wpilibj2.command.CommandBase
Set< Subsystemm_requirements = new HashSet<>()
 

Detailed Description

A Command that runs instantly; it will initialize, execute once, and end on the same iteration of the scheduler. Users can either pass in a Runnable and a set of requirements, or else subclass this command if desired.

Constructor & Destructor Documentation

◆ InstantCommand() [1/2]

edu.wpi.first.wpilibj2.command.InstantCommand.InstantCommand ( Runnable  toRun,
Subsystem...  requirements 
)

Creates a new InstantCommand that runs the given Runnable with the given requirements.

Parameters
toRunthe Runnable to run
requirementsthe subsystems required by this command

◆ InstantCommand() [2/2]

edu.wpi.first.wpilibj2.command.InstantCommand.InstantCommand ( )

Creates a new InstantCommand with a Runnable that does nothing. Useful only as a no-arg constructor to call implicitly from subclass constructors.

Member Function Documentation

◆ initialize()

void edu.wpi.first.wpilibj2.command.InstantCommand.initialize ( )

The initial subroutine of a command. Called once when the command is initially scheduled.

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

◆ isFinished()

final boolean edu.wpi.first.wpilibj2.command.InstantCommand.isFinished ( )

Whether the command has finished. Once a command finishes, the scheduler will call its end() method and un-schedule it.

Returns
whether the command has finished.

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


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