Package frc.rebuilt

Class ShotCalculator

java.lang.Object
frc.rebuilt.ShotCalculator

public class ShotCalculator extends Object
  • Field Details

    • STARTING_HOOD_ANGLE_OFFSET

      public static final double STARTING_HOOD_ANGLE_OFFSET
      See Also:
    • HOOD_ANGLE_OFFSET

      public static double HOOD_ANGLE_OFFSET
    • STARTING_DRIVE_ANGLE_OFFSET

      public static final double STARTING_DRIVE_ANGLE_OFFSET
      See Also:
    • DRIVE_ANGLE_OFFSET

      public static double DRIVE_ANGLE_OFFSET
  • Method Details

    • getInstance

      public static ShotCalculator getInstance()
    • increaseHoodAngleOffset

      public static Command increaseHoodAngleOffset()
    • decreaseHoodAngleOffset

      public static Command decreaseHoodAngleOffset()
    • increaseDriveAngleOffset

      public static Command increaseDriveAngleOffset()
    • decreaseDriveAngleOffset

      public static Command decreaseDriveAngleOffset()
    • getParameters

      public ShotCalculator.ShootingParameters getParameters()
      Returns the current shooting parameters, computing them from the robot's live pose and velocity if not already cached this loop.

      Approach:

      1. Apply a phase delay to the odometry pose to account for sensor latency.
      2. Compute the launcher's field-relative velocity, including the tangential component from robot rotation about its centre.
      3. Decompose that velocity into radial (toward target) and tangential (perpendicular) components.
      4. Run the 1690 Orbit iterative virtual-target solver to determine the optimal exit speed, launch angle, and yaw correction for shoot-on-the-move.
      5. Derive the drive angle, hood angle, and flywheel RPM from the result.

      Call clearShootingParameters() at the start of each loop to allow re-computation on the next call.

      Returns:
      the latest ShotCalculator.ShootingParameters
    • clearShootingParameters

      public void clearShootingParameters()
      Clears the cached parameters so they are recomputed on the next call to getParameters().