Class ShotTable

java.lang.Object
com.crossbotics.ftchelper.launcher.ShotTable

public final class ShotTable extends Object
Turns a distance into a shot: flywheel RPM and hood angle. You measure a few good shots, and it fills in between (straight lines between your points). (Last season's AutoRpmConfig.)

 ShotTable pollen = new ShotTable()
         .add(24, 2600, 8)     // at 24 in: 2600 rpm, hood 8 deg
         .add(48, 3100, 15)
         .add(72, 3700, 21);
 ShotTable.Shot shot = pollen.lookup(36);   // 2850 rpm, 11.5 deg
 

Outside your points it uses the nearest end point (it does not guess beyond what you tested). Make one table per game piece if they fly differently. Docs: docs/modules/launcher.md; tutorial 17 measures a table step by step.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    One shot setting: at distance (inches), spin to rpm with the hood at hoodDeg degrees.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    add(double distance, double rpm)
    Adds a point with no hood.
    add(double distance, double rpm, double hoodDeg)
    Adds a measured point (distance in inches, RPM, hood in degrees).
    boolean
    covers(double distance)
    True if the distance is inside the tested range.
    lookup(double distance)
    The shot for a distance (inches).
    The points, sorted by distance.

    Methods inherited from class java.lang.Object

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

    • ShotTable

      public ShotTable()
  • Method Details

    • add

      public ShotTable add(double distance, double rpm, double hoodDeg)
      Adds a measured point (distance in inches, RPM, hood in degrees). Order does not matter. Hood angle may be 0 if you have no hood.
    • add

      public ShotTable add(double distance, double rpm)
      Adds a point with no hood.
    • lookup

      public ShotTable.Shot lookup(double distance)
      The shot for a distance (inches). Between two measured points it fills in on a straight line; outside them it gives the nearest end point. An unknown distance (NaN, e.g. no target seen) gives the shortest point.
      Throws:
      IllegalStateException - if the table has no points
    • covers

      public boolean covers(double distance)
      True if the distance is inside the tested range.
    • points

      public List<ShotTable.Shot> points()
      The points, sorted by distance. The list cannot be changed (use add(...) instead).