Class FinderOpMode

java.lang.Object
com.qualcomm.robotcore.eventloop.opmode.OpMode
com.qualcomm.robotcore.eventloop.opmode.LinearOpMode
com.crossbotics.ftchelper.finders.FinderOpMode
Direct Known Subclasses:
AimTunerOpMode, CharacterizerOpMode, DriveTunerOpMode, FlywheelFinderOpMode, MotorFinderOpMode, OdometryTunerOpMode, ServoFinderOpMode, ShotTunerOpMode

public abstract class FinderOpMode extends com.qualcomm.robotcore.eventloop.opmode.LinearOpMode
The shared frame of every finder: INIT, a loop that never waits, the "copy into your code" lines, saving them to the results file, and stopping everything at the end (even after an error). Each finder fills in its own steps. You do not use this class directly: use a finder such as ServoFinderOpMode. Docs: docs/modules/finders.md
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    com.qualcomm.robotcore.hardware.Gamepad
     
    com.qualcomm.robotcore.hardware.Gamepad
     
    com.qualcomm.robotcore.hardware.HardwareMap
     
    static final int
     
    int
    Deprecated.
    protected FinderResults
    What the finder found, as code lines.
    protected RobotTelemetry
    The Driver Station screen.
    org.firstinspires.ftc.robotcore.external.Telemetry
     

    Fields inherited from class com.qualcomm.robotcore.eventloop.opmode.OpMode

    blackboard, msStuckDetectInit, msStuckDetectInitLoop, msStuckDetectLoop, msStuckDetectStart, time
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract void
    Binds gamepad 1 buttons.
    protected abstract String
    The finder's name, e.g.
    protected boolean
    True while a help key is down (GUIDE, or START): used to stop a moving test at once.
    protected String[]
    The help page: every button and the steps, a line each (at most 13 lines, about 50 characters each, to fit on the Driver Station).
    protected boolean
    False after START and after the help page closes, until every stick, trigger and button on gamepad 1 has been let go once.
    protected void
    Opens the help page (e.g.
    protected void
    Stops what moves, while the help page is open (the finder's buttons pause then).
    final void
     
    final void
    The whole finder.
    protected abstract void
    Sets up the hardware, in INIT.
    protected abstract void
    The finder's own screen lines, every loop.
    protected void
    What INIT shows (the controls, a safety note).
    protected abstract void
    Runs once every loop after the buttons: moves things, measures.
    protected abstract void
    Stops every motor and servo it moves.

    Methods inherited from class com.qualcomm.robotcore.eventloop.opmode.LinearOpMode

    idle, init, init_loop, isStarted, isStopRequested, loop, opModeInInit, opModeIsActive, sleep, start, stop, waitForStart

    Methods inherited from class com.qualcomm.robotcore.eventloop.opmode.OpMode

    getRuntime, internalPostInitLoop, internalPostLoop, internalPreInit, internalUpdateTelemetryNow, resetRuntime, terminateOpModeNow, updateTelemetry

    Methods inherited from class java.lang.Object

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

    • t

      protected RobotTelemetry t
      The Driver Station screen.
    • results

      protected FinderResults results
      What the finder found, as code lines.
    • MS_BEFORE_FORCE_STOP_AFTER_STOP_REQUESTED

      public static final int MS_BEFORE_FORCE_STOP_AFTER_STOP_REQUESTED
      See Also:
    • gamepad1

      public volatile com.qualcomm.robotcore.hardware.Gamepad gamepad1
    • gamepad2

      public volatile com.qualcomm.robotcore.hardware.Gamepad gamepad2
    • telemetry

      public org.firstinspires.ftc.robotcore.external.Telemetry telemetry
    • hardwareMap

      public volatile com.qualcomm.robotcore.hardware.HardwareMap hardwareMap
    • msStuckDetectStop

      @Deprecated public int msStuckDetectStop
      Deprecated.
  • Constructor Details

    • FinderOpMode

      public FinderOpMode()
  • Method Details

    • finderName

      protected abstract String finderName()
      The finder's name, e.g. "Servo finder".
    • setup

      protected abstract void setup()
      Sets up the hardware, in INIT. Nothing may move here.
    • bind

      protected abstract void bind(ControllerBindings controls)
      Binds gamepad 1 buttons. Actions must be quick: never wait.
    • step

      protected abstract void step()
      Runs once every loop after the buttons: moves things, measures. Never waits.
    • show

      protected abstract void show(RobotTelemetry t)
      The finder's own screen lines, every loop.
    • stopAll

      protected abstract void stopAll()
      Stops every motor and servo it moves. Called at the end, always.
    • helpLines

      protected String[] helpLines()
      The help page: every button and the steps, a line each (at most 13 lines, about 50 characters each, to fit on the Driver Station). GUIDE (or START held 1 s) shows it, in INIT or while running. Default: a page that says there is no help yet.
    • pause

      protected void pause()
      Stops what moves, while the help page is open (the finder's buttons pause then). Default: stopAll(). A finder overrides it when stopAll() also closes something (a camera) that must keep working.
    • showInit

      protected void showInit(RobotTelemetry t)
      What INIT shows (the controls, a safety note).
    • inputsReady

      protected boolean inputsReady()
      False after START and after the help page closes, until every stick, trigger and button on gamepad 1 has been let go once. A finder checks it before acting on a stick, trigger or held button that it reads directly, so nothing starts moving because of a finger that was already down (the buttons bound in bind() are protected anyway).
    • openHelp

      protected void openHelp()
      Opens the help page (e.g. when GUIDE stopped a test). Everything pauses as usual.
    • helpKeyDown

      protected boolean helpKeyDown()
      True while a help key is down (GUIDE, or START): used to stop a moving test at once.
    • runOpMode

      public final void runOpMode()
      The whole finder. The FTC SDK calls this when you press INIT. final: a finder cannot skip the safety steps here.
      Specified by:
      runOpMode in class com.qualcomm.robotcore.eventloop.opmode.LinearOpMode
    • requestOpModeStop

      public final void requestOpModeStop()