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

A command that runs another command repeatedly, restarting it when it ends, until this command is interrupted. More...

#include <frc2/command/RepeatCommand.h>

Inheritance diagram for frc2::RepeatCommand:
frc2::CommandHelper< CommandBase, RepeatCommand >

Public Member Functions

 RepeatCommand (std::unique_ptr< Command > &&command)
 Creates a new RepeatCommand. More...
 
template<std::derived_from< Command > T>
 RepeatCommand (T &&command)
 Creates a new RepeatCommand. More...
 
 RepeatCommand (RepeatCommand &&other)=default
 
 RepeatCommand (const RepeatCommand &other)=delete
 
 RepeatCommand (RepeatCommand &)=delete
 
void Initialize () override
 
void Execute () override
 
bool IsFinished () override
 
void End (bool interrupted) override
 
bool RunsWhenDisabled () const override
 
Command::InterruptionBehavior GetInterruptionBehavior () const override
 
void InitSendable (wpi::SendableBuilder &builder) override
 
- Public Member Functions inherited from frc2::CommandHelper< CommandBase, RepeatCommand >
 CommandHelper ()=default
 
CommandPtr ToPtr () &&override
 

Additional Inherited Members

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

Detailed Description

A command that runs another command repeatedly, restarting it when it ends, until this command is interrupted.

Command instances that are passed to it cannot be added to any other groups, or scheduled individually.

The rules for command compositions apply: command instances that are passed to it are owned by the composition and cannot be added to any other composition or scheduled individually, and the composition requires all subsystems its components require.

This class is provided by the NewCommands VendorDep

Constructor & Destructor Documentation

◆ RepeatCommand() [1/5]

frc2::RepeatCommand::RepeatCommand ( std::unique_ptr< Command > &&  command)
explicit

Creates a new RepeatCommand.

Will run another command repeatedly, restarting it whenever it ends, until this command is interrupted.

Parameters
commandthe command to run repeatedly

◆ RepeatCommand() [2/5]

template<std::derived_from< Command > T>
frc2::RepeatCommand::RepeatCommand ( T &&  command)
inlineexplicit

Creates a new RepeatCommand.

Will run another command repeatedly, restarting it whenever it ends, until this command is interrupted.

Parameters
commandthe command to run repeatedly

◆ RepeatCommand() [3/5]

frc2::RepeatCommand::RepeatCommand ( RepeatCommand &&  other)
default

◆ RepeatCommand() [4/5]

frc2::RepeatCommand::RepeatCommand ( const RepeatCommand other)
delete

◆ RepeatCommand() [5/5]

frc2::RepeatCommand::RepeatCommand ( RepeatCommand )
delete

Member Function Documentation

◆ End()

void frc2::RepeatCommand::End ( bool  interrupted)
override

◆ Execute()

void frc2::RepeatCommand::Execute ( )
override

◆ GetInterruptionBehavior()

Command::InterruptionBehavior frc2::RepeatCommand::GetInterruptionBehavior ( ) const
override

◆ Initialize()

void frc2::RepeatCommand::Initialize ( )
override

◆ InitSendable()

void frc2::RepeatCommand::InitSendable ( wpi::SendableBuilder builder)
override

◆ IsFinished()

bool frc2::RepeatCommand::IsFinished ( )
override

◆ RunsWhenDisabled()

bool frc2::RepeatCommand::RunsWhenDisabled ( ) const
override

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