Package com.crossbotics.ftchelper.robot
Class FeedTimeTest
java.lang.Object
com.crossbotics.ftchelper.robot.FeedTimeTest
A test shot for the Feed Time Finder: it spins the wheel, runs the feeder (a CR servo or a motor) at its
power, and measures how long the piece takes to reach the wheel. The feeder stops at the shot, or
at the time limit when no shot comes.
Why: feedSec must be long enough for the piece that starts farthest back. Several test shots,
from every place a piece can sit, give the longest time. Made by Launcher.feedTimeTest(double). Call
update() every loop.
FeedTimeTest test = robot.launcher.feedTimeTest(3.0);
test.spin(true);
// every loop:
test.update();
if (test.isReady() && !test.isBusy() && gamepad1.right_bumper) test.fire();
// after a shot: test.lastSec() (seconds to the shot; NaN = no shot in the time limit)
Docs: docs/tuning/07-feed-time-finder.md-
Method Summary
Modifier and TypeMethodDescriptionThe feeder's Tunables section name (for the line to copy), or "" when it does nothing.doubleTunablesfeedSecnow, seconds (NaN when it does nothing).voidfire()booleanisBusy()True while a test feed runs.booleanisReady()True when the wheel is on and at speed: a test shot may go.booleanTrue while the wheel is on.lastEnd()How the last test shot ended: "shot seen", "time limit", "stopped" (the wheel went off), or "" before the first one.doublelastSec()The last test shot's time from the start of the feed to the shot, seconds.doublelimitSec()The time limit of one test feed, seconds.doublerpmNow()The wheel's speed now, RPM.voidspin(boolean on) Spins the wheel up to the launcher's shot speed (speedRpm), or stops it.booleanTrue when the feeder hasstopOnShot = true(each feed ends at the shot; feedSec is the limit).doubleThe speed it spins to: the launcher'sspeedRpm, RPM.voidupdate()Runs the wheel, and ends a test feed at the shot or the time limit.booleanworks()True when this test can run (a launcher with a timed feeder, on the robot).
-
Method Details
-
works
public boolean works()True when this test can run (a launcher with a timed feeder, on the robot). -
spin
public void spin(boolean on) Spins the wheel up to the launcher's shot speed (speedRpm), or stops it.- Parameters:
on- true = spin up, false = stop (a test feed going on stops too)
-
isSpinning
public boolean isSpinning()True while the wheel is on. -
isReady
public boolean isReady()True when the wheel is on and at speed: a test shot may go. -
rpmNow
public double rpmNow()The wheel's speed now, RPM. -
targetRpm
public double targetRpm()The speed it spins to: the launcher'sspeedRpm, RPM. -
limitSec
public double limitSec()The time limit of one test feed, seconds. -
isBusy
public boolean isBusy()True while a test feed runs. -
fire
public void fire() -
update
public void update()Runs the wheel, and ends a test feed at the shot or the time limit. Call it every loop. -
lastSec
public double lastSec()The last test shot's time from the start of the feed to the shot, seconds. NaN = no shot seen, or none yet. -
lastEnd
How the last test shot ended: "shot seen", "time limit", "stopped" (the wheel went off), or "" before the first one. -
feederSection
The feeder's Tunables section name (for the line to copy), or "" when it does nothing. -
feedSecNow
public double feedSecNow()TunablesfeedSecnow, seconds (NaN when it does nothing). -
stopsOnShot
public boolean stopsOnShot()True when the feeder hasstopOnShot = true(each feed ends at the shot; feedSec is the limit).
-