WPILibC++ 2023.4.3-108-ge5452e3
frc2::RunCommand Class Reference

A command that runs a Runnable continuously. More...

#include <frc2/command/RunCommand.h>

Inheritance diagram for frc2::RunCommand:
frc2::CommandHelper< FunctionalCommand, RunCommand >

Public Member Functions

 RunCommand (std::function< void()> toRun, std::initializer_list< Subsystem * > requirements)
 Creates a new RunCommand. More...
 
 RunCommand (std::function< void()> toRun, std::span< Subsystem *const > requirements={})
 Creates a new RunCommand. More...
 
 RunCommand (RunCommand &&other)=default
 
 RunCommand (const RunCommand &other)=default
 
- Public Member Functions inherited from frc2::CommandHelper< FunctionalCommand, RunCommand >
 CommandHelper ()=default
 
CommandPtr ToPtr () &&override
 

Additional Inherited Members

- Protected Member Functions inherited from frc2::CommandHelper< FunctionalCommand, RunCommand >
std::unique_ptr< CommandTransferOwnership () &&override
 

Detailed Description

A command that runs a Runnable continuously.

Has no end condition as-is; either subclass it or use Command.WithTimeout() or Command.Until() to give it one. If you only wish to execute a Runnable once, use InstantCommand.

This class is provided by the NewCommands VendorDep

Constructor & Destructor Documentation

◆ RunCommand() [1/4]

frc2::RunCommand::RunCommand ( std::function< void()>  toRun,
std::initializer_list< Subsystem * >  requirements 
)

Creates a new RunCommand.

The Runnable will be run continuously until the command ends. Does not run when disabled.

Parameters
toRunthe Runnable to run
requirementsthe subsystems to require

◆ RunCommand() [2/4]

frc2::RunCommand::RunCommand ( std::function< void()>  toRun,
std::span< Subsystem *const >  requirements = {} 
)
explicit

Creates a new RunCommand.

The Runnable will be run continuously until the command ends. Does not run when disabled.

Parameters
toRunthe Runnable to run
requirementsthe subsystems to require

◆ RunCommand() [3/4]

frc2::RunCommand::RunCommand ( RunCommand &&  other)
default

◆ RunCommand() [4/4]

frc2::RunCommand::RunCommand ( const RunCommand other)
default

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