WPILibC++
unspecified
|
IterativeRobot implements a specific type of Robot Program framework, extending the RobotBase class. More...
#include <IterativeRobot.h>
Public Member Functions | |
void | StartCompetition () override |
Provide an alternate "main loop" via StartCompetition(). More... | |
virtual void | RobotInit () |
Robot-wide initialization code should go here. More... | |
virtual void | DisabledInit () |
Initialization code for disabled mode should go here. More... | |
virtual void | AutonomousInit () |
Initialization code for autonomous mode should go here. More... | |
virtual void | TeleopInit () |
Initialization code for teleop mode should go here. More... | |
virtual void | TestInit () |
Initialization code for test mode should go here. More... | |
virtual void | RobotPeriodic () |
Periodic code for all modes should go here. More... | |
virtual void | DisabledPeriodic () |
Periodic code for disabled mode should go here. More... | |
virtual void | AutonomousPeriodic () |
Periodic code for autonomous mode should go here. More... | |
virtual void | TeleopPeriodic () |
Periodic code for teleop mode should go here. More... | |
virtual void | TestPeriodic () |
Periodic code for test mode should go here. More... | |
![]() | |
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 | IsOperatorControl () const |
Determine if the robot is currently in Operator Control mode. More... | |
bool | IsTest () const |
Determine if the robot is currently in Test mode. More... | |
bool | IsNewDataAvailable () const |
Indicates if new data is available from the driver station. More... | |
Additional Inherited Members | |
![]() | |
static std::thread::id | GetThreadId () |
Gets the ID of the main robot thread. | |
![]() | |
RobotBase () | |
Constructor for a generic robot program. More... | |
RobotBase (const RobotBase &)=delete | |
RobotBase & | operator= (const RobotBase &)=delete |
![]() | |
DriverStation & | m_ds |
![]() | |
static std::thread::id | m_threadId |
IterativeRobot implements a specific type of Robot Program framework, extending the RobotBase class.
The IterativeRobot class is intended to be subclassed by a user creating a robot program.
This class is intended to implement the "old style" default code, by providing the following functions which are called by the main loop, StartCompetition(), at the appropriate times:
RobotInit() – provide for initialization at robot power-on
Init() functions – each of the following functions is called once when the appropriate mode is entered:
Periodic() functions – each of these functions is called each time a new packet is received from the driver station:
|
virtual |
Initialization code for autonomous mode should go here.
Users should override this method for initialization code which will be called each time the robot enters autonomous mode.
|
virtual |
Periodic code for autonomous mode should go here.
Users should override this method for code which will be called each time a new packet is received from the driver station and the robot is in autonomous mode.
Packets are received approximately every 20ms. Fixed loop timing is not guaranteed due to network timing variability and the function may not be called at all if the Driver Station is disconnected. For most use cases the variable timing will not be an issue. If your code does require guaranteed fixed periodic timing, consider using Notifier or PIDController instead.
|
virtual |
Initialization code for disabled mode should go here.
Users should override this method for initialization code which will be called each time the robot enters disabled mode.
|
virtual |
Periodic code for disabled mode should go here.
Users should override this method for code which will be called each time a new packet is received from the driver station and the robot is in disabled mode.
Packets are received approximately every 20ms. Fixed loop timing is not guaranteed due to network timing variability and the function may not be called at all if the Driver Station is disconnected. For most use cases the variable timing will not be an issue. If your code does require guaranteed fixed periodic timing, consider using Notifier or PIDController instead.
|
virtual |
Robot-wide initialization code should go here.
Users should override this method for default Robot-wide initialization which will be called when the robot is first powered on. It will be called exactly one time.
Warning: the Driver Station "Robot Code" light and FMS "Robot Ready" indicators will be off until RobotInit() exits. Code in RobotInit() that waits for enable will cause the robot to never indicate that the code is ready, causing the robot to be bypassed in a match.
|
virtual |
Periodic code for all modes should go here.
This function is called each time a new packet is received from the driver station.
Packets are received approximately every 20ms. Fixed loop timing is not guaranteed due to network timing variability and the function may not be called at all if the Driver Station is disconnected. For most use cases the variable timing will not be an issue. If your code does require guaranteed fixed periodic timing, consider using Notifier or PIDController instead.
|
overridevirtual |
Provide an alternate "main loop" via StartCompetition().
This specific StartCompetition() implements "main loop" behaviour synced with the DS packets.
Implements frc::RobotBase.
|
virtual |
Initialization code for teleop mode should go here.
Users should override this method for initialization code which will be called each time the robot enters teleop mode.
|
virtual |
Periodic code for teleop mode should go here.
Users should override this method for code which will be called each time a new packet is received from the driver station and the robot is in teleop mode.
Packets are received approximately every 20ms. Fixed loop timing is not guaranteed due to network timing variability and the function may not be called at all if the Driver Station is disconnected. For most use cases the variable timing will not be an issue. If your code does require guaranteed fixed periodic timing, consider using Notifier or PIDController instead.
|
virtual |
Initialization code for test mode should go here.
Users should override this method for initialization code which will be called each time the robot enters test mode.
|
virtual |
Periodic code for test mode should go here.
Users should override this method for code which will be called each time a new packet is received from the driver station and the robot is in test mode.
Packets are received approximately every 20ms. Fixed loop timing is not guaranteed due to network timing variability and the function may not be called at all if the Driver Station is disconnected. For most use cases the variable timing will not be an issue. If your code does require guaranteed fixed periodic timing, consider using Notifier or PIDController instead.