Class FeedTest

java.lang.Object
com.crossbotics.ftchelper.robot.FeedTest

public final class FeedTest extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    static final double
    After the feed, it watches this much longer than the stop takes to close, for a second piece.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Fires one test piece: only when isReady() and not isBusy(); else it does nothing.
    boolean
    True while a test shot is on its way, or it still watches for a second piece.
    boolean
    True when the wheel is on and at speed: a test shot may go.
    boolean
    True while the wheel is on.
    How the last test shot ended: "shot seen", "backup time", or "" before the first one.
    int
    How many speed drops (pieces) the last test shot made: 1 is right, 2 or more = pieces slipped through.
    double
    The last test shot's time to the shot, seconds, counted the same way as feedStopOpenSec.
    double
    The wheel's speed now, RPM.
    void
    spin(boolean on)
    Spins the wheel up to the launcher's shot speed (speedRpm), or stops it.
    double
    The speed it spins to: the launcher's speedRpm, RPM.
    void
    Runs the wheel, the feed stop, the indexer and the pushing parts.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • WATCH_AFTER_SEC

      public static final double WATCH_AFTER_SEC
      After 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's speedRpm, 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()
      Fires one test piece: only when isReady() and not isBusy(); else it does nothing.
    • 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 as feedStopOpenSec. NaN when the wheel saw no shot, or before the first test shot.
    • lastEnd

      public String 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.