Class InitStop

java.lang.Object
com.crossbotics.ftchelper.core.InitStop

public final class InitStop extends Object
A mistake found at INIT, shown as plain lines on the Driver Station. Without this, the FTC app shows one red line that starts with Java words ("User code threw an uncaught exception: IllegalStateException - ..."), and the real message is easy to miss. With it, the Driver Station shows:
 INIT STOPPED: the robot did not start.
 Tunables.Lift has no max: write max (...)
 Fix it, then press INIT again. Press STOP now.
 
and the OpMode waits (nothing moves) until STOP. A mistake after START is not caught: the FTC app shows it as before, after the OpMode has stopped every part. The robot log keeps the full error. Docs: docs/troubleshooting.md, "Driver Station errors"
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    The OpMode's body, which may stop with an error.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    run(com.qualcomm.robotcore.eventloop.opmode.LinearOpMode op, InitStop.Body body)
    Runs body.
    static boolean
    showAndWait(com.qualcomm.robotcore.eventloop.opmode.LinearOpMode op, RuntimeException e)
    Shows e as plain lines and waits until STOP (BLOCKS: on purpose, nothing else runs).
    static void
    The simulator only: INIT errors stop the OpMode with the error, as before (its own panel shows it).
    static String
    The plain words for an error: the library's own messages as they are; anything else (a mistake in your own code) with its kind and where it happened, e.g.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • run

      public static void run(com.qualcomm.robotcore.eventloop.opmode.LinearOpMode op, InitStop.Body body)
      Runs body. An error before START is shown as plain lines, and this waits for STOP. Any other error goes on as before.
    • showAndWait

      public static boolean showAndWait(com.qualcomm.robotcore.eventloop.opmode.LinearOpMode op, RuntimeException e)
      Shows e as plain lines and waits until STOP (BLOCKS: on purpose, nothing else runs). Returns false (shows nothing) in the simulator, where the caller then throws it as before.
    • words

      public static String words(Throwable e)
      The plain words for an error: the library's own messages as they are; anything else (a mistake in your own code) with its kind and where it happened, e.g. "NullPointerException in Robot.java line 42".
    • throwInsteadOfShowing

      public static void throwInsteadOfShowing(boolean on)
      The simulator only: INIT errors stop the OpMode with the error, as before (its own panel shows it).