Package com.crossbotics.ftchelper.robot
Class FeedTest
java.lang.Object
com.crossbotics.ftchelper.robot.FeedTest
A test shot for the Feed Stop Finder: it spins the wheel, opens the feed stop like a real shot (the
indexer and the pushing parts too), and measures how long the piece takes to reach the wheel. It also
counts the wheel's speed drops, so it sees when two pieces went through in one opening.
Made by Launcher.feedTest(double, double, double, double). Call update() every loop.
FeedTest test = robot.launcher.feedTest(0.150, 0.550, 0.20, 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), test.lastPieces() (1 is right)
Docs: docs/tuning/07-feed-stop-finder.md, "Find the firing times"-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleAfter the feed, it watches this much longer than the stop takes to close, for a second piece. -
Method Summary
Modifier and TypeMethodDescriptionvoidfire()booleanisBusy()True while a test shot is on its way, or it still watches for a second piece.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", "backup time", or "" before the first one.intHow many speed drops (pieces) the last test shot made: 1 is right, 2 or more = pieces slipped through.doublelastSec()The last test shot's time to the shot, seconds, counted the same way asfeedStopOpenSec.doublerpmNow()The wheel's speed now, RPM.voidspin(boolean on) Spins the wheel up to the launcher's shot speed (speedRpm), or stops it.doubleThe speed it spins to: the launcher'sspeedRpm, RPM.voidupdate()Runs the wheel, the feed stop, the indexer and the pushing parts.
-
Field Details
-
WATCH_AFTER_SEC
public static final double WATCH_AFTER_SECAfter the feed, it watches this much longer than the stop takes to close, for a second piece.- See Also:
-
-
Method Details
-
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 shot on its way is cancelled and the stop holds)
-
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. -
isBusy
public boolean isBusy()True while a test shot is on its way, or it still watches for a second piece. -
fire
public void fire() -
update
public void update()Runs the wheel, the feed stop, the indexer and the pushing parts. Call it every loop. -
lastSec
public double lastSec()The last test shot's time to the shot, seconds, counted the same way asfeedStopOpenSec. NaN when the wheel saw no shot, or before the first test shot. -
lastEnd
How the last test shot ended: "shot seen", "backup time", or "" before the first one. -
lastPieces
public int lastPieces()How many speed drops (pieces) the last test shot made: 1 is right, 2 or more = pieces slipped through.
-