Record Class ShotData.ShotEntry

java.lang.Object
java.lang.Record
frc.robot.shotdata.ShotData.ShotEntry
Enclosing class:
ShotData

public static record ShotData.ShotEntry(Distance targetDistance, AngularVelocity flywheelSpeed, Angle exitAngle, LinearVelocity exitVelocity, Time tof) extends Record
Represents a single data point mapping a target distance to shooter parameters.

Can be constructed either with typed unit measures or with raw primitive values (feet, rotations per second, degrees, seconds) for convenience.

  • Constructor Details

    • ShotEntry

      public ShotEntry(double distanceFeet, double flywheelSpeed, double hoodAngleDeg, double tof)
      Convenience constructor using raw primitive values.
      Parameters:
      distanceFeet - target distance in feet
      flywheelSpeed - flywheel speed in rotations per second
      hoodAngleDeg - hood angle in degrees (converted internally to exit angle)
      tof - time of flight in seconds
    • ShotEntry

      public ShotEntry(Distance targetDistance, AngularVelocity flywheelSpeed, Angle exitAngle, LinearVelocity exitVelocity, Time tof)
      Creates an instance of a ShotEntry record class.
      Parameters:
      targetDistance - the value for the targetDistance record component
      flywheelSpeed - the value for the flywheelSpeed record component
      exitAngle - the value for the exitAngle record component
      exitVelocity - the value for the exitVelocity record component
      tof - the value for the tof record component
  • Method Details

    • backspin

      public double backspin()
      Estimates the backspin applied to the ball based on the current hood angle and flywheel speed, using a generated lookup table.
      Returns:
      estimated backspin value
    • theoreticalExitVelocity

      public LinearVelocity theoreticalExitVelocity()
      Computes the theoretically required ball exit velocity using projectile motion, accounting for the height difference between the shooter and the hub target.
      Returns:
      theoretical exit velocity in meters per second
    • backtracedExitVelocity

      public LinearVelocity backtracedExitVelocity()
      Back-calculates the ball exit velocity from the recorded time of flight and exit angle, without relying on physics modeling.
      Returns:
      back-traced exit velocity in meters per second
    • theoreticalTimeOfFlight

      public Time theoreticalTimeOfFlight()
      Computes the theoretical time of flight using the exit angle and theoreticalExitVelocity().
      Returns:
      theoretical time of flight in seconds
    • noSlipExitVelocity

      public LinearVelocity noSlipExitVelocity()
      Computes the ball exit velocity assuming no slip between the flywheel and the ball (i.e. the ball surface speed equals the wheel surface speed).
      Returns:
      no-slip exit velocity in meters per second
    • speedTransferExitVelocity

      public LinearVelocity speedTransferExitVelocity()
      Scales the no-slip exit velocity by a pre-calculated speed transfer coefficient to account for energy losses during ball compression and release.
      Returns:
      speed-transfer-adjusted exit velocity in meters per second
    • hoodAngle

      public Angle hoodAngle()
      Converts the stored exit angle back to a hood angle in degrees, reversing the offset applied during construction.
      Returns:
      hood angle in degrees
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • targetDistance

      public Distance targetDistance()
      Returns the value of the targetDistance record component.
      Returns:
      the value of the targetDistance record component
    • flywheelSpeed

      public AngularVelocity flywheelSpeed()
      Returns the value of the flywheelSpeed record component.
      Returns:
      the value of the flywheelSpeed record component
    • exitAngle

      public Angle exitAngle()
      Returns the value of the exitAngle record component.
      Returns:
      the value of the exitAngle record component
    • exitVelocity

      public LinearVelocity exitVelocity()
      Returns the value of the exitVelocity record component.
      Returns:
      the value of the exitVelocity record component
    • tof

      public Time tof()
      Returns the value of the tof record component.
      Returns:
      the value of the tof record component