34template <
typename T,
typename R>
45template <
typename T,
typename R>
110 std::string_view
name, std::string_view group,
111 std::string_view description,
127 std::string_view
name, std::string_view group = {},
128 std::string_view description = {});
158 std::weak_ptr<OpMode> m_activeOpMode;
176template <
typename Derived>
193 template <ConstructibleOpMode<Derived> T>
195 std::string_view description,
200 [
this] {
return std::make_unique<T>(*
static_cast<Derived*
>(
this)); },
201 mode,
name, group, description, textColor, backgroundColor);
204 description, textColor, backgroundColor);
220 template <ConstructibleOpMode<Derived> T>
222 std::string_view group = {},
223 std::string_view description = {}) {
224 if constexpr (detail::OneArgOpMode<T, Derived>) {
226 [
this] {
return std::make_unique<T>(*
static_cast<Derived*
>(
this)); },
227 mode,
name, group, description);
228 }
else if constexpr (detail::NoArgOpMode<T>) {
This file defines the DenseMap class.
@ name
Definition base.h:690
void PublishOpModes()
Publishes the operating mode options to the driver station.
void EndCompetition() override
Ends the main loop in StartCompetition().
virtual void NonePeriodic()
Function called periodically anytime when no opmode is selected, including when the Driver Station is...
Definition OpModeRobot.hpp:94
void ClearOpModes()
Clears all operating mode options and publishes an empty list to the driver station.
OpModeRobotBase(OpModeRobotBase &&)=delete
void RemoveOpMode(RobotMode mode, std::string_view name)
Removes an operating mode option.
OpModeRobotBase & operator=(OpModeRobotBase &&)=delete
void AddOpModeFactory(OpModeFactory factory, RobotMode mode, std::string_view name, std::string_view group, std::string_view description, const wpi::util::Color &textColor, const wpi::util::Color &backgroundColor)
Adds an operating mode option using a factory function that creates the opmode.
void AddOpModeFactory(OpModeFactory factory, RobotMode mode, std::string_view name, std::string_view group={}, std::string_view description={})
Adds an operating mode option using a factory function that creates the opmode.
OpModeRobotBase()=default
Constructor.
std::function< std::unique_ptr< OpMode >()> OpModeFactory
Definition OpModeRobot.hpp:61
virtual void DriverStationConnected()
Function called exactly once after the DS is connected.
Definition OpModeRobot.hpp:88
void StartCompetition() override
Provide an alternate "main loop" via StartCompetition().
OpModeRobot implements the opmode-based robot program framework.
Definition OpModeRobot.hpp:177
void AddOpMode(RobotMode mode, std::string_view name, std::string_view group, std::string_view description, const wpi::util::Color &textColor, const wpi::util::Color &backgroundColor)
Adds an operating mode option.
Definition OpModeRobot.hpp:194
void AddOpMode(RobotMode mode, std::string_view name, std::string_view group={}, std::string_view description={})
Adds an operating mode option.
Definition OpModeRobot.hpp:221
RobotBase()
Constructor for a generic robot program.
A move-only C++ wrapper around a HAL handle.
Definition Types.hpp:16
Represents colors that can be used with Addressable LEDs.
Definition Color.hpp:42
Definition DenseMap.hpp:728
Concept indicating a class is derived from OpMode and has either a no-argument constructor or a const...
Definition OpModeRobot.hpp:46
Definition OpModeRobot.hpp:33
Definition OpModeRobot.hpp:35
Definition OpModeRobot.hpp:31
Converts a string literal into a format string that will be parsed at compile time and converted into...
Definition printf.h:50
RobotMode
The overall robot mode (not including enabled state).
Definition DriverStationTypes.hpp:15
Definition raw_os_ostream.hpp:19
::std::mutex mutex
Definition mutex.hpp:17
Definition CvSource.hpp:15