Skip to content
Work in progress. This library and its docs are new and still changing, and some parts are not yet tested on a real robot. If something is wrong or unclear,tell us with a short GitHub form.

Flywheel Finder: gains and recovery

Find the gains that hold a flywheel at its speed, and how fast it recovers after a shot.

In Tune and check: yes, when the robot has a launcher (or there is no Robot.java). You need: safety glasses, nobody in the line of fire, a charged battery.

  1. On the Driver Hub, open the TeleOp list and pick Tune and check (group “Finders”). Press INIT.

    The Driver Hub’s TeleOp list with Tune and check under Finders, then press INIT

  2. The menu shows. Press D-pad down until the arrow (>) is on Flywheel Finder, then press A.

    The Tune and check menu with the arrow on Flywheel Finder: press D-pad, then A

  3. The Flywheel Finder’s INIT screen shows. Nothing moves yet. Put your safety glasses on, then press ▶ (start) on the Driver Hub.

    The Flywheel Finder’s INIT screen: Hands away from the wheel. Eye protection on. Press start

  4. The arrow starts on the flywheel motor: the launcher’s motor in Robot.java (from Tune and check), else a name with “fly”, “launch” or “shoot” in it. Check the name, then press A. Another motor: press D-pad up/down first. The names come from the robot configuration.

    Choose the flywheel motor: the arrow on launcher, then press A

From Tune and check, when your launcher’s part of Tunables.java has kP, kI and kF, the finder holds the wheel with those gains (and their battery compensation). The Gains line shows them: Gains : Tunables.java (kP 10.00, kI 0.000, kF 14.68, for 13.0 V).

  • Step 1 is not needed: press B at once (step 2), set your shot speed, and fine-tune F with RB / LB.
  • The Tunables.Launcher line keeps your kP, kI and kD, with the new kF. Copy only that line.
  • After step 1, Y switches to the finder’s own gains (from the top speed) and back. The F you fine-tuned on each stays.

Why: F does most of the work, and it fits only the kP and kI it was tuned with. With the finder’s own kI, a small F error is hidden while the wheel is held, then shows up in a match with your kI. Tuned with your own gains, F is right for the robot as it is.

  1. After you choose the motor, let go of A, then hold A again: the wheel runs at full power until the speed stops rising. The finder works out the gains from the top speed. From Tune and check, the motor starts in the direction Robot.java gives it: with .reversed() on the launcher, the screen shows Direction : reversed, as in Robot.java. When the wheel spins the wrong way, let go, press X (reverse), and try again. Then the results tell you to add or remove .reversed() in Robot.java.

    Why the direction matters: a wheel that spins backward pushes the piece back. The piece jams on the wheel, and the wheel stops when the piece touches it.

    Still speeding up at 5 s: full power stops after 5 s, for safety. A heavy wheel (a wheel with added weight) can still speed up then, so its real top speed is higher than the one shown. Extra weight does not lower the top speed much, but it makes the wheel take longer to get there. Because the finder works out F from the top speed, F is then a little high. Check that the wheel turns freely by hand, with no rubbing. Then fine-tune F in step 2 (step 3 below): the error must stay near 0 at your shot speed.

    Let go of A, then hold A: the Driver Hub shows Top speed : 5600 RPM

  2. Press B: the finder holds a speed (60% of the top, or 3000 RPM before step 1). Change it with the D-pad to the speed you shoot at.

    Press B: the Driver Hub shows Target : 3350 RPM and Error : 40 RPM

  3. When the measured speed stays below the target at every speed, press RB (more F). When it stays above, press LB.

    When it stays too slow, press RB: the Driver Hub shows F gain : 12.79 and Error : 5 RPM

  4. Feed one piece with the robot’s own feeder, or push it in with a stick. Never use your fingers: they would be next to a wheel at full speed. Put safety glasses on. The screen shows the recovery time (on the robot only, because the simulator has no piece to feed). Use it for the launcher’s shotInterval(...): make that a little longer than the recovery time.

  5. Check that the robot sees each shot (for stopOnShot). Set the target to your shot speed with the D-pad. Feed 10 pieces, one at a time. Wait for “Ready: YES” before each. Read two lines:

    • “Shots seen”: the drops of more than 150 RPM (the default shotDropRpm).
    • “Shot drop”: every drop, also the ones under 150. It shows the last drop, the smallest drop and how many drops it saw.

    “Shots seen” shows 10: the default is good. It shows fewer: set shotDropRpm in Tunables.Launcher to about half the smallest shot drop. Keep it more than readyBandRpm. Then fire with no piece in TeleOp: the feed must run its full feedSec. The finder always counts with 150, not with your shotDropRpm.

  6. Five files: copy the Tunables.Launcher: kP = ..., kI = ..., kD = 0, kF = ..., nominalVolts = ... line into Tunables.Launcher (the section is the motor’s name). A slow recovery adds shotIntervalSec. nominalVolts is the battery voltage at which the finder found the gains. The launcher’s battery compensation uses it, so a low battery spins the wheel back up as fast. The compensation is off unless you write batteryCompensation = true. The RB/LB F changes are only on the screen: copy the line (with the F you ended on) into Tunables.java.

  • The finder saves no positions, so there is nothing to undo. Each button changes one setting, and you can change it back. X again turns the reverse off, B again stops the held speed, and LB lowers F again after an RB.
  • Chose the wrong motor, or a bad top-speed test: press BACK and choose the motor again. It starts over, with a new top-speed test.

Start over: press STOP, then INIT, and open the tool again. It starts empty: nothing carries over. The lines saved at STOP stay in the results file, the newest at the end.

The robot uses Tunables.java and Robot.java, not the finder’s screen. Take a photo of the screen, and type each line into the file. Or copy it from the results file:

The finder shows Put it in
Tunables.Launcher: kP = ..., kI = ..., kD = 0, kF = ..., nominalVolts = ... Tunables.Launcher (the section is the motor’s name)
the recovery time shotIntervalSec in Tunables.Launcher: a little longer than the recovery time
“Shots seen” fewer than the pieces shotDropRpm in Tunables.Launcher: about half the smallest “Shot drop” (from the screen)

you copied the Tunables.Launcher gains line, and the speed holds the target.


Next: Feed Stop Finder (a launcher with a feed stop), or Feed Time Finder (a CR servo or motor feeder with no feed stop, pushing parts or feed wheel).

Look it up: Launcher: In Tunables.java.

Something wrong on this page? Tell us with a short GitHub form.