edu.wpi.first.wpilibj

## Class RobotBase

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

- Direct Known Subclasses:
    IterativeRobotBase, SampleRobot

      public abstract class RobotBase
      extends java.lang.Object

  Implement a Robot Program framework. The RobotBase class is intended to be subclassed by a user creating a robot program. Overridden autonomous() and operatorControl() methods are called at the appropriate time as the match proceeds. In the current implementation, the Autonomous code will run to completion before the OperatorControl code could start. In the future the Autonomous code might be spawned as a task, then killed at the end of the Autonomous period.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected DriverStation` | `m_ds`
    `static long` | `MAIN_THREAD_ID` The ID of the main Java thread.
    `static int` | `ROBOT_TASK_PRIORITY` The VxWorks priority that robot code should work at (so Java code should run at).

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `RobotBase()` Constructor for a generic robot program.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `free()` Free the resources for a RobotBase class.
    `static boolean` | `getBooleanProperty(java.lang.String name, boolean defaultValue)`
    `static void` | `initializeHardwareConfiguration()` Common initialization for all robot programs.
    `boolean` | `isAutonomous()` Determine if the robot is currently in Autonomous mode as determined by the field controls.
    `boolean` | `isDisabled()` Determine if the Robot is currently disabled.
    `boolean` | `isEnabled()` Determine if the Robot is currently enabled.
    `boolean` | `isNewDataAvailable()` Indicates if new data is available from the driver station.
    `boolean` | `isOperatorControl()` Determine if the robot is currently in Operator Control mode as determined by the field controls.
    `static boolean` | `isReal()` Get if the robot is real.
    `static boolean` | `isSimulation()` Get if the robot is a simulation.
    `boolean` | `isTest()` Determine if the robot is currently in Test mode as determined by the driver station.
    `static void` | `main(java.lang.String... args)` Starting point for the applications.
    `abstract void` | `startCompetition()` Provide an alternate "main loop" via startCompetition().

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

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

- - ### Field Detail

    - #### ROBOT_TASK_PRIORITY

          public static final int ROBOT_TASK_PRIORITY

      The VxWorks priority that robot code should work at (so Java code should run at).
      See Also:
        Constant Field Values

    - #### MAIN_THREAD_ID

          public static final long MAIN_THREAD_ID

      The ID of the main Java thread.

    - #### m_ds

          protected final DriverStation m_ds

  - ### Constructor Detail

    - #### RobotBase

          protected RobotBase()

      Constructor for a generic robot program. User code should be placed in the constructor that runs before the Autonomous or Operator Control period starts. The constructor will run to completion before Autonomous is entered.

      This must be used to ensure that the communications code starts. In the future it would be nice to put this code into it's own task that loads on boot so ensure that it runs.

  - ### Method Detail

    - #### free

          public void free()

      Free the resources for a RobotBase class.

    - #### isSimulation

          public static boolean isSimulation()

      Get if the robot is a simulation.
      Returns:
        If the robot is running in simulation.

    - #### isReal

          public static boolean isReal()

      Get if the robot is real.
      Returns:
        If the robot is running in the real world.

    - #### isDisabled

          public boolean isDisabled()

      Determine if the Robot is currently disabled.
      Returns:
        True if the Robot is currently disabled by the field controls.

    - #### isEnabled

          public boolean isEnabled()

      Determine if the Robot is currently enabled.
      Returns:
        True if the Robot is currently enabled by the field controls.

    - #### isAutonomous

          public boolean isAutonomous()

      Determine if the robot is currently in Autonomous mode as determined by the field controls.
      Returns:
        True if the robot is currently operating Autonomously.

    - #### isTest

          public boolean isTest()

      Determine if the robot is currently in Test mode as determined by the driver station.
      Returns:
        True if the robot is currently operating in Test mode.

    - #### isOperatorControl

          public boolean isOperatorControl()

      Determine if the robot is currently in Operator Control mode as determined by the field controls.
      Returns:
        True if the robot is currently operating in Tele-Op mode.

    - #### isNewDataAvailable

          public boolean isNewDataAvailable()

      Indicates if new data is available from the driver station.
      Returns:
        Has new data arrived over the network since the last time this function was called?

    - #### startCompetition

          public abstract void startCompetition()

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

    - #### getBooleanProperty

          public static boolean getBooleanProperty(java.lang.String name,
                                                   boolean defaultValue)

    - #### initializeHardwareConfiguration

          public static void initializeHardwareConfiguration()

      Common initialization for all robot programs.

    - #### main

          public static void main(java.lang.String... args)

      Starting point for the applications.