WPILibC++  2019.3.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
frc::IterativeRobotBase Class Reference

IterativeRobotBase implements a specific type of robot program framework, extending the RobotBase class. More...

#include <IterativeRobotBase.h>

Inheritance diagram for frc::IterativeRobotBase:
frc::RobotBase frc::IterativeRobot frc::TimedRobot

Public Member Functions

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...
 
- Public Member Functions inherited from frc::RobotBase
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...
 
virtual void StartCompetition ()=0
 

Protected Member Functions

 IterativeRobotBase (double period)
 Constructor for IterativeRobotBase. More...
 
 IterativeRobotBase (IterativeRobotBase &&)=default
 
IterativeRobotBaseoperator= (IterativeRobotBase &&)=default
 
void LoopFunc ()
 
- Protected Member Functions inherited from frc::RobotBase
 RobotBase ()
 Constructor for a generic robot program. More...
 
 RobotBase (RobotBase &&)
 
RobotBaseoperator= (RobotBase &&)
 

Protected Attributes

double m_period
 
- Protected Attributes inherited from frc::RobotBase
DriverStationm_ds
 

Additional Inherited Members

- Static Public Member Functions inherited from frc::RobotBase
static std::thread::id GetThreadId ()
 Gets the ID of the main robot thread.
 
static constexpr bool IsReal ()
 
static constexpr bool IsSimulation ()
 
- Static Protected Attributes inherited from frc::RobotBase
static std::thread::id m_threadId
 

Detailed Description

IterativeRobotBase implements a specific type of robot program framework, extending the RobotBase class.

The IterativeRobotBase class does not implement StartCompetition(), so it should not be used by teams directly.

This class provides 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:

  • DisabledInit() – called each and every time disabled is entered from another mode
  • AutonomousInit() – called each and every time autonomous is entered from another mode
  • TeleopInit() – called each and every time teleop is entered from another mode
  • TestInit() – called each and every time test is entered from another mode

Periodic() functions – each of these functions is called on an interval:

Constructor & Destructor Documentation

frc::IterativeRobotBase::IterativeRobotBase ( double  period)
explicitprotected

Constructor for IterativeRobotBase.

Parameters
periodPeriod in seconds.

Member Function Documentation

virtual void frc::IterativeRobotBase::AutonomousInit ( )
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 void frc::IterativeRobotBase::AutonomousPeriodic ( )
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.

virtual void frc::IterativeRobotBase::DisabledInit ( )
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 void frc::IterativeRobotBase::DisabledPeriodic ( )
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.

virtual void frc::IterativeRobotBase::RobotInit ( )
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 void frc::IterativeRobotBase::RobotPeriodic ( )
virtual

Periodic code for all modes should go here.

This function is called each time a new packet is received from the driver station.

virtual void frc::IterativeRobotBase::TeleopInit ( )
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 void frc::IterativeRobotBase::TeleopPeriodic ( )
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.

virtual void frc::IterativeRobotBase::TestInit ( )
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 void frc::IterativeRobotBase::TestPeriodic ( )
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.


The documentation for this class was generated from the following file: