Package com.marslib.util
Class EliteShooterMath
java.lang.Object
com.marslib.util.EliteShooterMath
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").
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classData class for holding calculated Elite Shooter parameters. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncalculateShotOnTheMove(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.
-
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 posefieldRelativeSpeeds- Current field-relative speeds of the chassistargetTranslation- Exact 3D field coordinates of the targetreleaseHeightZ- Height of the robot's shooter mechanism from the floornominalShotSpeedMetersPerSec- Base shot velocity output limitgravity- 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
-