Package frc.rebuilt
Class ShotCalculator
java.lang.Object
frc.rebuilt.ShotCalculator
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordImmutable snapshot of all quantities needed to command the drive, hood, and flywheel subsystems for a single shot. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic doublestatic doublestatic final doublestatic final double -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the cached parameters so they are recomputed on the next call togetParameters().static Commandstatic Commandstatic ShotCalculatorReturns the current shooting parameters, computing them from the robot's live pose and velocity if not already cached this loop.static Commandstatic Command
-
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
-
increaseHoodAngleOffset
-
decreaseHoodAngleOffset
-
increaseDriveAngleOffset
-
decreaseDriveAngleOffset
-
getParameters
Returns the current shooting parameters, computing them from the robot's live pose and velocity if not already cached this loop.Approach:
- Apply a phase delay to the odometry pose to account for sensor latency.
- Compute the launcher's field-relative velocity, including the tangential component from robot rotation about its centre.
- Decompose that velocity into radial (toward target) and tangential (perpendicular) components.
- Run the 1690 Orbit iterative virtual-target solver to determine the optimal exit speed, launch angle, and yaw correction for shoot-on-the-move.
- 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 togetParameters().
-