Skip to content

Match the Driver Station's telemetry ordering and formatting - #224

Open
mxtmx wants to merge 4 commits into
acmerobotics:masterfrom
6165-MSET-Cuttlefish:html-telemetry
Open

mxtmx wants to merge 4 commits into
acmerobotics:masterfrom
6165-MSET-Cuttlefish:html-telemetry

Conversation

@mxtmx

@mxtmx mxtmx commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Telemetry now shows in the same order and format as on the Driver Station.

  • Order: items appear in the order they were added instead of alphabetically, and addLine() puts its text in place instead of in the log below. Packets carry an ordered item list next to the keyed data, which the graph and logging views still read.
  • Formatting: the client used to render every value as raw HTML, so a stray < broke the line and robot markup was an XSS risk. Packets now carry a display format. HTML renders the subset the Driver Station supports, safely, and CLASSIC and MONOSPACE show plain text. The Telemetry view has a menu to override the format, and ESLint now rejects dangerouslySetInnerHTML.
  • Telemetry adapter: it now works like the SDK's TelemetryImpl. addData() returns an item, value producers are re-evaluated, retained items and setAutoClear work, Double and Float are rounded, captions and values are separated by " : ", and a repeated caption shows twice.
  • Logging CSV: each log entry is exported once, using the new logRange numbering, and bare lines get their own column.
  • MultipleTelemetry.removeItem() and removeLine() remove from every delegate.
  • TelemetryPacket gains addItem() (with Item.appendValue()) and putData() for hand-built packets.

TelemetryPacketTests and DashboardTelemetryTests cover the new behaviour.

Breaking changes:

  • TelemetryPacket.addLine() adds an in-place line instead of a log entry, and clearLines() clears only those lines. Use addLogEntry() for the log.
  • FtcDashboard.getTelemetry() defaults to CLASSIC like the Driver Station, so markup needs setDisplayFormat(HTML). Hand-built packets still default to HTML. This is the most contentious change, since teams relying on HTML will see raw tags.
  • MultipleTelemetry.addAction() runs an action once per loop instead of once per delegate, and MultipleItem.addData() returns the added item instead of itself, as in the SDK.

The new packet fields (items, displayFormat, captionValueSeparator, telemetryFrame, logRange) are optional, so older robots still work. Packets from the Telemetry adapter now carry the whole retained log each time.

format-menu-dark.mp4

@mxtmx
mxtmx force-pushed the html-telemetry branch 2 times, most recently from 4ae35b1 to 52817d9 Compare September 7, 2026 22:14
Telemetry displayed in a different order than the Driver Station shows it,
and the HTML formatting the SDK supports wasn't honoured.

Ordering. TelemetryPacket used a TreeMap, so items displayed alphabetically
rather than in the order they were added, and addLine() content went to the
log and rendered below every item instead of in place. The SDK sorts
nothing: TelemetryImpl walks its lines in insertion order and calls
setSorted(false), and its log is appended after the data. Packets now carry
an ordered item list alongside the keyed data map, which the graph and
logging views keep reading unchanged.

Formatting. The client rendered every value as HTML unconditionally via
dangerouslySetInnerHTML, with the caption and value interpolated into one
string, so a stray < corrupted the line and robot-supplied markup was an XSS
sink. Packets now carry a display format. HTML renders the subset
Html.fromHtml supports, parsed inertly and rebuilt as React elements;
CLASSIC and MONOSPACE show text verbatim.

The Telemetry adapter kept no model and wrote into a packet as calls
arrived. That is why addData() returned null, value producers could not be
re-evaluated, and retained items and setAutoClear were unsupported. It now
mirrors TelemetryImpl and composes a packet at update(), which also rounds
Double and Float the way the SDK rounds them.

Breaking changes:

  - TelemetryPacket.addLine() adds an in-place line rather than a log entry,
    and clearLines() clears those lines. Use addLogEntry() for the log.
  - FtcDashboard.getTelemetry() defaults to CLASSIC, matching the Driver
    Station, so telemetry containing markup now needs setDisplayFormat(HTML).
    Packets built directly still default to HTML. This is the most
    contentious change here, since it changes what teams currently relying
    on unconditional HTML see.
  - MultipleTelemetry.addAction() registers with one delegate, so an action
    runs once per loop rather than once per delegate. MultipleItem.addData()
    returns the added item rather than itself.
  - Packets gain items, displayFormat, captionValueSeparator and
    telemetryFrame. Clients tolerate their absence from an older robot.
mxtmx added a commit to 6165-MSET-Cuttlefish/slothboard that referenced this pull request Sep 23, 2026
Keep acmerobotics#226's telemetry filter on acmerobotics#224's new rendering path; port its JUnit 5 setup into the Kotlin build files.
mxtmx added a commit to 6165-MSET-Cuttlefish/slothboard that referenced this pull request Sep 30, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant