Class ShotData

java.lang.Object
frc.robot.shotdata.ShotData

public class ShotData extends Object
Stores and interpolates shooter parameters for FRC robot shooting mechanics.

Contains manually acquired shot data entries and provides interpolation functions for computing optimal flywheel speed, hood angle, and time of flight for a given target distance and current flywheel speed.

Three interpolation modes are supported:

  • Field Details

    • entries

      public static ShotData.ShotEntry[] entries
      Manually acquired shot data entries used to seed the interpolation tables.

      Each entry specifies a target distance, flywheel speed, hood angle, and time of flight. Time-of-flight values do not need to be precise.

    • shooterToTargetHeightDiff

      public static final Distance shooterToTargetHeightDiff
      The vertical distance from the shooter to the hub target center point.

      Computed as the difference between the hub's top center Z coordinate and the configured shooter height from Constants.

    • mulAdd

      public static final MulAdd<ShotData.ShotEntry> mulAdd
      Defines addition and scalar multiplication over ShotData.ShotEntry objects, enabling weighted interpolation between entries.
    • shootFunc

      public static final SemiGriddedBilinearInterpolation<ShotData.ShotEntry> shootFunc
      Interpolation function for hub shooting. Interpolates over hub-targeted ShotData.ShotEntry data keyed by flywheel speed and distance.
    • passFunc

      Interpolation function for ground passing. Interpolates over ground-pass ShotData.ShotEntry data keyed by flywheel speed and distance.
    • simFunc

      Interpolation function for simulation. Uses the same ground-pass entries as passFunc.
  • Constructor Details

    • ShotData

      public ShotData()
  • Method Details

    • getShotParameters

      public static ShotData.ShotParameters getShotParameters(double distance, double currentFlywheelSpeed, boolean log)
      Computes shooter parameters for a hub shot given the current robot state.

      Interpolates the hood angle and time of flight from the shot table, and looks up the desired flywheel speed.

      Parameters:
      distance - distance to the hub target in meters
      currentFlywheelSpeed - current flywheel speed in rotations per second
      log - if true, logs all parameters via AdvantageKit
      Returns:
      computed ShotData.ShotParameters for this shot
    • getPassParameters

      public static ShotData.ShotParameters getPassParameters(double distance, double currentFlywheelSpeed, boolean log)
      Computes shooter parameters for a ground pass given the current robot state.

      Behaves identically to getShotParameters(double, double, boolean) but uses passFunc for interpolation, targeting ground-pass trajectories.

      Parameters:
      distance - distance to the pass target in meters
      currentFlywheelSpeed - current flywheel speed in rotations per second
      log - if true, logs all parameters via AdvantageKit
      Returns:
      computed ShotData.ShotParameters for this pass