WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
wpi::cmd::RepeatCommand Class Reference

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

#include <wpi/commands2/RepeatCommand.hpp>

Inheritance diagram for wpi::cmd::RepeatCommand:
wpi::cmd::CommandHelper< Command, RepeatCommand >

Public Member Functions

 RepeatCommand (std::unique_ptr< Command > &&command)
 Creates a new RepeatCommand.
template<std::derived_from< Command > T>
 RepeatCommand (T &&command)
 Creates a new RepeatCommand.
 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::util::SendableBuilder &builder) override
Public Member Functions inherited from wpi::cmd::CommandHelper< Command, RepeatCommand >
 CommandHelper ()=default
CommandPtr ToPtr () &&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]

wpi::cmd::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>
wpi::cmd::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]

wpi::cmd::RepeatCommand::RepeatCommand ( RepeatCommand && other)
default

◆ RepeatCommand() [4/5]

wpi::cmd::RepeatCommand::RepeatCommand ( const RepeatCommand & other)
delete

◆ RepeatCommand() [5/5]

wpi::cmd::RepeatCommand::RepeatCommand ( RepeatCommand & )
delete

Member Function Documentation

◆ End()

void wpi::cmd::RepeatCommand::End ( bool interrupted)
override

◆ Execute()

void wpi::cmd::RepeatCommand::Execute ( )
override

◆ GetInterruptionBehavior()

Command::InterruptionBehavior wpi::cmd::RepeatCommand::GetInterruptionBehavior ( ) const
override

◆ Initialize()

void wpi::cmd::RepeatCommand::Initialize ( )
override

◆ InitSendable()

void wpi::cmd::RepeatCommand::InitSendable ( wpi::util::SendableBuilder & builder)
override

◆ IsFinished()

bool wpi::cmd::RepeatCommand::IsFinished ( )
override

◆ RunsWhenDisabled()

bool wpi::cmd::RepeatCommand::RunsWhenDisabled ( ) const
override

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