Telemetry & Command Logging¶
FtcTelemetryBus¶
FtcTelemetryBus (in com.vcs.valleylib.ftc.telemetry) is a unified telemetry pipe. Data you put(...) once is mirrored to both:
- the FTC Driver Station telemetry, and
- the Panels dashboard (
TelemetryManager).
No more writing every value twice.
telemetryBus.put("Lift height", lift.getHeight());
telemetryBus.put("Heading", drive.getHeading());
// ... once per loop:
telemetryBus.update();
| Method | Description |
|---|---|
put(key, value) |
Queue a key/value pair for the current loop |
update() |
Flush everything queued to both outputs, then clear the queue |
clear() |
Discard queued data without sending it (e.g., on phase changes or stop) |
Inside a CommandOpMode you get a ready-made telemetryBus field, and update() is called for you at the end of every loop — just put values from run(), subsystems, or commands. On stop(), the OpMode clears any unflushed queue.
Keys keep their insertion order (backed by a LinkedHashMap), so your dashboard layout is stable.
Standalone use¶
Outside CommandOpMode you can construct one yourself:
FtcTelemetryBus bus = new FtcTelemetryBus(
telemetry, // DS telemetry from OpMode
PanelsTelemetry.INSTANCE.getTelemetry() // Panels manager
);
Command lifecycle logging¶
FtcCommandLogger (in com.vcs.valleylib.ftc.logging) is a CommandSchedulerListener that writes command lifecycle events to a telemetry bus:
| Event | Telemetry key | Value |
|---|---|---|
| Command scheduled | cmd/scheduled |
command.getName() |
| Command finished | cmd/finished |
command.getName() |
| Command canceled | cmd/canceled |
command.getName() |
Names are readable out of the box — Intake.startEnd, Wait(0.5s), StateMachine[SCORE], FollowPathCommand — and you can label important commands yourself with .withName("Score") (see Command names). This gives you live visibility into what the scheduler is doing — invaluable when a binding "isn't working" or an auto stalls.
Enabling it¶
The one-liner, in any CommandOpMode:
Or attach manually (any scheduler, any bus):
Custom listeners¶
For richer logging — timestamps, match-log files, filtering — implement the listener yourself:
scheduler.addListener(new CommandSchedulerListener() {
@Override
public void onCommandScheduled(Command command) {
telemetryBus.put("sched@" + timer.seconds(),
command.getClass().getSimpleName());
}
});
All three listener methods are default no-ops, so override only what you need.