code/WPILib/SimpleRobot.cpp
/**
 * Start a competition.
 * This code needs to track the order of the field starting to ensure that everything happens
 * in the right order. Repeatedly run the correct method, either Autonomous or OperatorControl
 * when the robot is enabled. After running the correct method, wait for some state to change,
 * either the other mode starts or the robot is disabled. Then go back and wait for the robot
 * to be enabled again.
 */
Start a competition.
This code needs to track the order of the field starting to ensure that everything happens
in the right order. Repeatedly run the correct method, either Autonomous or OperatorControl
when the robot is enabled. After running the correct method, wait for some state to change,
either the other mode starts or the robot is disabled. Then go back and wait for the robot
to be enabled again.
Start a competition . This code needs to track the order of the field starting to ensure that everything happens in the right order . Repeatedly run the correct method either Autonomous or OperatorControl when the robot is enabled . After running the correct method wait for some state to change either the other mode starts or the robot is disabled . Then go back and wait for the robot to be enabled again .
void SimpleRobot::StartCompetition()
{
	RobotMain();
	if (!m_robotMainOverridden)
	{
		RobotInit();
		while (1)
		{
			if (IsDisabled())
			{
				Disabled();
				while (IsDisabled()) Wait(.01);
			}
			else if (IsAutonomous())
			{
				Autonomous();
				while (IsAutonomous() && IsEnabled()) Wait(.01);
			}
			else
			{
				OperatorControl();
				while (IsOperatorControl() && IsEnabled()) Wait(.01);
			}
		}
	}
}
void SimpleRobot :: StartCompetition ( ) { RobotMain ( ) ; if ( ! m_robotMainOverridden ) { RobotInit ( ) ; while ( 1 ) { if ( IsDisabled ( ) ) { Disabled ( ) ; while ( IsDisabled ( ) ) Wait ( .01 ) ; } else if ( IsAutonomous ( ) ) { Autonomous ( ) ; while ( IsAutonomous ( ) && IsEnabled ( ) ) Wait ( .01 ) ; } else { OperatorControl ( ) ; while ( IsOperatorControl ( ) && IsEnabled ( ) ) Wait ( .01 ) ; } } } }
Start a competition.
Start a competition .
// first and one-time initialization