Package frc.robot.shared.targeting
Record Class ShootOnTheMoveCalculator.ShotSolution
java.lang.Object
java.lang.Record
frc.robot.shared.targeting.ShootOnTheMoveCalculator.ShotSolution
- Record Components:
compensatedTargetPosition- virtual target position the turret should aim at in field coordinatescompensatedDistanceMeters- effective distance from the launcher to the compensated target, used for RPM lookuptimeOfFlightSeconds- solved time of flight at the compensated distanceconvergenceIterations- number of Newton iterations used (should be 1-3 for typical scenarios)sotmActive- true when translational compensation was applied; false when the robot was nearly stationary
- Enclosing class:
- ShootOnTheMoveCalculator
public static record ShootOnTheMoveCalculator.ShotSolution(edu.wpi.first.math.geometry.Translation2d compensatedTargetPosition, double compensatedDistanceMeters, double timeOfFlightSeconds, int convergenceIterations, boolean sotmActive)
extends Record
Immutable result of the SOTM solve. Contains the compensated aim point, effective distance for RPM lookup, the solved time of flight, and
diagnostics.
-
Constructor Summary
ConstructorsConstructorDescriptionShotSolution(edu.wpi.first.math.geometry.Translation2d compensatedTargetPosition, double compensatedDistanceMeters, double timeOfFlightSeconds, int convergenceIterations, boolean sotmActive) Creates an instance of aShotSolutionrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the value of thecompensatedDistanceMetersrecord component.edu.wpi.first.math.geometry.Translation2dReturns the value of thecompensatedTargetPositionrecord component.intReturns the value of theconvergenceIterationsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns the value of thesotmActiverecord component.staticSolution(edu.wpi.first.math.geometry.Translation2d target, double distanceMeters, double tofSeconds) Construct a static (no-SOTM) solution from raw values.doubleReturns the value of thetimeOfFlightSecondsrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ShotSolution
public ShotSolution(edu.wpi.first.math.geometry.Translation2d compensatedTargetPosition, double compensatedDistanceMeters, double timeOfFlightSeconds, int convergenceIterations, boolean sotmActive) Creates an instance of aShotSolutionrecord class.- Parameters:
compensatedTargetPosition- the value for thecompensatedTargetPositionrecord componentcompensatedDistanceMeters- the value for thecompensatedDistanceMetersrecord componenttimeOfFlightSeconds- the value for thetimeOfFlightSecondsrecord componentconvergenceIterations- the value for theconvergenceIterationsrecord componentsotmActive- the value for thesotmActiverecord component
-
-
Method Details
-
staticSolution
public static ShootOnTheMoveCalculator.ShotSolution staticSolution(edu.wpi.first.math.geometry.Translation2d target, double distanceMeters, double tofSeconds) Construct a static (no-SOTM) solution from raw values. -
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
compensatedTargetPosition
public edu.wpi.first.math.geometry.Translation2d compensatedTargetPosition()Returns the value of thecompensatedTargetPositionrecord component.- Returns:
- the value of the
compensatedTargetPositionrecord component
-
compensatedDistanceMeters
public double compensatedDistanceMeters()Returns the value of thecompensatedDistanceMetersrecord component.- Returns:
- the value of the
compensatedDistanceMetersrecord component
-
timeOfFlightSeconds
public double timeOfFlightSeconds()Returns the value of thetimeOfFlightSecondsrecord component.- Returns:
- the value of the
timeOfFlightSecondsrecord component
-
convergenceIterations
public int convergenceIterations()Returns the value of theconvergenceIterationsrecord component.- Returns:
- the value of the
convergenceIterationsrecord component
-
sotmActive
public boolean sotmActive()Returns the value of thesotmActiverecord component.- Returns:
- the value of the
sotmActiverecord component
-