Documentation Index
Fetch the complete documentation index at: https://mintlify.com/robototes/REBUILT2026/llms.txt
Use this file to discover all available pages before exploring further.
LauncherConstants.java defines interpolating lookup tables that map distance-to-target to flywheel speed, hood angle, and time of flight for both the Alpha and Competition bots. At runtime the correct dataset is selected automatically based on RobotType, and all three maps are populated in a static initializer so lookup is allocation-free during the match.
LauncherDistanceDataPoint record
Each row in a distance table is represented by a LauncherDistanceDataPoint object with four fields:
| Field | Type | Unit | Description |
|---|
distance | double | meters | Distance from the launcher to the target |
hoodAngle | double | rotations | Hood angle setpoint at this distance |
flywheelPower | double | RPS | Flywheel velocity setpoint at this distance |
time | double | seconds | Estimated projectile time of flight |
Constructor argument order: (distance, hoodAngle, flywheelPower, time).
Competition bot lookup table
The comp bot table has 12 data points covering 1 m through 8 m. Linear interpolation fills in values between measured points.
| Distance (m) | Hood Angle (rot) | Flywheel (RPS) | Time of Flight (s) |
|---|
| 1.0 | 1.5 | 40 | 1.018 |
| 1.5 | 2.0 | 42 | 1.138 |
| 2.0 | 3.0 | 43 | 1.104 |
| 2.55 | 3.5 | 45 | 1.204 |
| 3.2 | 4.5 | 48 | 1.150 |
| 3.5 | 4.8 | 51 | 1.229 |
| 3.75 | 5.0 | 51.5 | 1.217 |
| 4.2 | 5.125 | 53.5 | 1.275 |
| 4.5 | 5.5 | 58 | 1.305 |
| 5.0 | 5.8 | 60 | 1.349 |
| 5.8 | 6.6 | 64 | 1.378 |
| 8.0 | 9.0 | 90 | 1.530 |
private static final LauncherDistanceDataPoint[] compDistanceData = {
new LauncherDistanceDataPoint(1, 1.5, 40, 1.018),
new LauncherDistanceDataPoint(1.5, 2, 42, 1.138),
new LauncherDistanceDataPoint(2, 3, 43, 1.104),
new LauncherDistanceDataPoint(2.55, 3.5, 45, 1.204),
new LauncherDistanceDataPoint(3.2, 4.5, 48, 1.15),
new LauncherDistanceDataPoint(3.5, 4.8, 51, 1.229),
new LauncherDistanceDataPoint(3.75, 5, 51.5, 1.217),
new LauncherDistanceDataPoint(4.2, 5.125, 53.5, 1.275),
new LauncherDistanceDataPoint(4.5, 5.5, 58, 1.305),
new LauncherDistanceDataPoint(5, 5.8, 60, 1.349),
new LauncherDistanceDataPoint(5.8, 6.6, 64, 1.378),
new LauncherDistanceDataPoint(8, 9, 90, 1.53)
};
Alpha bot lookup table
The alpha bot uses a simpler 4-point table (different hood geometry and gear ratio):
| Distance (m) | Hood Angle (rot) | Flywheel (RPS) | Time of Flight (s) |
|---|
| 1.0 | 0.1 | 55 | 0.7 |
| 2.0 | 0.3 | 59 | 1.3 |
| 3.0 | 0.6 | 65 | 1.6 |
| 4.0 | 1.2 | 71 | 1.9 |
Interpolation
All three lookup dimensions use InterpolatingDoubleTreeMap from WPILib, which performs linear interpolation between adjacent keys. The maps are populated once in a static block at class load time:
private static final InterpolatingDoubleTreeMap flywheelMap = new InterpolatingDoubleTreeMap();
private static final InterpolatingDoubleTreeMap hoodMap = new InterpolatingDoubleTreeMap();
private static final InterpolatingDoubleTreeMap timeMap = new InterpolatingDoubleTreeMap();
static {
LauncherDistanceDataPoint[] distanceData =
RobotType.isAlpha() ? alphaDistanceData : compDistanceData;
for (var point : distanceData) {
flywheelMap.put(point.distance, point.flywheelPower);
hoodMap.put(point.distance, point.hoodAngle);
timeMap.put(point.distance, point.time);
}
}
Distances outside the table’s range clamp to the nearest endpoint (WPILib InterpolatingDoubleTreeMap behavior).
Static lookup methods
| Method | Returns | Description |
|---|
getFlywheelSpeedFromDistance(distance) | double (RPS) | Interpolated flywheel velocity for a given distance |
getHoodAngleFromDistance(distance) | double (rot) | Interpolated hood angle for a given distance |
getTimeFromDistance(distance) | double (s) | Interpolated time of flight for a given distance |
minTimeOfFlight() | double (s) | Minimum time across all data points (used by HubShiftUtil) |
maxTimeOfFlight() | double (s) | Maximum time across all data points (used by HubShiftUtil) |
distToHub() | double (m) | Last computed turret-to-hub distance, floored at 0.1 m |
Moving-shot prediction
Two methods support shooting while the robot is moving by iteratively predicting where the target will be when the projectile arrives.
predictTargetPos(target, fieldSpeeds, timeOfFlight, robot)
Moves the target backwards along the robot’s current velocity vector (translational + rotational component from the launcher offset) by one time-of-flight step:
public static Translation2d predictTargetPos(
Translation2d target, ChassisSpeeds fieldSpeeds, Double timeOfFlight, Pose2d robot) {
Translation2d angularVelocity = angularVelocity(robot, fieldSpeeds);
double vx = fieldSpeeds.vxMetersPerSecond + angularVelocity.getX();
double vy = fieldSpeeds.vyMetersPerSecond + angularVelocity.getY();
double predictedX = target.getX() - vx * timeOfFlight;
double predictedY = target.getY() - vy * timeOfFlight;
return new Translation2d(predictedX, predictedY);
}
iterativeMovingShotFromFunnelClearance(robot, fieldSpeeds, target, iterations)
Runs the prediction loop iterations times. Each pass re-estimates the time of flight from the updated predicted distance, converging toward a self-consistent solution:
- Compute initial distance from launcher to the original target.
- Look up initial time of flight from the distance map.
- For each iteration: predict a new target position from the original target using the current time of flight → recompute distance from launcher to the predicted position → update time of flight.
- Return the final predicted target
Translation2d.
angularVelocity(robot, fieldSpeeds)
Computes the tangent velocity of the launcher mount point due to robot rotation (ω × r), accounting for the launcher’s offset from the robot center of rotation.
Launcher offset (LAUNCHER_OFFSET)
The launcher is not mounted at the robot’s geometric center. LAUNCHER_OFFSET is a Transform2d from the robot pose to the launcher’s exit point:
| Robot | X offset | Y offset |
|---|
| Competition | +0.2159 m (forward) | +0.1397 m (left) |
| Alpha | +0.2159 m (forward) | −0.1397 m (right) |
Use turretTransform() to retrieve the offset as a Transform2d, or launcherFromRobot(robotPose) to get the launcher offset’s Translation2d (the X/Y components of LAUNCHER_OFFSET relative to the robot center — note the current implementation returns the offset vector directly).
NetworkTables telemetry
UpdateNT(Pose2d robot) must be called each loop. It is called from Robot.robotPeriodic() (not from a subsystem periodic) using the current drivebase pose. It publishes two entries under /SmartDashboard/LiveLauncherData/:
| NT Key | Type | Content |
|---|
Turret Pose | Pose2d struct | Robot pose transformed by LAUNCHER_OFFSET |
Turret to hub distance | double | Distance from the turret to the alliance hub (meters) |
To add a new calibration point for the comp bot, append a new LauncherDistanceDataPoint to compDistanceData with measured values from field testing. Keep the array sorted by distance — InterpolatingDoubleTreeMap is a sorted tree, but human readability is easier when the source array is ordered.