2022-Robot
Robot code for 2022 FRC Season by Argos, FRC team #1756
Loading...
Searching...
No Matches
AutoSelector Class Reference

Allow user to select from auto routines using the default dashboard autonomous selector. More...

#include <auto_selector.h>

Public Member Functions

 AutoSelector ()
 Initialize with no available auto routines. More may be added later. More...
 
 AutoSelector (std::initializer_list< AutonomousCommand * > commands, AutonomousCommand *defaultCommand=nullptr)
 Initialize with specified commands. More may be added later. More...
 
void AddCommand (std::initializer_list< AutonomousCommand * > commands)
 Add a set of commands to the selector. More...
 
void AddCommand (AutonomousCommand *command)
 Add a single command to the selector. More...
 
void SetDefaultCommand (AutonomousCommand *defaultCommand)
 Set the default command to run if user selection is invalid. More...
 
frc2::Command * GetSelectedCommand () const
 Get the command selected by the user on the dashboard. Will return default command if no match is found. More...
 

Private Member Functions

void UpdateSelectorEntries () const
 Update dashboard with latest command list. More...
 

Private Attributes

std::vector< AutonomousCommand * > m_commands
 All autonomous commands that can be selected. More...
 
AutonomousCommandm_default
 Command to run if dashboard selection is invalid. More...
 

Detailed Description

Allow user to select from auto routines using the default dashboard autonomous selector.

Constructor & Destructor Documentation

◆ AutoSelector() [1/2]

AutoSelector::AutoSelector ( )

Initialize with no available auto routines. More may be added later.

◆ AutoSelector() [2/2]

AutoSelector::AutoSelector ( std::initializer_list< AutonomousCommand * >  commands,
AutonomousCommand defaultCommand = nullptr 
)

Initialize with specified commands. More may be added later.

Parameters
commandsList of commands to allow user to select from
defaultCommandCommand to run if selection is invalid. nullptr indicates run no command.

Member Function Documentation

◆ AddCommand() [1/2]

void AutoSelector::AddCommand ( AutonomousCommand command)

Add a single command to the selector.

Parameters
commandCommand to add

◆ AddCommand() [2/2]

void AutoSelector::AddCommand ( std::initializer_list< AutonomousCommand * >  commands)

Add a set of commands to the selector.

Parameters
commandsCommands to add

◆ GetSelectedCommand()

frc2::Command * AutoSelector::GetSelectedCommand ( ) const

Get the command selected by the user on the dashboard. Will return default command if no match is found.

Returns
frc2::Command* Selected command

◆ SetDefaultCommand()

void AutoSelector::SetDefaultCommand ( AutonomousCommand defaultCommand)

Set the default command to run if user selection is invalid.

Parameters
defaultCommandDefault command. nullptr indicates run no command

◆ UpdateSelectorEntries()

void AutoSelector::UpdateSelectorEntries ( ) const
private

Update dashboard with latest command list.

Member Data Documentation

◆ m_commands

std::vector<AutonomousCommand*> AutoSelector::m_commands
private

All autonomous commands that can be selected.

◆ m_default

AutonomousCommand* AutoSelector::m_default
private

Command to run if dashboard selection is invalid.


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