code/WPILib/IterativeRobot.cpp
/**
 * 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. 
 */
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.
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 .
void IterativeRobot::StartCompetition()
{
	RobotInit();
	while (TRUE)
	{
		if (IsDisabled())
		{
			if(!m_disabledInitialized)
			{
				DisabledInit();
				m_disabledInitialized = true;
				m_autonomousInitialized = false;
				m_teleopInitialized = false;
			}
			if (NextPeriodReady())
			{
				DisabledPeriodic();
			}
			DisabledContinuous();
		}
		else if (IsAutonomous())
		{
			if(!m_autonomousInitialized)
			{
				AutonomousInit();
				m_autonomousInitialized = true;
				m_disabledInitialized = false;
				m_teleopInitialized = false;
			}
			if (NextPeriodReady())
			{
				AutonomousPeriodic();
			}
			AutonomousContinuous();
		}
		else
		{
			if(!m_teleopInitialized)
			{
				TeleopInit();
				m_teleopInitialized = true;
				m_disabledInitialized = false;
				m_autonomousInitialized = false;
			}
			if (NextPeriodReady())
			{
				TeleopPeriodic();
			}
			TeleopContinuous();
		}
	}	
}
void IterativeRobot :: StartCompetition ( ) { RobotInit ( ) ; while ( TRUE ) { if ( IsDisabled ( ) ) { if ( ! m_disabledInitialized ) { DisabledInit ( ) ; m_disabledInitialized = true ; m_autonomousInitialized = false ; m_teleopInitialized = false ; } if ( NextPeriodReady ( ) ) { DisabledPeriodic ( ) ; } DisabledContinuous ( ) ; } else if ( IsAutonomous ( ) ) { if ( ! m_autonomousInitialized ) { AutonomousInit ( ) ; m_autonomousInitialized = true ; m_disabledInitialized = false ; m_teleopInitialized = false ; } if ( NextPeriodReady ( ) ) { AutonomousPeriodic ( ) ; } AutonomousContinuous ( ) ; } else { if ( ! m_teleopInitialized ) { TeleopInit ( ) ; m_teleopInitialized = true ; m_disabledInitialized = false ; m_autonomousInitialized = false ; } if ( NextPeriodReady ( ) ) { TeleopPeriodic ( ) ; } TeleopContinuous ( ) ; } } }
Provide an alternate "main loop" via StartCompetition().
Provide an alternate " main loop " via StartCompetition () .
// first and one-time initialization // loop forever, calling the appropriate mode-dependent function // Call the appropriate function depending upon the current robot mode // call DisabledInit() if we are now just entering disabled mode from // either a different mode or from power-on // reset the initialization flags for the other modes // call AutonomousInit() if we are now just entering autonomous mode from // either a different mode or from power-on // reset the initialization flags for the other modes // call TeleopInit() if we are now just entering teleop mode from // either a different mode or from power-on // reset the initialization flags for the other modes