WPILibC++ 2024.1.1-beta-4
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, Requirements 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/3]

frc2::RunCommand::RunCommand ( std::function< void()>  toRun,
Requirements  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() [2/3]

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

◆ RunCommand() [3/3]

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

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