WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
IterativeRobot.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include "Timer.h"
11 #include "RobotBase.h"
12 
51 class IterativeRobot : public RobotBase {
52  public:
53  /*
54  * The default period for the periodic function calls (seconds)
55  * Setting the period to 0.0 will cause the periodic functions to follow
56  * the Driver Station packet rate of about 50Hz.
57  */
58  static constexpr double kDefaultPeriod = 0.0;
59 
60  virtual void StartCompetition();
61 
62  virtual void RobotInit();
63  virtual void DisabledInit();
64  virtual void AutonomousInit();
65  virtual void TeleopInit();
66  virtual void TestInit();
67 
68  virtual void DisabledPeriodic();
69  virtual void AutonomousPeriodic();
70  virtual void TeleopPeriodic();
71  virtual void TestPeriodic();
72 
73  protected:
74  virtual ~IterativeRobot() = default;
75  IterativeRobot() = default;
76 
77  private:
78  bool m_disabledInitialized = false;
79  bool m_autonomousInitialized = false;
80  bool m_teleopInitialized = false;
81  bool m_testInitialized = false;
82 };
virtual void RobotInit()
Robot-wide initialization code should go here.
Definition: IterativeRobot.cpp:118
IterativeRobot implements a specific type of Robot Program framework, extending the RobotBase class...
Definition: IterativeRobot.h:51
virtual void DisabledInit()
Initialization code for disabled mode should go here.
Definition: IterativeRobot.cpp:129
virtual void TeleopPeriodic()
Periodic code for teleop mode should go here.
Definition: IterativeRobot.cpp:205
virtual void TestInit()
Initialization code for test mode should go here.
Definition: IterativeRobot.cpp:162
virtual void StartCompetition()
Provide an alternate "main loop" via StartCompetition().
Definition: IterativeRobot.cpp:24
virtual void TeleopInit()
Initialization code for teleop mode should go here.
Definition: IterativeRobot.cpp:151
Implement a Robot Program framework.
Definition: RobotBase.h:40
virtual void AutonomousInit()
Initialization code for autonomous mode should go here.
Definition: IterativeRobot.cpp:140
virtual void AutonomousPeriodic()
Periodic code for autonomous mode should go here.
Definition: IterativeRobot.cpp:189
virtual void DisabledPeriodic()
Periodic code for disabled mode should go here.
Definition: IterativeRobot.cpp:173
virtual void TestPeriodic()
Periodic code for test mode should go here.
Definition: IterativeRobot.cpp:221