YAMS
Yet Another Mechanism System
Loading...
Searching...
No Matches
yams::mechanisms::swerve::utility::SwerveInputStreamTelemetry< NumModules > Class Template Reference

#include <SwerveInputStreamTelemetry.hpp>

Public Types

enum class  DoubleTelemetryField {
  Deadband , TranslationScale , RotationScale , MaxLinearVelocity ,
  MaxAngularVelocity , RotationControllerMeasurement , RotationControllerSetpoint , TunableDeadband ,
  TunableTranslationScale , TunableRotationScale , TunableMaxLinearVelocity , TunableMaxAngularVelocity
}
enum class  BooleanTelemetryField {
  TranslationCube , RotationCube , AllianceRelative , RobotRelative ,
  TunableTranslationCube , TunableRotationCube , TunableAllianceRelative , TunableRobotRelative
}
enum class  StringTelemetryField { Mode }
using TelemetryVerbosity = SwerveDriveConfig::TelemetryVerbosity

Public Member Functions

 SwerveInputStreamTelemetry (SwerveInputStream< NumModules > &stream, std::string_view name, TelemetryVerbosity verbosity)
 SwerveInputStreamTelemetry (const SwerveInputStreamTelemetry &)=delete
SwerveInputStreamTelemetry & operator= (const SwerveInputStreamTelemetry &)=delete
 ~SwerveInputStreamTelemetry ()
void UpdateTelemetry ()
void ApplyTuningValues ()
std::optional< std::reference_wrapper< wpi::cmd::Command > > GetLiveTuningCommand ()

Detailed Description

template<size_t NumModules = 4>
class yams::mechanisms::swerve::utility::SwerveInputStreamTelemetry< NumModules >

Telemetry and live tuning for a SwerveInputStream, created by SwerveInputStream::WithTelemetry(name, verbosity) and published every time the stream is read.

  • LOW: the current drive mode, under SwerveInputStream/<name>.
  • MEDIUM: also the stream's configuration (deadband, scales, maximum velocities, cubing, alliance and robot relative), read-only, and the rotation controller's measurement and setpoint under rotationController, in radians in the gyro's frame. Those are what heading, aim and translation only control give the controller, and are NaN while the stream isn't using it.
  • HIGH: also editable copies of the configuration under Tuning/SwerveInputStream/<name>, and a "Live Tuning" command there that applies them to the stream every loop while it runs.

Each value is a DoubleTelemetryField, BooleanTelemetryField or StringTelemetryField, which gives its key and whether it is tunable.

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.

The stream owns its telemetry and creates it when first read, so the telemetry never outlives the stream or follows it to a new address.

Member Typedef Documentation

◆ TelemetryVerbosity

template<size_t NumModules = 4>
using yams::mechanisms::swerve::utility::SwerveInputStreamTelemetry< NumModules >::TelemetryVerbosity = SwerveDriveConfig::TelemetryVerbosity

Member Enumeration Documentation

◆ BooleanTelemetryField

Boolean telemetry field for a SwerveInputStream.

Enumerator
TranslationCube 

Translation axes are cubed.

RotationCube 

Rotation axis is cubed.

AllianceRelative 

Driving is relative to the alliance.

RobotRelative 

Driving is relative to the robot.

TunableTranslationCube 

Tunable translation axis cubing.

TunableRotationCube 

Tunable rotation axis cubing.

TunableAllianceRelative 

Tunable alliance relative driving.

TunableRobotRelative 

Tunable robot relative driving.

◆ DoubleTelemetryField

Double telemetry field for a SwerveInputStream.

Enumerator
Deadband 

Joystick axis deadband.

TranslationScale 

Translation axis scale.

RotationScale 

Rotation axis scale.

MaxLinearVelocity 

Maximum chassis linear velocity, in meters per second.

MaxAngularVelocity 

Maximum chassis angular velocity, in radians per second.

RotationControllerMeasurement 

Heading given to the rotation controller as its measurement, in radians in the gyro's frame. NaN while the stream isn't using the controller.

RotationControllerSetpoint 

Heading given to the rotation controller as its setpoint, in radians in the gyro's frame. NaN while the stream isn't using the controller.

TunableDeadband 

Tunable joystick axis deadband, from 0 up to but not including 1.

TunableTranslationScale 

Tunable translation axis scale, above 0 and up to 1.

TunableRotationScale 

Tunable rotation axis scale, above 0 and up to 1.

TunableMaxLinearVelocity 

Tunable maximum chassis linear velocity, in meters per second.

TunableMaxAngularVelocity 

Tunable maximum chassis angular velocity, in radians per second.

◆ StringTelemetryField

String telemetry field for a SwerveInputStream.

Enumerator
Mode 

Name of the stream's current drive mode.

Constructor & Destructor Documentation

◆ SwerveInputStreamTelemetry() [1/2]

template<size_t NumModules = 4>
yams::mechanisms::swerve::utility::SwerveInputStreamTelemetry< NumModules >::SwerveInputStreamTelemetry ( SwerveInputStream< NumModules > & stream,
std::string_view name,
TelemetryVerbosity verbosity )
inline

Publish telemetry for a SwerveInputStream. Use SwerveInputStream::WithTelemetry rather than creating this directly.

Parameters
streamThe SwerveInputStream to monitor and tune. Must outlive this object.
nameName of the stream in NetworkTables (e.g., "drive").
verbosityTelemetryVerbosity to publish at.

◆ SwerveInputStreamTelemetry() [2/2]

template<size_t NumModules = 4>
yams::mechanisms::swerve::utility::SwerveInputStreamTelemetry< NumModules >::SwerveInputStreamTelemetry ( const SwerveInputStreamTelemetry< NumModules > & )
delete

◆ ~SwerveInputStreamTelemetry()

template<size_t NumModules = 4>
yams::mechanisms::swerve::utility::SwerveInputStreamTelemetry< NumModules >::~SwerveInputStreamTelemetry ( )
inline

Stop publishing, canceling and removing the "Live Tuning" command.

Member Function Documentation

◆ ApplyTuningValues()

template<size_t NumModules = 4>
void yams::mechanisms::swerve::utility::SwerveInputStreamTelemetry< NumModules >::ApplyTuningValues ( )
inline

Apply values edited on the dashboard to the stream, and publish changes made to the stream in code. The "Live Tuning" command calls this every loop. Does nothing below HIGH.

◆ GetLiveTuningCommand()

template<size_t NumModules = 4>
std::optional< std::reference_wrapper< wpi::cmd::Command > > yams::mechanisms::swerve::utility::SwerveInputStreamTelemetry< NumModules >::GetLiveTuningCommand ( )
inline

The "Live Tuning" command published to the dashboard, which applies dashboard edits while it runs.

Returns
The command at HIGH, otherwise empty.

◆ operator=()

template<size_t NumModules = 4>
SwerveInputStreamTelemetry & yams::mechanisms::swerve::utility::SwerveInputStreamTelemetry< NumModules >::operator= ( const SwerveInputStreamTelemetry< NumModules > & )
delete

◆ UpdateTelemetry()

template<size_t NumModules = 4>
void yams::mechanisms::swerve::utility::SwerveInputStreamTelemetry< NumModules >::UpdateTelemetry ( )
inline

Publish the stream's current mode and, at MEDIUM and above, its configuration. Called by SwerveInputStream::Get().


The documentation for this class was generated from the following files: