Class SmartMotorControllerTelemetryConfig
java.lang.Object
yams.core.telemetry.SmartMotorControllerTelemetryConfig
Smart motor controller telemetry configuration.
Use this builder to select exactly which fields are published to NetworkTables and/or DataLog.
Every field is disabled by default; call the individual with*() methods to opt in, or use
withTelemetryVerbosity(TelemetryVerbosity) to enable a predefined set.
Example
SmartMotorControllerTelemetryConfig telemetryCfg =
new SmartMotorControllerTelemetryConfig()
// choose a verbosity preset (LOW / MID / HIGH), or enable fields individually below
.withTelemetryVerbosity(TelemetryVerbosity.HIGH)
// optionally enable individual fields on top of the preset
.withStatorCurrent()
.withTemperature()
.withOutputVoltage()
.withSetpointPosition()
.withSetpointVelocity()
.withSetpointForce()
.withMechanismPosition()
.withMechanismVelocity()
.withRotorPosition()
.withRotorVelocity()
.withMeasurementPosition()
.withMeasurementVelocity()
.withMechanismUpperLimit()
.withMechanismLowerLimit()
.withTemperatureLimit()
.withVelocityControl()
.withMotionProfile()
.withArmFeedforward()
.withElevatorFeedforward()
.withSimpleFeedforward()
// disable NT4 output (e.g. during competition) and log to DataLog instead
.withoutNetworkTables()
.withDataLogName("motors/shooter");
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionMap<SmartMotorControllerTelemetry.BooleanTelemetryField, BooleanTelemetry<SmartMotorControllerTelemetry.BooleanTelemetryField>> Get the configured bool fields.Get the entry name for the smart motor controller in DataLog.Map<SmartMotorControllerTelemetry.DoubleTelemetryField, DoubleTelemetry<SmartMotorControllerTelemetry.DoubleTelemetryField>> Get the configured double fields.booleanLog telemetry to NT4?Enables the arm feedforward logging if available.Enables logging the period the closed loop controller runs at.withCustom(SmartMotorControllerTelemetry.BooleanTelemetryField[] field, boolean value) Escape hatch for unimplemented fields which should be enabled or disabled.withCustom(SmartMotorControllerTelemetry.BooleanTelemetryField field, boolean value) Escape hatch for unimplemented fields which should be enabled or disabled.withCustom(SmartMotorControllerTelemetry.DoubleTelemetryField[] field, boolean value) Escape hatch for unimplemented fields which should be enabled or disabled.withCustom(SmartMotorControllerTelemetry.DoubleTelemetryField field, boolean value) Escape hatch for unimplemented fields which should be enabled or disabled.withDataLogName(String dataLogName) Set up a DataLog entry for thisSmartMotorControllerEnables the elevator feedforward logging if available.Enables the distance logging if available.Enables the linear velocity logging if available.Enables the mechanism lower limit logging if available.Enables the mechanism position logging if available.Enables the mechanism upper limit logging if available.Enables the mechanism velocity logging if available.Enables the motion profile logging if available.withNetworkTables(boolean NT4Telemetry) Enable or disable NT4 Telemetry.Disable NetworkTable output.Enables the output voltage logging if available.Enables the rotor position logging if available.Enables the rotor velocity logging if available.Enables the setpoint feedforward force logging if available.Enables the setpoint position logging if available.Enables the setpoint velocity logging if available.Enables the simple feedforward logging if available.Enables the stator current logging if available.withTelemetryVerbosity(TelemetryVerbosity verbosity) Setup withTelemetryVerbosityEnables the temperature logging if available.Enables the temperature limit logging if available.Enables the velocity control mode logging if available.Enables logging how far behind the mechanism the measured velocity is, when it is known.
-
Constructor Details
-
SmartMotorControllerTelemetryConfig
public SmartMotorControllerTelemetryConfig()Create aSmartMotorControllerTelemetryConfigwith the default fields.
-
-
Method Details
-
withDataLogName
Set up a DataLog entry for thisSmartMotorController- Parameters:
dataLogName- DataLog entry name- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withNetworkTables
Enable or disable NT4 Telemetry. This will not create NT4 entries and is generally only advisable during competition matches.- Parameters:
NT4Telemetry- NT4 Boolean- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withoutNetworkTables
Disable NetworkTable output.- Returns:
- Disable NT4 telemetry.
-
withTelemetryVerbosity
Setup withTelemetryVerbosity- Parameters:
verbosity-TelemetryVerbosityto use.- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
getDataLogName
-
getNT4Enabled
public boolean getNT4Enabled()Log telemetry to NT4?- Returns:
- should Telemetry be sent to NT4.
-
getDoubleFields
public Map<SmartMotorControllerTelemetry.DoubleTelemetryField, DoubleTelemetry<SmartMotorControllerTelemetry.DoubleTelemetryField>> getDoubleFields(SmartMotorController smc) Get the configured double fields.- Parameters:
smc-SmartMotorControllerused to disable unavailable telemetry for certain motor controllers.- Returns:
- Configured
DoubleTelemetryfor eachSmartMotorControllerTelemetry.DoubleTelemetryField
-
getBoolFields
public Map<SmartMotorControllerTelemetry.BooleanTelemetryField, BooleanTelemetry<SmartMotorControllerTelemetry.BooleanTelemetryField>> getBoolFields(SmartMotorController smc) Get the configured bool fields.- Parameters:
smc-SmartMotorControllerused to disable unavailable telemetry for certain motor controllers.- Returns:
- Configured
BooleanTelemetryfor eachSmartMotorControllerTelemetry.BooleanTelemetryField.
-
withMechanismLowerLimit
Enables the mechanism lower limit logging if available.- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withMechanismUpperLimit
Enables the mechanism upper limit logging if available.- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withTemperatureLimit
Enables the temperature limit logging if available.- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withVelocityControl
Enables the velocity control mode logging if available.- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withElevatorFeedforward
Enables the elevator feedforward logging if available.- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withArmFeedforward
Enables the arm feedforward logging if available.- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withSimpleFeedforward
Enables the simple feedforward logging if available.- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withMotionProfile
Enables the motion profile logging if available.- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withSetpointPosition
Enables the setpoint position logging if available.- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withSetpointVelocity
Enables the setpoint velocity logging if available.- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withSetpointForce
Enables the setpoint feedforward force logging if available.- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withVelocityMeasurementDelay
Enables logging how far behind the mechanism the measured velocity is, when it is known.- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withClosedLoopPeriod
Enables logging the period the closed loop controller runs at.- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withOutputVoltage
Enables the output voltage logging if available.- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withStatorCurrent
Enables the stator current logging if available.- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withTemperature
Enables the temperature logging if available.- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withMeasurementPosition
Enables the distance logging if available.- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withMeasurementVelocity
Enables the linear velocity logging if available.- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withMechanismPosition
Enables the mechanism position logging if available.- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withMechanismVelocity
Enables the mechanism velocity logging if available.- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withRotorPosition
Enables the rotor position logging if available.- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withRotorVelocity
Enables the rotor velocity logging if available.- Returns:
SmartMotorControllerTelemetryConfigfor chaining.
-
withCustom
public SmartMotorControllerTelemetryConfig withCustom(SmartMotorControllerTelemetry.DoubleTelemetryField field, boolean value) Escape hatch for unimplemented fields which should be enabled or disabled.- Parameters:
field- Field to configurevalue- Enable on true, Disable on false.- Returns:
SmartMotorControllerTelemetryConfigfor chaining
-
withCustom
public SmartMotorControllerTelemetryConfig withCustom(SmartMotorControllerTelemetry.BooleanTelemetryField field, boolean value) Escape hatch for unimplemented fields which should be enabled or disabled.- Parameters:
field- Field to configurevalue- Enable on true, Disable on false.- Returns:
SmartMotorControllerTelemetryConfigfor chaining
-
withCustom
public SmartMotorControllerTelemetryConfig withCustom(SmartMotorControllerTelemetry.BooleanTelemetryField[] field, boolean value) Escape hatch for unimplemented fields which should be enabled or disabled.- Parameters:
field- Field to configurevalue- Enable on true, Disable on false.- Returns:
SmartMotorControllerTelemetryConfigfor chaining
-
withCustom
public SmartMotorControllerTelemetryConfig withCustom(SmartMotorControllerTelemetry.DoubleTelemetryField[] field, boolean value) Escape hatch for unimplemented fields which should be enabled or disabled.- Parameters:
field- Field to configurevalue- Enable on true, Disable on false.- Returns:
SmartMotorControllerTelemetryConfigfor chaining
-