24#ifndef __FRC_ROBORIO__
31 static Robot theRobot;
33 std::scoped_lock lock{m};
36 theRobot.StartCompetition();
41 "The robot program quit unexpectedly."
42 " This is usually due to a code error.\n"
43 " The above stacktrace can help determine where the error occurred.\n"
44 " See https://wpilib.org/stacktrace for more information.\n");
63 static Robot* robot =
nullptr;
64 static bool exited =
false;
69 impl::RunRobot<Robot>(m, &robot);
73 std::scoped_lock lock{m};
83 std::scoped_lock lock{m};
94 robot->EndCompetition();
98 using namespace std::chrono_literals;
99 std::unique_lock lock{m};
100 if (
cv.wait_for(lock, 1s, [] { return exited; })) {
106 impl::RunRobot<Robot>(m, &robot);
109#ifndef __FRC_ROBORIO__
220#ifdef __FRC_ROBORIO__
233#ifdef __FRC_ROBORIO__
you may not use this file except in compliance with the License You may obtain a copy of the License at software distributed under the License is distributed on an AS IS WITHOUT WARRANTIES OR CONDITIONS OF ANY either express or implied See the License for the specific language governing permissions and limitations under the License LLVM Exceptions to the Apache License As an exception
Definition: ThirdPartyNotices.txt:289
Implement a Robot Program framework.
Definition: RobotBase.h:127
RobotBase()
Constructor for a generic robot program.
bool IsTestEnabled() const
Determine if the robot is current in Test mode and enabled.
static constexpr bool IsReal()
Get if the robot is real.
Definition: RobotBase.h:219
static constexpr bool IsSimulation()
Get if the robot is a simulation.
Definition: RobotBase.h:232
bool IsTest() const
Determine if the robot is currently in Test mode.
static std::thread::id GetThreadId()
Returns the main thread ID.
static std::thread::id m_threadId
Definition: RobotBase.h:259
RobotBase & operator=(RobotBase &&)=default
bool IsAutonomousEnabled() const
Determine if the robot is currently in Autonomous mode and enabled.
bool IsEnabled() const
Determine if the Robot is currently enabled.
virtual void StartCompetition()=0
Start the main robot code.
bool IsTeleop() const
Determine if the robot is currently in Operator Control mode.
static RuntimeType GetRuntimeType()
Get the current runtime type.
bool IsDisabled() const
Determine if the Robot is currently disabled.
virtual void EndCompetition()=0
Ends the main loop in StartCompetition().
bool IsAutonomous() const
Determine if the robot is currently in Autonomous mode.
bool IsTeleopEnabled() const
Determine if the robot is current in Operator Control mode and enabled.
virtual ~RobotBase()=default
RobotBase(RobotBase &&)=default
Runtime error exception.
Definition: Errors.h:20
void HAL_Shutdown(void)
Call this to shut down HAL.
int32_t HAL_SendError(HAL_Bool isError, int32_t errorCode, HAL_Bool isLVCode, const char *details, const char *location, const char *callStack, HAL_Bool printMsg)
Sends an error to the driver station.
void HAL_RunMain(void)
Runs the main function provided to HAL_SetMain().
HAL_Bool HAL_HasMain(void)
Returns true if HAL_SetMain() has been called.
void HAL_ExitMain(void)
Causes HAL_RunMain() to exit.
Definition: VisionPipeline.h:7
void RunRobot(wpi::mutex &m, Robot **robot)
Definition: RobotBase.h:29
Definition: AprilTagPoseEstimator.h:15
int StartRobot()
Definition: RobotBase.h:55
int RunHALInitialization()
RuntimeType
Runtime type.
Definition: RuntimeType.h:11
static constexpr const charge::coulomb_t e(1.6021766208e-19)
elementary charge.
::std::condition_variable condition_variable
Definition: condition_variable.h:16
::std::mutex mutex
Definition: mutex.h:17
#define FRC_ReportError(status, format,...)
Reports an error to the driver station (using HAL_SendError).
Definition: Errors.h:137