Class ShotGate

java.lang.Object
frc.robot.subsystems.ShotGate

public final class ShotGate extends Object
Decides, once per loop, whether fuel may be fed into the flywheel. Pure logic: SuperStructure fills an ShotGate.Inputs from logged inputs (motor inputs, the fused pose, the Driver Station) and applies the ShotGate.Decision, so the whole gate replays and is unit tested.

FM on 2026 main fed the moment a launch state began. This is the offseason bot's feed gate (commits dcb88dc, 067af02, ddd564a) with FM's drivetrain in place of that bot's turret:

  • Start a volley only once the hood is within ShotGate.Tolerances.hoodStartDeg, the heading within the aim tolerance, and the shot inside the model's range, all held for ShotGate.Tolerances.settleSeconds. Flywheel speed is not checked: waiting for it slowed FM's shots.
  • Keep feeding on wider tolerances, so the volley is not chopped between balls. Range is not part of keeping: it comes from the pose, and one bad frame mid-volley would chop the feed.
  • Time out: blocked for ShotGate.Tolerances.timeoutSeconds in a launch state, feed anyway for the rest of that launch, so a stuck sensor or an unreachable target can delay a shot but never stop one. That is also what makes the gate safe in autos.
  • Override: the operator's bypass feeds while it is held.

Leaving the launch state resets everything, so the next volley re-earns the strict window.

  • Field Details

    • HUB_OPENING_RADIUS_METERS

      public static final double HUB_OPENING_RADIUS_METERS
      Half of the hub's 41.7 in inner opening (Field.BlueHub.innerOpeningWidth).
      See Also:
    • FUEL_DIAMETER_METERS

      public static final double FUEL_DIAMETER_METERS
      A fuel ball, 5.91 in (4499 uses 0.15 m).
      See Also:
    • MIN_AIM_TOLERANCE_RAD

      public static final double MIN_AIM_TOLERANCE_RAD
    • MAX_AIM_TOLERANCE_RAD

      public static final double MAX_AIM_TOLERANCE_RAD
    • FEED_AIM_TOLERANCE_RAD

      public static final double FEED_AIM_TOLERANCE_RAD
  • Constructor Details

  • Method Details

    • getTolerances

      public ShotGate.Tolerances getTolerances()
    • aimToleranceRad

      public static double aimToleranceRad(double distanceMeters, boolean feedShot)
      Heading tolerance for a shot: 4499's atan((hubRadius - ballWidth) / distance), the angle at which a ball's edge reaches the rim, for hub shots; a flat 10 deg for feed shots, whose target is a patch of floor (9470 uses 10 deg for feed shots against 2.5 for the hub). Clamped to 2 to 10 deg so a very long shot is not held to an angle the heading PID cannot settle to, and a very close one is not accepted at any heading.
      Parameters:
      distanceMeters - distance to the aim point
      feedShot - a feed (passing) shot rather than a hub shot
      Returns:
      radians
    • update

      public ShotGate.Decision update(ShotGate.Inputs in)
      Advances the gate one loop.
      Parameters:
      in - this loop's view of the shot
      Returns:
      whether to feed, and why