Interface Gate

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Gate
One rejection rule in a source's gate chain.

Gates are per source type, not universal: AprilTag sources declare the 2026 tag-flip, tilt, height and spin gates; QuestNav declares tracking-loss, jump and time-since-reset gates. Every gate has a name, and a rejection is recorded under that name. A log then says why a frame was thrown out, not just that it was. The 2026 Vision.java did this too.

  • Method Details

    • check

      String check(PoseObservation observation, GateContext context)
      Checks one observation.
      Parameters:
      observation - the measurement under test
      context - robot state at gating time
      Returns:
      null to pass, or the rejection reason (a short, stable string: it becomes a log value that analysis groups by)
    • rejectIf

      static Gate rejectIf(String reason, BiPredicate<PoseObservation, GateContext> rejectIf)
      A named gate: returns reason whenever rejectIf is true.
      Parameters:
      reason - the rejection reason to log
      rejectIf - predicate that is true for observations to reject
      Returns:
      the gate