WPILibC++ 2024.3.2
frc2::ParallelRaceGroup Class Reference

A composition that runs a set of commands in parallel, ending when any one of the commands ends and interrupting all the others. More...

#include <frc2/command/ParallelRaceGroup.h>

Inheritance diagram for frc2::ParallelRaceGroup:
frc2::CommandHelper< Command, ParallelRaceGroup >

Public Member Functions

 ParallelRaceGroup (std::vector< std::unique_ptr< Command > > &&commands)
 Creates a new ParallelCommandRace. More...
 
template<wpi::DecayedDerivedFrom< Command >... Commands>
 ParallelRaceGroup (Commands &&... commands)
 
 ParallelRaceGroup (ParallelRaceGroup &&other)=default
 
 ParallelRaceGroup (const ParallelRaceGroup &)=delete
 
 ParallelRaceGroup (ParallelRaceGroup &)=delete
 
template<wpi::DecayedDerivedFrom< Command >... Commands>
void AddCommands (Commands &&... commands)
 Adds the given commands to the group. More...
 
void Initialize () final
 
void Execute () final
 
void End (bool interrupted) final
 
bool IsFinished () final
 
bool RunsWhenDisabled () const override
 
Command::InterruptionBehavior GetInterruptionBehavior () const override
 
- Public Member Functions inherited from frc2::CommandHelper< Command, ParallelRaceGroup >
 CommandHelper ()=default
 
CommandPtr ToPtr () &&override
 

Additional Inherited Members

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

Detailed Description

A composition that runs a set of commands in parallel, ending when any one of the commands ends and interrupting all the others.

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

◆ ParallelRaceGroup() [1/5]

frc2::ParallelRaceGroup::ParallelRaceGroup ( std::vector< std::unique_ptr< Command > > &&  commands)
explicit

Creates a new ParallelCommandRace.

The given commands will be executed simultaneously, and will "race to the finish" - the first command to finish ends the entire command, with all other commands being interrupted.

Parameters
commandsthe commands to include in this composition.

◆ ParallelRaceGroup() [2/5]

template<wpi::DecayedDerivedFrom< Command >... Commands>
frc2::ParallelRaceGroup::ParallelRaceGroup ( Commands &&...  commands)
inlineexplicit

◆ ParallelRaceGroup() [3/5]

frc2::ParallelRaceGroup::ParallelRaceGroup ( ParallelRaceGroup &&  other)
default

◆ ParallelRaceGroup() [4/5]

frc2::ParallelRaceGroup::ParallelRaceGroup ( const ParallelRaceGroup )
delete

◆ ParallelRaceGroup() [5/5]

frc2::ParallelRaceGroup::ParallelRaceGroup ( ParallelRaceGroup )
delete

Member Function Documentation

◆ AddCommands()

template<wpi::DecayedDerivedFrom< Command >... Commands>
void frc2::ParallelRaceGroup::AddCommands ( Commands &&...  commands)
inline

Adds the given commands to the group.

Parameters
commandsCommands to add to the group.

◆ End()

void frc2::ParallelRaceGroup::End ( bool  interrupted)
final

◆ Execute()

void frc2::ParallelRaceGroup::Execute ( )
final

◆ GetInterruptionBehavior()

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

◆ Initialize()

void frc2::ParallelRaceGroup::Initialize ( )
final

◆ IsFinished()

bool frc2::ParallelRaceGroup::IsFinished ( )
final

◆ RunsWhenDisabled()

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

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