Class OrinGyroSourceIO

java.lang.Object
frc.robot.subsystems.vision.OrinGyroSourceIO
All Implemented Interfaces:
PoseSourceIO

public class OrinGyroSourceIO extends Object implements PoseSourceIO
An Orin camera pose source that uses the robot's heading instead of solving for it. Built on the camera's OrinPoseSourceIO: it reads the results that source already logged and decoded, so it logs nothing new and runs in replay too. Logged and shadowed, not fused, until replay says it can be trusted. Only the newest usable result per loop is solved (CPU).
  • OrinGyroSourceIO.Mode.GYRO_PNP (issue #10, section 3): PhotonLib's constrained SolvePnP over every usable tag with the heading held to the robot's at the frame's timestamp, seeded from the fused pose; one tag falls back to PhotonLib's distance-trig solve. The robot-side answer to the Limelight's MegaTag2, without its "last pushed heading" latency.
  • OrinGyroSourceIO.Mode.TXTY (section 8c, 6328's addTxTyObservation): the closest tag's angles and solved distance, turned into a robot position with the robot's heading. The distance is reliable even when a single-tag pose is ambiguous; 6328 uses this for final alignment.

Both need the heading, so they report nothing until the pose is seeded.

  • Constructor Details

    • OrinGyroSourceIO

      public OrinGyroSourceIO(OrinGyroSourceIO.Mode mode, String cameraName, OrinPoseSourceIO camera, Transform3d robotToCamera, AprilTagFieldLayout layout, Supplier<Set<Integer>> excludedTags, DoubleFunction<Pose2d> fusedPoseAt)
      Parameters:
      mode - which estimate
      cameraName - PhotonVision camera name, for the log path
      camera - the camera's main source, which must update first each loop
      robotToCamera - camera mount
      layout - the field's tags
      excludedTags - tags to leave out
      fusedPoseAt - the fused pose at a capture time, or null before the pose is seeded
  • Method Details

    • derived

      public boolean derived()
      Description copied from interface: PoseSourceIO
      Whether this IO computes its observations from inputs it logs itself, rather than reading a device. A derived IO runs in replay too (over its own replayed inputs), so PoseSource records its observations as outputs instead of restoring them from the log.
      Specified by:
      derived in interface PoseSourceIO
    • updateInputs

      public void updateInputs(PoseSourceInputs inputs)
      Description copied from interface: PoseSourceIO
      Fills inputs with everything reported since the last call.
      Specified by:
      updateInputs in interface PoseSourceIO
      Parameters:
      inputs - the inputs to overwrite