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,CameraFixCheckOpMode,CharacterizerOpMode,DriveTunerOpMode,EncoderCheckOpMode,FeedStopFinderOpMode,FeedTimeFinderOpMode,FlywheelFinderOpMode,HoodFinderOpMode,MotorDirectionCheckOpMode,MotorFinderOpMode,MoveTunerOpMode,OdometryTunerOpMode,PieceTunerOpMode,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 booleanTrue for a finder whose numbers depend on the battery (a power, a gain, a speed): it shows the battery, warns belowTuningMenu.LOW_BATTERY_VOLTS, and says the volts next to its results.protected 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[]protected final booleaninInit()opModeInInit(), or the host's when this finder runs inside "Tune and check".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 voidRuns this finder inside "Tune and check" (TuneAndCheckOpMode).protected final booleanrunning()opModeIsActive(), or the host's when this finder runs inside "Tune and check".final 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. -
batteryMatters
protected boolean batteryMatters()True for a finder whose numbers depend on the battery (a power, a gain, a speed): it shows the battery, warns belowTuningMenu.LOW_BATTERY_VOLTS, and says the volts next to its results. Default false (positions and distances do not depend on it). -
helpLines
-
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. -
runInside
Runs this finder inside "Tune and check" (TuneAndCheckOpMode). You do not call it yourself. -
inInit
protected final boolean inInit()opModeInInit(), or the host's when this finder runs inside "Tune and check". -
running
protected final boolean running()opModeIsActive(), or the host's when this finder runs inside "Tune and check". Use it, not opModeIsActive(). -
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()
-