![]() |
WPILibC++ 2023.4.3
|
Implement a Robot Program framework. More...
#include <frc/RobotBase.h>
Public Member Functions | |
bool | IsEnabled () const |
Determine if the Robot is currently enabled. More... | |
bool | IsDisabled () const |
Determine if the Robot is currently disabled. More... | |
bool | IsAutonomous () const |
Determine if the robot is currently in Autonomous mode. More... | |
bool | IsAutonomousEnabled () const |
Determine if the robot is currently in Autonomous mode and enabled. More... | |
bool | IsTeleop () const |
Determine if the robot is currently in Operator Control mode. More... | |
bool | IsTeleopEnabled () const |
Determine if the robot is current in Operator Control mode and enabled. More... | |
bool | IsTest () const |
Determine if the robot is currently in Test mode. More... | |
bool | IsTestEnabled () const |
Determine if the robot is current in Test mode and enabled. More... | |
virtual void | StartCompetition ()=0 |
virtual void | EndCompetition ()=0 |
RobotBase () | |
Constructor for a generic robot program. More... | |
virtual | ~RobotBase ()=default |
Static Public Member Functions | |
static std::thread::id | GetThreadId () |
Gets the ID of the main robot thread. More... | |
static RuntimeType | GetRuntimeType () |
Get the current runtime type. More... | |
static constexpr bool | IsReal () |
Get if the robot is real. More... | |
static constexpr bool | IsSimulation () |
Get if the robot is a simulation. More... | |
Protected Member Functions | |
RobotBase (RobotBase &&)=default | |
RobotBase & | operator= (RobotBase &&)=default |
Static Protected Attributes | |
static std::thread::id | m_threadId |
Implement a Robot Program framework.
The RobotBase class is intended to be subclassed by a user creating a robot program. Overridden Autonomous() and OperatorControl() methods are called at the appropriate time as the match proceeds. In the current implementation, the Autonomous code will run to completion before the OperatorControl code could start. In the future the Autonomous code might be spawned as a task, then killed at the end of the Autonomous period.
frc::RobotBase::RobotBase | ( | ) |
Constructor for a generic robot program.
User code should be placed in the constructor that runs before the Autonomous or Operator Control period starts. The constructor will run to completion before Autonomous is entered.
This must be used to ensure that the communications code starts. In the future it would be nice to put this code into it's own task that loads on boot so ensure that it runs.
|
virtualdefault |
|
protecteddefault |
|
pure virtual |
Implemented in frc::TimedRobot.
|
static |
Get the current runtime type.
|
static |
Gets the ID of the main robot thread.
bool frc::RobotBase::IsAutonomous | ( | ) | const |
Determine if the robot is currently in Autonomous mode.
bool frc::RobotBase::IsAutonomousEnabled | ( | ) | const |
Determine if the robot is currently in Autonomous mode and enabled.
bool frc::RobotBase::IsDisabled | ( | ) | const |
Determine if the Robot is currently disabled.
bool frc::RobotBase::IsEnabled | ( | ) | const |
Determine if the Robot is currently enabled.
|
inlinestaticconstexpr |
Get if the robot is real.
|
inlinestaticconstexpr |
Get if the robot is a simulation.
bool frc::RobotBase::IsTeleop | ( | ) | const |
Determine if the robot is currently in Operator Control mode.
bool frc::RobotBase::IsTeleopEnabled | ( | ) | const |
Determine if the robot is current in Operator Control mode and enabled.
bool frc::RobotBase::IsTest | ( | ) | const |
Determine if the robot is currently in Test mode.
bool frc::RobotBase::IsTestEnabled | ( | ) | const |
Determine if the robot is current in Test mode and enabled.
|
pure virtual |
Implemented in frc::TimedRobot.
|
staticprotected |