Class UnitTelemetry

java.lang.Object
org.wpilib.internal.UnitTelemetry

public final class UnitTelemetry extends Object
Utility functions for logging unit-bearing values to telemetry.
  • Method Details

    • getUnitMetadata

      public static String getUnitMetadata(Unit unit)
      Returns JSON-encoded unit metadata for the given unit.

      The returned string is suitable for use as the unit telemetry property value.

      Parameters:
      unit - unit
      Returns:
      JSON-encoded unit metadata
    • getUnitMetadata

      public static String getUnitMetadata(String unitSymbol)
      Returns JSON-encoded unit metadata for the given unit symbol.

      The returned string is suitable for use as the unit telemetry property value.

      Parameters:
      unitSymbol - unit symbol
      Returns:
      JSON-encoded unit metadata
    • log

      public static void log(TelemetryTable table, String name, Measure<?> value)
      Logs a measure with unit metadata.

      This logs the measure in terms of its base unit.

      Parameters:
      table - telemetry table
      name - entry name
      value - measure value
    • log

      public static void log(TelemetryTable table, String name, double value, Unit unit)
      Logs a double value with unit metadata.

      This logs the value in terms of the given unit's base unit.

      Parameters:
      table - telemetry table
      name - entry name
      value - value in the given unit
      unit - value unit
    • log

      public static void log(TelemetryTable table, String name, double value, String unitSymbol)
      Logs a double value with unit metadata.
      Parameters:
      table - telemetry table
      name - entry name
      value - value in the given unit
      unitSymbol - unit symbol
    • log

      public static void log(TelemetryTable table, String name, int value, Unit unit)
      Logs an int value with unit metadata.

      This logs the value in terms of the given unit's base unit.

      Parameters:
      table - telemetry table
      name - entry name
      value - value in the given unit
      unit - value unit
    • log

      public static void log(TelemetryTable table, String name, long value, Unit unit)
      Logs a long value with unit metadata.

      This logs the value in terms of the given unit's base unit.

      Parameters:
      table - telemetry table
      name - entry name
      value - value in the given unit
      unit - value unit