Class ShotTable
java.lang.Object
com.crossbotics.ftchelper.launcher.ShotTable
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 ClassesModifier and TypeClassDescriptionstatic final classOne shot setting: atdistance(inches), spin torpmwith the hood athoodDegdegrees. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(double distance, double rpm) Adds a point with no hood angle (its hood number is 0 and means nothing).add(double distance, double rpm, double hoodDeg) Adds a measured point (distance in inches, RPM, hood in degrees).booleancovers(double distance) True if the distance is inside the tested range.booleanhasHood()True if any point was added with a hood angle (add(distance, rpm, hoodDeg)).lookup(double distance) The shot for a distance (inches).points()The points, sorted by distance.
-
Constructor Details
-
ShotTable
public ShotTable()
-
-
Method Details
-
add
Adds a measured point (distance in inches, RPM, hood in degrees). Order does not matter. A table with hood angles moves the launcher's hood (hasHood()). -
add
Adds a point with no hood angle (its hood number is 0 and means nothing). A table made only of these never moves a hood: the hood stays where you put it. -
hasHood
public boolean hasHood()True if any point was added with a hood angle (add(distance, rpm, hoodDeg)). Only then doesLauncher.setDistance(double)move the hood. -
lookup
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
The points, sorted by distance. The list cannot be changed (use add(...) instead).
-