2022-Robot
Robot code for 2022 FRC Season by Argos, FRC team #1756
Loading...
Searching...
No Matches
auto_selector.h
Go to the documentation of this file.
1
4
5#pragma once
6
8#include <frc2/command/Command.h>
9
10#include <initializer_list>
11#include <vector>
12
17 public:
22
29 AutoSelector(std::initializer_list<AutonomousCommand*> commands, AutonomousCommand* defaultCommand = nullptr);
30
36 void AddCommand(std::initializer_list<AutonomousCommand*> commands);
37
43 void AddCommand(AutonomousCommand* command);
44
50 void SetDefaultCommand(AutonomousCommand* defaultCommand);
51
58 frc2::Command* GetSelectedCommand() const;
59
60 private:
61 std::vector<AutonomousCommand*> m_commands;
63
67 void UpdateSelectorEntries() const;
68};
Allow user to select from auto routines using the default dashboard autonomous selector.
Definition: auto_selector.h:16
std::vector< AutonomousCommand * > m_commands
All autonomous commands that can be selected.
Definition: auto_selector.h:61
AutoSelector()
Initialize with no available auto routines. More may be added later.
Definition: auto_selector.cpp:9
void SetDefaultCommand(AutonomousCommand *defaultCommand)
Set the default command to run if user selection is invalid.
Definition: auto_selector.cpp:28
frc2::Command * GetSelectedCommand() const
Get the command selected by the user on the dashboard. Will return default command if no match is fou...
Definition: auto_selector.cpp:32
void AddCommand(std::initializer_list< AutonomousCommand * > commands)
Add a set of commands to the selector.
Definition: auto_selector.cpp:18
AutonomousCommand * m_default
Command to run if dashboard selection is invalid.
Definition: auto_selector.h:62
void UpdateSelectorEntries() const
Update dashboard with latest command list.
Definition: auto_selector.cpp:52
A command that can be selected from the dashboard.
Definition: autonomous_command.h:14