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 coordinates
compensatedDistanceMeters - effective distance from the launcher to the compensated target, used for RPM lookup
timeOfFlightSeconds - solved time of flight at the compensated distance
convergenceIterations - 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 Details

    • ShotSolution

      public ShotSolution(edu.wpi.first.math.geometry.Translation2d compensatedTargetPosition, double compensatedDistanceMeters, double timeOfFlightSeconds, int convergenceIterations, boolean sotmActive)
      Creates an instance of a ShotSolution record class.
      Parameters:
      compensatedTargetPosition - the value for the compensatedTargetPosition record component
      compensatedDistanceMeters - the value for the compensatedDistanceMeters record component
      timeOfFlightSeconds - the value for the timeOfFlightSeconds record component
      convergenceIterations - the value for the convergenceIterations record component
      sotmActive - the value for the sotmActive record 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

      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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • compensatedTargetPosition

      public edu.wpi.first.math.geometry.Translation2d compensatedTargetPosition()
      Returns the value of the compensatedTargetPosition record component.
      Returns:
      the value of the compensatedTargetPosition record component
    • compensatedDistanceMeters

      public double compensatedDistanceMeters()
      Returns the value of the compensatedDistanceMeters record component.
      Returns:
      the value of the compensatedDistanceMeters record component
    • timeOfFlightSeconds

      public double timeOfFlightSeconds()
      Returns the value of the timeOfFlightSeconds record component.
      Returns:
      the value of the timeOfFlightSeconds record component
    • convergenceIterations

      public int convergenceIterations()
      Returns the value of the convergenceIterations record component.
      Returns:
      the value of the convergenceIterations record component
    • sotmActive

      public boolean sotmActive()
      Returns the value of the sotmActive record component.
      Returns:
      the value of the sotmActive record component