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

Private Member Functions

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

Private Attributes

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

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.

◆ m_log

argos_lib::ArgosLogger AutoSelector::m_log
private

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