blob: 34847d64540ecd6009305a345cf3b53729262d8d [file] [log] [blame]
Brian Silvermanf7f267a2017-02-04 16:16:08 -08001/*----------------------------------------------------------------------------*/
2/* Copyright (c) FIRST 2008-2017. 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 "RobotBase.h"
11
12namespace frc {
13
14/**
15 * IterativeRobot implements a specific type of Robot Program framework,
16 * extending the RobotBase class.
17 *
18 * The IterativeRobot class is intended to be subclassed by a user creating a
19 * robot program.
20 *
21 * This class is intended to implement the "old style" default code, by
22 * providing the following functions which are called by the main loop,
23 * StartCompetition(), at the appropriate times:
24 *
25 * RobotInit() -- provide for initialization at robot power-on
26 *
27 * Init() functions -- each of the following functions is called once when the
28 * appropriate mode is entered:
29 * - DisabledInit() -- called only when first disabled
30 * - AutonomousInit() -- called each and every time autonomous is entered from
31 * another mode
32 * - TeleopInit() -- called each and every time teleop is entered from
33 * another mode
34 * - TestInit() -- called each and every time test is entered from
35 * another mode
36 *
37 * Periodic() functions -- each of these functions is called each time a
38 * new packet is received from the driver station:
39 * - RobotPeriodic()
40 * - DisabledPeriodic()
41 * - AutonomousPeriodic()
42 * - TeleopPeriodic()
43 * - TestPeriodic()
44 *
45 */
46
47class IterativeRobot : public RobotBase {
48 public:
49 virtual void StartCompetition();
50
51 virtual void RobotInit();
52 virtual void DisabledInit();
53 virtual void AutonomousInit();
54 virtual void TeleopInit();
55 virtual void TestInit();
56
57 virtual void RobotPeriodic();
58 virtual void DisabledPeriodic();
59 virtual void AutonomousPeriodic();
60 virtual void TeleopPeriodic();
61 virtual void TestPeriodic();
62
63 protected:
64 virtual ~IterativeRobot() = default;
65 IterativeRobot() = default;
66
67 private:
68 bool m_disabledInitialized = false;
69 bool m_autonomousInitialized = false;
70 bool m_teleopInitialized = false;
71 bool m_testInitialized = false;
72};
73
74} // namespace frc