edu.wpi.first.wpilibj

## Class SampleRobot

- java.lang.Object
- - edu.wpi.first.wpilibj.RobotBase
  - - edu.wpi.first.wpilibj.SampleRobot

-     public class SampleRobot
      extends RobotBase

  A simple robot base class that knows the standard FRC competition states (disabled, autonomous, or operator controlled).

  You can build a simple robot program off of this by overriding the robotinit(), disabled(), autonomous() and operatorControl() methods. The startCompetition() method will calls these methods (sometimes repeatedly). depending on the state of the competition.

  Alternatively you can override the robotMain() method and manage all aspects of the robot yourself.

- - ### Field Summary

    - ### Fields inherited from class edu.wpi.first.wpilibj.RobotBase

      `m_ds, MAIN_THREAD_ID, ROBOT_TASK_PRIORITY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SampleRobot()` Create a new SampleRobot.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `autonomous()` Autonomous should go here.
    `protected void` | `disabled()` Disabled should go here.
    `void` | `operatorControl()` Operator control (tele-operated) code should go here.
    `protected void` | `robotInit()` Robot-wide initialization code should go here.
    `void` | `robotMain()` Robot main program for free-form programs.
    `void` | `startCompetition()` Start a competition.
    `void` | `test()` Test code should go here.

    - ### Methods inherited from class edu.wpi.first.wpilibj.RobotBase

      `free, getBooleanProperty, initializeHardwareConfiguration, isAutonomous, isDisabled, isEnabled, isNewDataAvailable, isOperatorControl, isReal, isSimulation, isTest, main`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SampleRobot

          public SampleRobot()

      Create a new SampleRobot.

  - ### Method Detail

    - #### robotInit

          protected void robotInit()

      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 one time.

      Warning: the Driver Station "Robot Code" light and FMS "Robot Ready" indicators will be off until RobotInit() exits. Code in RobotInit() that waits for enable will cause the robot to never indicate that the code is ready, causing the robot to be bypassed in a match.

    - #### disabled

          protected void disabled()

      Disabled should go here. Users should overload this method to run code that should run while the field is disabled.

      Called once each time the robot enters the disabled state.

    - #### autonomous

          public void autonomous()

      Autonomous should go here. Users should add autonomous code to this method that should run while the field is in the autonomous period.

      Called once each time the robot enters the autonomous state.

    - #### operatorControl

          public void operatorControl()

      Operator control (tele-operated) code should go here. Users should add Operator Control code to this method that should run while the field is in the Operator Control (tele-operated) period.

      Called once each time the robot enters the operator-controlled state.

    - #### test

          public void test()

      Test code should go here. Users should add test code to this method that should run while the robot is in test mode.

    - #### robotMain

          public void robotMain()

      Robot main program for free-form programs.

      This should be overridden by user subclasses if the intent is to not use the autonomous() and operatorControl() methods. In that case, the program is responsible for sensing when to run the autonomous and operator control functions in their program.

      This method will be called immediately after the constructor is called. If it has not been overridden by a user subclass (i.e. the default version runs), then the robotInit(), disabled(), autonomous() and operatorControl() methods will be called.

    - #### startCompetition

          public void startCompetition()

      Start a competition. This code tracks 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.
      Specified by:
        `startCompetition` in class `RobotBase`