Work in progress. This library and its docs are new and still changing, and some parts are not yet tested on a real robot. Something wrong or unclear?Tell us (a GitHub issue).
Telemetry module
Package: com.crossbotics.ftchelper.telemetry
Learn it hands-on: 06 A fast, clear loop.
Telemetry is the text your program shows on the Driver Station screen. This module makes it
easy to read during a match and useful when you hunt for a bug. EasyTeleOp and the
robot in five files set it up for you; every mechanism adds its own lines. Use this page
to add your own lines, or in an OpMode you write yourself. Start with tutorial 06.
| Class | Use it to |
|---|---|
RobotTelemetry |
show lines at two levels (standard for drivers, debug for programmers), warnings on top, and send less often for a faster loop |
TelemetryHelper |
add common lines (a motor, a yes/no) to the SDK’s plain telemetry in one call |
RobotTelemetry
Section titled “RobotTelemetry”RobotTelemetry t = new RobotTelemetry(telemetry); // debug ON in PRACTICE, OFF in COMPETITIONcontrols.bindPress(Pad.G1, Btn.BACK, t::toggleDebug); // let the driver switch it// every loop:t.section("Lift");t.line("Height", lift.getTargetName()); // standard: always shownt.debug("Power", "%.2f", power); // debug: only when debug is onif (battery < 11.5) t.warn("Battery low!"); // warnings: always, at the toprobot.addTelemetry(t); // every mechanism adds its own linest.update(); // ONCE, at the end of the loop| Method | What it does |
|---|---|
section(title) |
--- title --- heading (standard) |
debugSection(title) |
heading shown only in debug |
line(label, value) / line(label, format, args...) |
a driver line |
text(text) |
a plain driver line |
debug(label, value) / debug(label, format, args...) |
a programmer line (only in debug) |
warn(text) |
!! text at the top, always; the same warning once per loop |
setDebug(on), toggleDebug(), isDebug() |
debug level |
setMinIntervalMs(ms) |
send at most every N ms (100 = 10/s is plenty) for a faster loop. Warnings from skipped loops are kept for the next send |
update() |
send (warnings first) and start a fresh screen |
pending(), raw() |
the lines waiting (for tests); the SDK telemetry |
Standard or debug? Ask: “does the DRIVER need this during a match?” Yes = line. No = debug.
Mechanism helpers already split their lines this way.
flowchart TB
W["!! warnings (always, top)"] --> S["standard lines<br/>drivers: modes, targets, OK/READY"] --> D["debug lines (PRACTICE or toggled)<br/>powers, errors, raw sensor values, loop speed"]
TelemetryHelper
Section titled “TelemetryHelper”// Each line only ADDS text; nothing is shown until telemetry.update().TelemetryHelper.section(telemetry, "Lift");TelemetryHelper.motor(telemetry, "Lift", liftMotor); // power, position, speedTelemetryHelper.value(telemetry, "Target", liftTarget, "ticks");TelemetryHelper.flag(telemetry, "At bottom", lift.isAtLower()); // true/false shown as yes/notelemetry.update(); // send: once per loopThe Driver Station shows:
--- Lift ---Lift : pwr 0.45 | pos 1203 | vel 812/sTarget : 1500.00 ticksAt bottom : no| Method | Adds |
|---|---|
section(telemetry, title) |
a heading line: --- title --- |
value(telemetry, label, number, unit) |
label : number unit, 2 decimals |
value(telemetry, label, number, decimals) |
label : number, with the decimals you choose |
flag(telemetry, label, boolean) |
label : yes or label : no |
motor(telemetry, label, motor) |
power, encoder position and speed (counts per second) on one line |
servo(telemetry, label, servo) |
the servo’s last commanded position. (A normal servo cannot report where it really is.) |
num(number, decimals) |
the number as text, e.g. num(0.4567, 2) = "0.46". NaN shows as --. |
These only ADD lines. You still call telemetry.update() once at the end of the loop.
- One
telemetry.update()per loop. More than one makes the screen flicker and slows the loop. - Show what the driver needs during a match at the top; put debug numbers lower.
- Show the loop speed while you test:
TelemetryHelper.value(telemetry, "Loop", loopTimer.getHz(), "Hz")(seeLoopTimerin util).