Class ShotData
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRepresents a single data point mapping a target distance to shooter parameters.static final recordEncapsulates the computed shooter parameters for a single shot instance. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic ShotData.ShotEntry[]Manually acquired shot data entries used to seed the interpolation tables.static final MulAdd<ShotData.ShotEntry>Defines addition and scalar multiplication overShotData.ShotEntryobjects, enabling weighted interpolation between entries.static final SemiGriddedBilinearInterpolation<ShotData.ShotEntry>Interpolation function for ground passing.static final DistanceThe vertical distance from the shooter to the hub target center point.static final SemiGriddedBilinearInterpolation<ShotData.ShotEntry>Interpolation function for hub shooting.static final SemiGriddedBilinearInterpolation<ShotData.ShotEntry>Interpolation function for simulation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ShotData.ShotParametersgetPassParameters(double distance, double currentFlywheelSpeed, boolean log) Computes shooter parameters for a ground pass given the current robot state.static ShotData.ShotParametersgetShotParameters(double distance, double currentFlywheelSpeed, boolean log) Computes shooter parameters for a hub shot given the current robot state.
-
Field Details
-
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
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
Defines addition and scalar multiplication overShotData.ShotEntryobjects, enabling weighted interpolation between entries. -
shootFunc
Interpolation function for hub shooting. Interpolates over hub-targetedShotData.ShotEntrydata keyed by flywheel speed and distance. -
passFunc
Interpolation function for ground passing. Interpolates over ground-passShotData.ShotEntrydata keyed by flywheel speed and distance. -
simFunc
Interpolation function for simulation. Uses the same ground-pass entries aspassFunc.
-
-
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 meterscurrentFlywheelSpeed- current flywheel speed in rotations per secondlog- iftrue, logs all parameters via AdvantageKit- Returns:
- computed
ShotData.ShotParametersfor 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 usespassFuncfor interpolation, targeting ground-pass trajectories.- Parameters:
distance- distance to the pass target in meterscurrentFlywheelSpeed- current flywheel speed in rotations per secondlog- iftrue, logs all parameters via AdvantageKit- Returns:
- computed
ShotData.ShotParametersfor this pass
-