Telemetry Publisher
Disclaimer: WIP and untested on 2026 hardware; validate log volume and paths on your robot. Custom code built on WPILib APIs (not official WPILib sample).
Purpose: Make burn-in and practice measurable; log key data and show hub state to drivers.
Code (Java/WPILib)
public class Telemetry {
private final DataLog log;
private final IntegerLogEntry shiftIdx;
private final StringLogEntry hubState;
private final FloatLogEntry battery;
private final FloatLogEntry driveCurrent;
public Telemetry() {
DataLogManager.start();
log = DataLogManager.getLog();
shiftIdx = new IntegerLogEntry(log, "/hub/shiftIdx");
hubState = new StringLogEntry(log, "/hub/state");
battery = new FloatLogEntry(log, "/pwr/battery");
driveCurrent = new FloatLogEntry(log, "/pwr/driveCurrent");
}
public void recordHub(HubShiftTimer.Status status) {
shiftIdx.append(status.shiftIndex());
hubState.append(status.ourHub().name());
SmartDashboard.putNumber("Shift Index", status.shiftIndex());
SmartDashboard.putString("Hub State", status.ourHub().name());
}
public void recordPower(double driveAmps) {
battery.append((float)RobotController.getBatteryVoltage());
driveCurrent.append((float)driveAmps);
SmartDashboard.putNumber("Battery", RobotController.getBatteryVoltage());
SmartDashboard.putNumber("Drive Amps", driveAmps);
}
}
Usage
Telemetry tel = new Telemetry();
// Periodic:
tel.recordHub(shiftTimer.get());
tel.recordPower(driveTrain.getAverageCurrent());
// Tag events:
DataLogManager.log("AUTO_START");
DataLogManager.log("CLIMB_START");
How to test
- Run
npm run start+ driver station; ensure dashboard shows hub state and currents. - After a session, pull the log from
/home/lvuser/logs(on robot) or build logs folder (sim) and view with AdvantageScope or WPILib Log Viewer.
Pitfalls
- Keep logging minimal during matches to avoid disk bloat.
- Ensure log paths are short and consistent for analysis tools.