Class FlywheelFinderOpMode
java.lang.Object
com.qualcomm.robotcore.eventloop.opmode.OpMode
com.qualcomm.robotcore.eventloop.opmode.LinearOpMode
com.crossbotics.ftchelper.finders.FinderOpMode
com.crossbotics.ftchelper.finders.FlywheelFinderOpMode
Finds a flywheel's speed-control numbers. Step 1 measures the top speed at full power and works
out starting gains from it. Step 2 holds a speed you choose, so you can fine-tune the main gain
(F), feed a piece by hand, and see how fast the wheel gets back to speed after a shot.
No code to write: it lists every motor in the robot configuration.
It shows the code for Flywheel and, for the robot in five files, the line for
Tunables.java: Tunables.Launcher: kP = 1.17, kI = 0.117, kD = 0, kF = 11.70.
Choose: D-pad up/down = motor, A = use it
Step 1: hold A = full power (at most 5 s). Release when the speed stops rising.
Step 2: B = hold a speed on/off. D-pad up/down = +/- 100 RPM, right/left = +/- 25 RPM.
RB / LB = F gain +2% / -2%. Feed a piece by hand: it shows the recovery time.
X = the wheel spins the wrong way: reverse it (for both steps; adds .reversed())
BACK = choose another motor
Help: GUIDE (or hold START 1 s) = a help page with every button; everything pauses.
KEEP HANDS AND LOOSE CLOTHING AWAY from the wheel; wear eye protection.
In your TeamCode: @TeleOp(name = "Flywheel Finder", group = "Finders")
public class FlywheelFinder extends FlywheelFinderOpMode { }. If the encoder is not on the
motor's own shaft at 28 counts per turn, override countsPerRev().
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 doubleThe longest full-power run in step 1, seconds.static 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 doubleEncoder counts per ONE turn of the flywheel.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).protected voidpause()Stops what moves, while the help page is open (the finder's buttons pause then).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, 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
-
MAX_TOP_SPEED_SEC
public static final double MAX_TOP_SPEED_SECThe longest full-power run in step 1, seconds.- See Also:
-
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
-
FlywheelFinderOpMode
public FlywheelFinderOpMode()
-
-
Method Details
-
countsPerRev
protected double countsPerRev()Encoder counts per ONE turn of the flywheel. Default 28: a goBILDA or REV motor's own encoder, with the wheel on the motor shaft (1:1). Geared? Multiply by the gear ratio. -
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
-
pause
protected void pause()Description copied from class:FinderOpModeStops what moves, while the help page is open (the finder's buttons pause then). Default:FinderOpMode.stopAll(). A finder overrides it when stopAll() also closes something (a camera) that must keep working.- Overrides:
pausein 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()
-