Class SwerveInputStreamTelemetry
java.lang.Object
yams.commands2.telemetry.SwerveInputStreamTelemetry
- All Implemented Interfaces:
AutoCloseable
Telemetry and live tuning for a
SwerveInputStream, created by
SwerveInputStream.withTelemetry(String, TelemetryVerbosity) and published every time the stream is read.
TelemetryVerbosity.LOW: the current drive mode, underSwerveInputStream/<name>.TelemetryVerbosity.MID: also the stream's configuration (deadband, scales, maximum velocities, cubing, alliance and robot relative), read-only.TelemetryVerbosity.HIGH: also editable copies of the configuration underTuning/SwerveInputStream/<name>, and aLive Tuningcommand there that applies them to the stream every loop while it runs.
While live tuning, values stay in sync both ways: a dashboard edit is applied to the stream, and a change made in code, e.g. a binding that changes the translation scale, is published to the dashboard. Invalid dashboard values are replaced with the stream's current value.
-
Constructor Summary
ConstructorsConstructorDescriptionSwerveInputStreamTelemetry(SwerveInputStream stream, String name, TelemetryVerbosity verbosity) Publish telemetry for aSwerveInputStream. -
Method Summary
Modifier and TypeMethodDescriptionvoidApply values edited on the dashboard to the stream, and publish changes made to the stream in code.voidclose()Stop publishing this stream's telemetry, canceling and removing theLive Tuningcommand.Optional<org.wpilib.command2.Command> TheLive Tuningcommand published to the dashboard, which applies dashboard edits while it runs.voidPublish the stream's current mode and, atTelemetryVerbosity.MIDand above, its configuration.
-
Constructor Details
-
SwerveInputStreamTelemetry
public SwerveInputStreamTelemetry(SwerveInputStream stream, String name, TelemetryVerbosity verbosity) Publish telemetry for aSwerveInputStream. UseSwerveInputStream.withTelemetry(String, TelemetryVerbosity)rather than calling this directly.- Parameters:
stream- TheSwerveInputStreamto monitor and tune.name- Name of the stream in NetworkTables (e.g., "drive").verbosity-TelemetryVerbosityto publish at.
-
-
Method Details
-
updateTelemetry
public void updateTelemetry()Publish the stream's current mode and, atTelemetryVerbosity.MIDand above, its configuration. Called bySwerveInputStream.get(). -
applyTuningValues
public void applyTuningValues()Apply values edited on the dashboard to the stream, and publish changes made to the stream in code. TheLive Tuningcommand calls this every loop. Does nothing belowTelemetryVerbosity.HIGH. -
getLiveTuningCommand
TheLive Tuningcommand published to the dashboard, which applies dashboard edits while it runs.- Returns:
- The command at
TelemetryVerbosity.HIGH, otherwise empty.
-
close
public void close()Stop publishing this stream's telemetry, canceling and removing theLive Tuningcommand.- Specified by:
closein interfaceAutoCloseable
-