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
FieldsModifier and TypeFieldDescriptioncom.qualcomm.robotcore.hardware.Gamepadcom.qualcomm.robotcore.hardware.Gamepadcom.qualcomm.robotcore.hardware.HardwareMapstatic final intintDeprecated.protected FinderResultsWhat the finder found, as code lines.protected RobotTelemetryThe Driver Station screen.org.firstinspires.ftc.robotcore.external.TelemetryFields inherited from class com.qualcomm.robotcore.eventloop.opmode.OpMode
blackboard, msStuckDetectInit, msStuckDetectInitLoop, msStuckDetectLoop, msStuckDetectStart, time -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidbind(ControllerBindings controls) Binds gamepad 1 buttons.protected abstract StringThe finder's name, e.g.protected booleanTrue 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 booleanFalse after START and after the help page closes, until every stick, trigger and button on gamepad 1 has been let go once.protected voidopenHelp()Opens the help page (e.g.protected voidpause()Stops what moves, while the help page is open (the finder's buttons pause then).final voidfinal voidThe whole finder.protected abstract voidsetup()Sets up the hardware, in INIT.protected abstract voidThe finder's own screen lines, every loop.protected voidWhat INIT shows (the controls, a safety note).protected abstract voidstep()Runs once every loop after the buttons: moves things, measures.protected abstract voidstopAll()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, waitForStartMethods inherited from class com.qualcomm.robotcore.eventloop.opmode.OpMode
getRuntime, internalPostInitLoop, internalPostLoop, internalPreInit, internalUpdateTelemetryNow, resetRuntime, terminateOpModeNow, updateTelemetry
-
Field Details
-
t
The Driver Station screen. -
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.
-
-
Constructor Details
-
FinderOpMode
public FinderOpMode()
-
-
Method Details
-
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
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
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
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
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:
runOpModein classcom.qualcomm.robotcore.eventloop.opmode.LinearOpMode
-
requestOpModeStop
public final void requestOpModeStop()
-