[wpilib] Update RobotBase documentation (NFC) (#5320)

This commit is contained in:
Ryan Blue
2023-05-13 00:29:39 -04:00
committed by GitHub
parent 218cfea16b
commit 7a90475eec
2 changed files with 28 additions and 18 deletions

View File

@@ -115,14 +115,14 @@ int StartRobot() {
}
/**
* Implement a Robot Program framework.
* Implement a Robot Program framework. The RobotBase class is intended to be
* subclassed to create a robot program. The user must implement
* StartCompetition() which will be called once and is not expected to exit. The
* user must also implement EndCompetition(), which signals to the code in
* StartCompetition() that it should exit.
*
* 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.
* It is not recommended to subclass this class directly - instead subclass
* IterativeRobotBase or TimedRobot.
*/
class RobotBase {
public:
@@ -193,8 +193,13 @@ class RobotBase {
*/
static std::thread::id GetThreadId();
/**
* Start the main robot code. This function will be called once and should not
* exit until signalled by EndCompetition()
*/
virtual void StartCompetition() = 0;
/** Ends the main loop in StartCompetition(). */
virtual void EndCompetition() = 0;
/**
@@ -229,7 +234,7 @@ class RobotBase {
/**
* Constructor for a generic robot program.
*
* User code should be placed in the constructor that runs before the
* User code can 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.
*