Class FeedTimeTest

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

public final class FeedTimeTest extends Object
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 Type
    Method
    Description
    The feeder's Tunables section name (for the line to copy), or "" when it does nothing.
    double
    Tunables feedSec now, seconds (NaN when it does nothing).
    void
    Fires one test piece: only when isReady() and not isBusy(); else it does nothing.
    boolean
    True while a test feed runs.
    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", "time limit", "stopped" (the wheel went off), or "" before the first one.
    double
    The last test shot's time from the start of the feed to the shot, seconds.
    double
    The time limit of one test feed, seconds.
    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.
    boolean
    True when the feeder has stopOnShot = true (each feed ends at the shot; feedSec is the limit).
    double
    The speed it spins to: the launcher's speedRpm, RPM.
    void
    Runs the wheel, and ends a test feed at the shot or the time limit.
    boolean
    True when this test can run (a launcher with a timed feeder, on the robot).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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's speedRpm, 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()
      Fires one test piece: only when isReady() and not isBusy(); else it does nothing.
    • 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

      public String lastEnd()
      How the last test shot ended: "shot seen", "time limit", "stopped" (the wheel went off), or "" before the first one.
    • feederSection

      public String feederSection()
      The feeder's Tunables section name (for the line to copy), or "" when it does nothing.
    • feedSecNow

      public double feedSecNow()
      Tunables feedSec now, seconds (NaN when it does nothing).
    • stopsOnShot

      public boolean stopsOnShot()
      True when the feeder has stopOnShot = true (each feed ends at the shot; feedSec is the limit).