Class EliteShooterMath

java.lang.Object
com.marslib.util.EliteShooterMath

public class EliteShooterMath extends Object
Advanced Shot-On-The-Move mathematical solver ingested from Team 254 (2024). This utility calculates exact trajectory kinematics, solving the quadratic equation for time-of-flight while applying gravity and lift compensation.

Reference: Kinematics and Projectile Motion Equations are derived from "Classical Mechanics" (John R. Taylor) Section 2.4 - Projectile Motion with Air Resistance and adapted for FRC by Team 254 (2024 Whitepaper: "Hitting the Target on the Fly").

  • Constructor Details

    • EliteShooterMath

      public EliteShooterMath()
  • Method Details

    • calculateShotOnTheMove

      public static EliteShooterMath.EliteShooterSetpoint calculateShotOnTheMove(edu.wpi.first.math.geometry.Pose2d robotPose, edu.wpi.first.math.kinematics.ChassisSpeeds fieldRelativeSpeeds, edu.wpi.first.math.geometry.Translation3d targetTranslation, double releaseHeightZ, double nominalShotSpeedMetersPerSec, double gravity, double liftCoefficient, EliteShooterMath.EliteShooterSetpoint setpoint)
      Mathematically solves the exact shot state needed to hit a 3D target given current robot speeds and constraints.
      Parameters:
      robotPose - Current field-relative robot pose
      fieldRelativeSpeeds - Current field-relative speeds of the chassis
      targetTranslation - Exact 3D field coordinates of the target
      releaseHeightZ - Height of the robot's shooter mechanism from the floor
      nominalShotSpeedMetersPerSec - Base shot velocity output limit
      gravity - Gravity constant (typically -9.81)
      liftCoefficient - Aerodynamic Magnus lift coefficient (1/m). Relates lift acceleration to velocity squared: a_lift = liftCoefficient × v². Typical values: 0.05–0.15 for FRC game pieces. Set to 0.0 to disable lift compensation.
      setpoint - Reference to a pre-allocated EliteShooterSetpoint to mutate and return
      Returns:
      The same setpoint instance populated with computed values