Files
allwpilib/wpilibc/Athena/include/IterativeRobot.h
Fredric Silberberg 6d854afb0e WPILib Reorganization
This is a major restructuring of the WPILib repository to simply build
procedures and remove the remnants of Maven from everything except the
eclipse plugins. Gradle files have been largely simplified or rewritten,
taking advantage of splitting up parts of the build into separate build
files for ease of reading.

The eclipse plugins are now in a separate project, as is ntcore. All
dependencies are resolved via Maven dependencies, with the
Jenkins-maintained WPILib repo. Project structures have also been
simplified: we no longer have separate subprojects inside wpilibc and
wpilibj. Where possible, these changes hav been done with git renames,
to make sure we still have full history for all repositories. Other
unrelated subprojects have also been broken out: OutlineViewer is now a
separate project.

Change-Id: Ib4e2a6e1a2f66427a14f16612b0e0d69ed661878
2015-11-21 18:26:49 -05:00

82 lines
2.7 KiB
C++

/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved.
*/
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
/*----------------------------------------------------------------------------*/
#pragma once
#include "Timer.h"
#include "RobotBase.h"
/**
* 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:
* - DisabledInit() -- called only when first disabled
* - 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 iteratively at the
* appropriate periodic rate (aka the "slow loop"). The
* default period of
* the iterative robot is synced to the driver station
* control packets,
* giving a periodic frequency of about 50Hz (50 times
* per second).
* - DisabledPeriodic()
* - AutonomousPeriodic()
* - TeleopPeriodic()
* - TestPeriodic()
*
*/
class IterativeRobot : public RobotBase {
public:
/*
* The default period for the periodic function calls (seconds)
* Setting the period to 0.0 will cause the periodic functions to follow
* the Driver Station packet rate of about 50Hz.
*/
static constexpr double kDefaultPeriod = 0.0;
virtual void StartCompetition();
virtual void RobotInit();
virtual void DisabledInit();
virtual void AutonomousInit();
virtual void TeleopInit();
virtual void TestInit();
virtual void DisabledPeriodic();
virtual void AutonomousPeriodic();
virtual void TeleopPeriodic();
virtual void TestPeriodic();
protected:
virtual ~IterativeRobot() = default;
IterativeRobot() = default;
private:
bool m_disabledInitialized = false;
bool m_autonomousInitialized = false;
bool m_teleopInitialized = false;
bool m_testInitialized = false;
};