Telemetry

A thin wrapper over the FTC SDK's telemetry that collects named entries — many backed by live suppliers — and lets you switch which groups of them are shown on the driver station by tag.

The telemetry package lives in com.cdarobotics.cdalib.telemetry. A TelemetryManager holds a list of Entry objects. Each entry has a label, a value supplier that is re-fetched every time the entry is displayed, and a tag grouping it with related entries. When you call displayTelemetry(), only entries whose tag is in the active display set are pushed to the driver station.

Entry

A single telemetry line: a label paired with a Supplier<String>, grouped under a tag. The value is not stored — it is pulled from the supplier fresh on every display, so an entry always shows the current reading.

MemberSignatureDescription
constructorEntry(String tag, String label, Supplier<String> supplier)Creates an entry in the given group.
constructorEntry(String label, Supplier<String> supplier)Creates an entry in the "default" group.
getLabelString getLabel()Returns the label.
getValueString getValue()Calls the supplier and returns the current value (re-fetched each call).
getTagString getTag()Returns the group tag.
Values are strings and are live. A supplier is invoked at display time, so () -> String.valueOf(motor.getCurrentPosition()) always shows the latest position with no manual refresh. Convert non-string values yourself inside the supplier.

TelemetryManager

Constructed with the OpMode's Telemetry backend, it accumulates entries and tracks which tags are currently displayed.

MethodDescription
TelemetryManager(Telemetry telemetry)Creates a manager that renders entries to the given FTC telemetry backend.
void addEntry(Entry entry)Registers an already-built Entry.
void addEntry(String tag, String label, Supplier<String> supplier)Builds and registers an entry with an explicit group tag.
void addEntry(String label, Supplier<String> supplier)Builds and registers an entry in the "default" group.
void setDisplayTags(String... tags)Adds the given tags to the set of groups shown by displayTelemetry().
void removeDisplayTags(String... tags)Removes the given tags from the displayed set.
void displayTelemetry()Renders every registered entry whose tag is in the active display set (values re-fetched from their suppliers), then calls telemetry.update() to push the batch to the driver station.
How lines are labeled. Each displayed entry is written as [tag] label paired with its value, so you can see at a glance which group a line belongs to on the driver station.
Nothing shows until a tag is active. setDisplayTags is additive and the display set starts empty — including "default". If your entries use the default group, call setDisplayTags("default") once, or nothing will appear. Entries display in tag order: for each active tag, all matching entries are rendered.

Example

Build a manager, register a mix of default and tagged entries, choose which groups to show, and display them in the loop.

TelemetryManager tm = new TelemetryManager(telemetry);

// Default-group entries (tag = "default")
tm.addEntry("Heading", () -> String.valueOf(follower.getPose().getHeading()));
tm.addEntry("Loop ms", () -> String.valueOf(loopTimer.milliseconds()));

// A grouped entry for arm debugging
tm.addEntry("arm", "Arm ticks", () -> String.valueOf(armMotor.getCurrentPosition()));
tm.addEntry("arm", "Arm target", () -> String.valueOf(arm.getTarget()));

// Prebuilt Entry, added directly
tm.addEntry(new Entry("drive", "Slow mode",
        () -> String.valueOf(bindingManager.checkBinding("slowMode"))));

// Choose which groups are visible
tm.setDisplayTags("default", "arm");   // show default + arm, hide "drive"

Then, once per loop:

tm.displayTelemetry();   // re-fetches every visible entry's value, then updates the DS

Toggle groups on and off at runtime — for example, reveal the drive group only while debugging:

tm.setDisplayTags("drive");        // start showing the drive group too
// ...later...
tm.removeDisplayTags("drive");     // hide it again