Class ServoFinderOpMode
java.lang.Object
com.qualcomm.robotcore.eventloop.opmode.OpMode
com.qualcomm.robotcore.eventloop.opmode.LinearOpMode
com.crossbotics.ftchelper.finders.FinderOpMode
com.crossbotics.ftchelper.finders.ServoFinderOpMode
Finds a servo's numbers: its safe ends (limits) and the positions you want (open, closed, ...).
Nudge the servo with the D-pad, mark the ends and positions, and copy the code lines it shows.
No code to write: it lists every servo in the robot configuration.
It shows the code for PositionServo and, for the robot in five files, the line for
Tunables.java: Tunables.Claw: P1 = 0.210, P2 = 0.770 (rename P1, P2 to open, closed).
Choose: D-pad up/down = servo, A = use it, Y = full range on/off (500-2500 us instead of the
SDK's normal 600-2400: a goBILDA 2000 servo turns 300 degrees instead of 270; use it when
the part has .fullRange() in Robot.java, so the numbers fit)
Start: D-pad = choose a start point (the servo does NOT move yet), A = move it there.
Pick a value near where it sits now: a servo cannot tell where it is.
Nudge: D-pad right/left = +/- 0.01 D-pad up/down = +/- 0.05 hold RB = 10 times finer
X = mark this as one END, B = mark the other END (where it just stops touching the frame).
Once both are marked, it stays between them (hold LB to go past, e.g. to mark again)
A = save this as a position (P1, P2, ...; rename them in your code), Y = undo the last one
BACK = choose another servo
Help: GUIDE (or hold START 1 s) = a help page with every button; everything pauses.
The servo does not move until you press A at the start point (its real position is unknown).
In your TeamCode: @TeleOp(name = "Servo Finder", group = "Finders")
public class ServoFinder extends ServoFinderOpMode { }
Docs: docs/modules/finders.md. Guide: docs/guides/finders.md-
Field Summary
FieldsModifier and TypeFieldDescriptioncom.qualcomm.robotcore.hardware.Gamepadcom.qualcomm.robotcore.hardware.Gamepadcom.qualcomm.robotcore.hardware.HardwareMapstatic final intintDeprecated.org.firstinspires.ftc.robotcore.external.TelemetryFields inherited from class com.crossbotics.ftchelper.finders.FinderOpMode
results, tFields inherited from class com.qualcomm.robotcore.eventloop.opmode.OpMode
blackboard, msStuckDetectInit, msStuckDetectInitLoop, msStuckDetectLoop, msStuckDetectStart, time -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidBinds gamepad 1 buttons.protected StringThe finder's name, e.g.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).final voidprotected voidsetup()Sets up the hardware, in INIT.protected voidThe finder's own screen lines, every loop.protected voidWhat INIT shows (the controls, a safety note).protected voidstep()Runs once every loop after the buttons: moves things, measures.protected voidstopAll()Stops every motor and servo it moves.Methods inherited from class com.crossbotics.ftchelper.finders.FinderOpMode
helpKeyDown, inputsReady, openHelp, pause, runOpModeMethods 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
-
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
-
ServoFinderOpMode
public ServoFinderOpMode()
-
-
Method Details
-
finderName
Description copied from class:FinderOpModeThe finder's name, e.g. "Servo finder".- Specified by:
finderNamein classFinderOpMode
-
setup
protected void setup()Description copied from class:FinderOpModeSets up the hardware, in INIT. Nothing may move here.- Specified by:
setupin classFinderOpMode
-
showInit
Description copied from class:FinderOpModeWhat INIT shows (the controls, a safety note).- Overrides:
showInitin classFinderOpMode
-
bind
Description copied from class:FinderOpModeBinds gamepad 1 buttons. Actions must be quick: never wait.- Specified by:
bindin classFinderOpMode
-
step
protected void step()Description copied from class:FinderOpModeRuns once every loop after the buttons: moves things, measures. Never waits.- Specified by:
stepin classFinderOpMode
-
show
Description copied from class:FinderOpModeThe finder's own screen lines, every loop.- Specified by:
showin classFinderOpMode
-
helpLines
Description copied from class:FinderOpModeThe 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.- Overrides:
helpLinesin classFinderOpMode
-
stopAll
protected void stopAll()Description copied from class:FinderOpModeStops every motor and servo it moves. Called at the end, always.- Specified by:
stopAllin classFinderOpMode
-
requestOpModeStop
public final void requestOpModeStop()
-