Now you can download a copy of these docs so you can use them offline! Download now

#include <IterativeRobot.h>

Inheritance diagram for IterativeRobot:
Collaboration diagram for IterativeRobot:

List of all members.

Public Member Functions

virtual void StartCompetition ()
virtual void RobotInit ()
virtual void DisabledInit ()
virtual void AutonomousInit ()
virtual void TeleopInit ()
virtual void DisabledPeriodic ()
virtual void AutonomousPeriodic ()
virtual void TeleopPeriodic ()
virtual void DisabledContinuous ()
virtual void AutonomousContinuous ()
virtual void TeleopContinuous ()
void SetPeriod (double period)
double GetPeriod ()
double GetLoopsPerSec ()

Static Public Attributes

static const double kDefaultPeriod = 0.0

Protected Member Functions

virtual ~IterativeRobot ()
 IterativeRobot ()

Detailed Description

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

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).

Continuous() functions -- each of these functions is called repeatedly as fast as possible. These functions are generally discouraged and if they are used, they should contain a Wait() of some type:

Definition at line 46 of file IterativeRobot.h.


Constructor & Destructor Documentation

IterativeRobot::~IterativeRobot (  )  [protected, virtual]

Free the resources for a RobotIterativeBase class.

Definition at line 32 of file IterativeRobot.cpp.

IterativeRobot::IterativeRobot (  )  [protected]

Constructor for RobotIterativeBase

The constructor initializes the instance variables for the robot to indicate the status of initialization for disabled, autonomous, and teleop code.

Definition at line 20 of file IterativeRobot.cpp.


Member Function Documentation

void IterativeRobot::AutonomousContinuous (  )  [virtual]

Continuous code for autonomous mode should go here.

Users should override this method for code which will be called repeatedly as frequently as possible while the robot is in autonomous mode.

Definition at line 297 of file IterativeRobot.cpp.

void IterativeRobot::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.

Definition at line 207 of file IterativeRobot.cpp.

void IterativeRobot::AutonomousPeriodic (  )  [virtual]

Periodic code for autonomous mode should go here.

Users should override this method for code which will be called periodically at a regular rate while the robot is in autonomous mode.

Definition at line 246 of file IterativeRobot.cpp.

void IterativeRobot::DisabledContinuous (  )  [virtual]

Continuous code for disabled mode should go here.

Users should override this method for code which will be called repeatedly as frequently as possible while the robot is in disabled mode.

Definition at line 280 of file IterativeRobot.cpp.

void IterativeRobot::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.

Definition at line 196 of file IterativeRobot.cpp.

void IterativeRobot::DisabledPeriodic (  )  [virtual]

Periodic code for disabled mode should go here.

Users should override this method for code which will be called periodically at a regular rate while the robot is in disabled mode.

Definition at line 229 of file IterativeRobot.cpp.

double IterativeRobot::GetLoopsPerSec (  ) 

Get the number of loops per second for the IterativeRobot

Returns:
Frequency of the periodic function calls

Definition at line 71 of file IterativeRobot.cpp.

double IterativeRobot::GetPeriod (  ) 

Get the period for the periodic functions. Returns 0.0 if configured to syncronize with DS control data packets.

Returns:
Period of the periodic function calls

Definition at line 62 of file IterativeRobot.cpp.

void IterativeRobot::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 1 time.

Definition at line 185 of file IterativeRobot.cpp.

void IterativeRobot::SetPeriod ( double  period  ) 

Set the period for the periodic functions.

Parameters:
period The period of the periodic function calls. 0.0 means sync to driver station control data.

Definition at line 41 of file IterativeRobot.cpp.

void IterativeRobot::StartCompetition (  )  [virtual]

Provide an alternate "main loop" via StartCompetition().

This specific StartCompetition() implements "main loop" behavior like that of the FRC control system in 2008 and earlier, with a primary (slow) loop that is called periodically, and a "fast loop" (a.k.a. "spin loop") that is called as fast as possible with no delay between calls.

Implements RobotBase.

Definition at line 88 of file IterativeRobot.cpp.

void IterativeRobot::TeleopContinuous (  )  [virtual]

Continuous code for teleop mode should go here.

Users should override this method for code which will be called repeatedly as frequently as possible while the robot is in teleop mode.

Definition at line 314 of file IterativeRobot.cpp.

void IterativeRobot::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.

Definition at line 218 of file IterativeRobot.cpp.

void IterativeRobot::TeleopPeriodic (  )  [virtual]

Periodic code for teleop mode should go here.

Users should override this method for code which will be called periodically at a regular rate while the robot is in teleop mode.

Definition at line 263 of file IterativeRobot.cpp.


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

Generated on Thu Jan 12 2012 22:35:32 for WPILibC++ by doxygen 1.7.1