Class VisionTelemetryConfig

java.lang.Object
yall.telemetry.VisionTelemetryConfig

public class VisionTelemetryConfig extends Object
What a camera publishes to NetworkTables and logs to a WPILib DataLog, and where.
new VisionCameraConfig()
    .withTelemetry(new VisionTelemetryConfig()
        .withVerbosity(TelemetryVerbosity.LOW)
        .withField(VisionTelemetryField.FILTER_STATS, true)
        .withDataLog());

By default a camera publishes every TelemetryVerbosity.MID field to NetworkTables under YALL/<camera name>, and logs nothing to a DataLog. withDataLog() logs the same fields to DataLogManager's log, and withNetworkTables(boolean) turns NetworkTables off, such as at competition.

  • Constructor Details

    • VisionTelemetryConfig

      public VisionTelemetryConfig()
      Creates a config that publishes every TelemetryVerbosity.MID field.
  • Method Details

    • withVerbosity

      public VisionTelemetryConfig withVerbosity(TelemetryVerbosity verbosity)
      Sets how much to publish. Fields turned on or off with withField(VisionTelemetryField, boolean) keep their setting.
      Parameters:
      verbosity - The verbosity.
      Returns:
      This config, for chaining.
    • withField

      public VisionTelemetryConfig withField(VisionTelemetryField field, boolean enabled)
      Turns one field on or off, whatever the verbosity.
      Parameters:
      field - The field.
      enabled - true to publish it.
      Returns:
      This config, for chaining.
    • withTablePath

      public VisionTelemetryConfig withTablePath(String path)
      Sets the NetworkTables table to publish under, such as "Vision/front". Defaults to YALL/<camera name>.
      Parameters:
      path - Table path, with / between tables.
      Returns:
      This config, for chaining.
    • withNetworkTables

      public VisionTelemetryConfig withNetworkTables(boolean enabled)
      Sets whether to publish to NetworkTables. Defaults to true. With it off, a camera's fields only go to the DataLog, if withDataLog() is on, and stats/reset isn't available.
      Parameters:
      enabled - true to publish to NetworkTables.
      Returns:
      This config, for chaining.
    • withDataLog

      public VisionTelemetryConfig withDataLog()
      Logs the enabled fields to DataLogManager's log, under the same path as NetworkTables (YALL/<camera name> unless withTablePath(String) changes it). Each value is logged when it changes.

      DataLogManager also logs NetworkTables by default, under NT:/. To log each value once, turn one of them off: withNetworkTables(boolean) here, or DataLogManager.logNetworkTables(false).

      Returns:
      This config, for chaining.
    • withDataLog

      public VisionTelemetryConfig withDataLog(String path)
      Logs the enabled fields to DataLogManager's log under a path of its own, such as "Vision/front". See withDataLog().
      Parameters:
      path - Log entry path, with / between names.
      Returns:
      This config, for chaining.
    • isNetworkTablesEnabled

      public boolean isNetworkTablesEnabled()
      Whether to publish to NetworkTables.
      Returns:
      true to publish to NetworkTables.
    • getDataLogPath

      public Optional<String> getDataLogPath(String cameraName)
      The path to log under, if logging to a DataLog.
      Parameters:
      cameraName - The camera's name, for the default path.
      Returns:
      The log path, or empty if not logging to a DataLog.
    • getVerbosity

      public TelemetryVerbosity getVerbosity()
      How much to publish.
      Returns:
      The verbosity.
    • isEnabled

      public boolean isEnabled(VisionTelemetryField field)
      Whether a field is published.
      Parameters:
      field - The field.
      Returns:
      true if it is turned on, or is at or below the verbosity and not turned off.
    • getTablePath

      public String getTablePath(String cameraName)
      The table to publish under.
      Parameters:
      cameraName - The camera's name, for the default path.
      Returns:
      The table path.