Package frc.robot.shotdata
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 Summary
ConstructorsConstructorDescriptionShotEntry(double distanceFeet, double flywheelSpeed, double hoodAngleDeg, double tof) Convenience constructor using raw primitive values.ShotEntry(Distance targetDistance, AngularVelocity flywheelSpeed, Angle exitAngle, LinearVelocity exitVelocity, Time tof) Creates an instance of aShotEntryrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoublebackspin()Estimates the backspin applied to the ball based on the current hood angle and flywheel speed, using a generated lookup table.Back-calculates the ball exit velocity from the recorded time of flight and exit angle, without relying on physics modeling.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theexitAnglerecord component.Returns the value of theexitVelocityrecord component.Returns the value of theflywheelSpeedrecord component.final inthashCode()Returns a hash code value for this object.Converts the stored exit angle back to a hood angle in degrees, reversing the offset applied during construction.Computes the ball exit velocity assuming no slip between the flywheel and the ball (i.e.Scales the no-slip exit velocity by a pre-calculated speed transfer coefficient to account for energy losses during ball compression and release.Returns the value of thetargetDistancerecord component.Computes the theoretically required ball exit velocity using projectile motion, accounting for the height difference between the shooter and the hub target.Computes the theoretical time of flight using the exit angle andtheoreticalExitVelocity().tof()Returns the value of thetofrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ShotEntry
public ShotEntry(double distanceFeet, double flywheelSpeed, double hoodAngleDeg, double tof) Convenience constructor using raw primitive values.- Parameters:
distanceFeet- target distance in feetflywheelSpeed- flywheel speed in rotations per secondhoodAngleDeg- 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 aShotEntryrecord class.- Parameters:
targetDistance- the value for thetargetDistancerecord componentflywheelSpeed- the value for theflywheelSpeedrecord componentexitAngle- the value for theexitAnglerecord componentexitVelocity- the value for theexitVelocityrecord componenttof- the value for thetofrecord 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
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
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
Computes the theoretical time of flight using the exit angle andtheoreticalExitVelocity().- Returns:
- theoretical time of flight in seconds
-
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
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
Converts the stored exit angle back to a hood angle in degrees, reversing the offset applied during construction.- Returns:
- hood angle in degrees
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
targetDistance
Returns the value of thetargetDistancerecord component.- Returns:
- the value of the
targetDistancerecord component
-
flywheelSpeed
Returns the value of theflywheelSpeedrecord component.- Returns:
- the value of the
flywheelSpeedrecord component
-
exitAngle
Returns the value of theexitAnglerecord component.- Returns:
- the value of the
exitAnglerecord component
-
exitVelocity
Returns the value of theexitVelocityrecord component.- Returns:
- the value of the
exitVelocityrecord component
-
tof
Returns the value of thetofrecord component.- Returns:
- the value of the
tofrecord component
-