Class VisionLogger

java.lang.Object
frc.spectrumLib.vision.VisionLogger

public class VisionLogger extends Object
Logs telemetry data from a Limelight camera to the robot's data-logging system (DogLog) under the Vision/<name>/ namespace.

Each method reads the corresponding value from the camera, forwards it to Telemetry.log(edu.wpi.first.wpilibj2.command.Command), and also returns the value so callers can use it directly without a second camera query.

  • Constructor Summary

    Constructors
    Constructor
    Description
    VisionLogger(String name, Limelight limelight)
    Constructs a logger for the given Limelight camera.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Logs and returns whether the camera is currently connected.
    boolean
    Logs and returns whether pose measurements are currently being fused into the estimator.
    Logs and returns the camera's human-readable integration status message.
    Logs and returns the robot's 2-D pose from the MegaTag2 (heading-fused) estimate.
    Namespace prefix used in all telemetry keys (Vision/<name>/...).
    Logs and returns the robot's 2-D pose derived from the MegaTag1 estimate.
    double
    Logs and returns the number of AprilTags contributing to the current pose estimate.
    Logs and returns the camera's human-readable tag-detection status message.
    double
    Logs and returns the area of the primary target as a percentage of the camera image.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • VisionLogger

      public VisionLogger(String name, Limelight limelight)
      Constructs a logger for the given Limelight camera.
      Parameters:
      name - the namespace prefix used in telemetry keys
      limelight - the camera to read from
  • Method Details

    • getCameraConnection

      public boolean getCameraConnection()
      Logs and returns whether the camera is currently connected.
      Returns:
      true if the camera is reachable over the network
    • getIntegratingStatus

      public boolean getIntegratingStatus()
      Logs and returns whether pose measurements are currently being fused into the estimator.
      Returns:
      true if the camera is actively integrating
    • getLogStatus

      public String getLogStatus()
      Logs and returns the camera's human-readable integration status message.
      Returns:
      the current log status string from the camera
    • getTagStatus

      public String getTagStatus()
      Logs and returns the camera's human-readable tag-detection status message.
      Returns:
      the current tag status string from the camera
    • getPose

      public Pose2d getPose()
      Logs and returns the robot's 2-D pose derived from the MegaTag1 estimate.
      Returns:
      the MegaTag1 pose projected to 2-D in the WPILib Blue origin frame
    • getMegaPose

      public Pose2d getMegaPose()
      Logs and returns the robot's 2-D pose from the MegaTag2 (heading-fused) estimate.
      Returns:
      the MegaTag2 Pose2d in the WPILib Blue origin frame
    • getTagCount

      public double getTagCount()
      Logs and returns the number of AprilTags contributing to the current pose estimate.
      Returns:
      the tag count from the MegaTag1 estimate
    • getTargetSize

      public double getTargetSize()
      Logs and returns the area of the primary target as a percentage of the camera image.
      Returns:
      target area (0–100 %)
    • getName

      public String getName()
      Namespace prefix used in all telemetry keys (Vision/<name>/...).