Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.wpi.first.wpilibj
Class RobotBase

    java.lang.Object
      javax.microedition.midlet.MIDlet
          edu.wpi.first.wpilibj.RobotBase

Direct Known Subclasses:
  IterativeRobot, SimpleRobot

    public abstract class RobotBase

extends MIDlet

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
`static String` | `ERRORS_TO_DRIVERSTATION_PROP` Boolean System property.
`protected static String` | `FILE_NAME` name and contents of the version file that is read by the DS to determine the library version
`protected DriverStation` | `m_ds`
`static int` | `ROBOT_TASK_PRIORITY` The VxWorks priority that robot code should work at (so Java code should run at)
`protected static String` | `VERSION_CONTENTS`

Constructor Summary
`protected` | `RobotBase()` Constructor for a generic robot program.

Method Summary
`protected void` | `destroyApp(boolean unconditional)` Called if the MIDlet is terminated by the system.
`void` | `free()` Free the resources for a RobotBase class.
`static boolean` | `getBooleanProperty(String name, boolean defaultValue)`
`Watchdog` | `getWatchdog()` Return the instance of the Watchdog timer.
`boolean` | `isAutonomous()` Determine if the robot is currently in Autonomous mode.
`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.
`static boolean` | `isReal()`
`static boolean` | `isSimulation()`
`boolean` | `isSystemActive()` Check on the overall status of the system.
`boolean` | `isTest()` Determine if the robot is currently in Test mode
`protected void` | `pauseApp()` Pauses the application
`protected void` | `startApp()` Starting point for the applications.
`abstract void` | `startCompetition()` Provide an alternate "main loop" via startCompetition().
`protected void` | `writeVersionString()` Write the version string to the root directory

Methods inherited from class javax.microedition.midlet.MIDlet
`getAppProperty, notifyDestroyed, notifyPaused, resumeRequest`

Methods inherited from class java.lang.Object
`equals, 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

### ERRORS_TO_DRIVERSTATION_PROP

    public static final String ERRORS_TO_DRIVERSTATION_PROP

  Boolean System property. If true (default), send System.err messages to the driver station.

  See Also:
    Constant Field Values

### FILE_NAME

    protected static final String FILE_NAME

  name and contents of the version file that is read by the DS to determine the library version

  See Also:
    Constant Field Values

### VERSION_CONTENTS

    protected static final String VERSION_CONTENTS

See Also:
  Constant Field Values

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

### isSystemActive

    public boolean isSystemActive()

  Check on the overall status of the system.

  Returns:
    Is the system active (i.e. PWM motor outputs, etc. enabled)?

### getWatchdog

    public Watchdog getWatchdog()

  Return the instance of the Watchdog timer. Get the watchdog timer so the user program can either disable it or feed it when necessary.

  Returns:
    The Watchdog timer.

### isSimulation

    public static boolean isSimulation()

  Returns:
    If the robot is running in simulation.

### isReal

    public static boolean isReal()

  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.

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

### isTest

    public boolean isTest()

  Determine if the robot is currently in Test mode

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

### isOperatorControl

    public boolean isOperatorControl()

  Determine if the robot is currently in Operator Control mode.

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

### 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(String name,
                                             boolean defaultValue)

### writeVersionString

    protected void writeVersionString()

  Write the version string to the root directory

### startApp

    protected final void startApp()
                           throws MIDletStateChangeException

  Starting point for the applications. Starts the OtaServer and then runs the robot.

  Specified by:
    `startApp` in class `MIDlet`
  Throws:
    `MIDletStateChangeException`

### pauseApp

    protected final void pauseApp()

  Pauses the application

  Specified by:
    `pauseApp` in class `MIDlet`

### destroyApp

    protected final void destroyApp(boolean unconditional)
                             throws MIDletStateChangeException

  Called if the MIDlet is terminated by the system. I.e. if startApp throws any exception other than MIDletStateChangeException, if the isolate running the MIDlet is killed with Isolate.exit(), or if VM.stopVM() is called. It is not called if MIDlet.notifyDestroyed() was called.

  Specified by:
    `destroyApp` in class `MIDlet`
  Parameters:
    `unconditional` - If true when this method is called, the MIDlet must cleanup and release all resources. If false the MIDlet may throw MIDletStateChangeException to indicate it does not want to be destroyed at this time.
  Throws:
    `MIDletStateChangeException` - if there is an exception in terminating the midlet

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

"
For updated information see the Java FRC site
"