Class LoggedTalonFX

java.lang.Object
com.ctre.phoenix6.hardware.ParentDevice
com.ctre.phoenix6.hardware.core.CoreTalonFX
com.ctre.phoenix6.hardware.TalonFX
com.stuypulse.robot.util.talonfx.logged.LoggedTalonFX
All Implemented Interfaces:
com.ctre.phoenix6.alerts.PhoenixAlertable, com.ctre.phoenix6.hardware.traits.CommonDevice, com.ctre.phoenix6.hardware.traits.CommonTalon, com.ctre.phoenix6.hardware.traits.CommonTalonWithFOC, com.ctre.phoenix6.hardware.traits.HasTalonControls, com.ctre.phoenix6.hardware.traits.HasTalonSignals, com.ctre.phoenix6.hardware.traits.SupportsFOC, com.ctre.phoenix6.hardware.traits.SupportsMusic, AutoCloseable, org.wpilib.telemetry.TelemetryLoggable
Direct Known Subclasses:
TalonFXSimulation

public class LoggedTalonFX extends com.ctre.phoenix6.hardware.TalonFX

Logged TalonFX

A TalonFX motor controller with built-in signal logging for AdvantageKit.

This class wraps the commonly used TalonFX status signals and provides a convenient method for refreshing those signals and copying their values into a TalonFXInputs object.

Usage

Include a TalonFXInputs field for each motor that should have its telemetry logged.

@AutoLog
public static class IntakeIOInputs {
    public TalonFXInputs pivotInputs = new TalonFXInputs();
    public TalonFXInputsAutoLogged rollerInputs = new TalonFXInputs();
}

Creating the Motor

Use LoggedTalonFX anywhere a normal TalonFX would be used:

private final LoggedTalonFX pivotMotor;

public IntakeIOReal() {
    pivotMotor = new LoggedTalonFX(
            IntakeDeviceIds.PIVOT,
            GlobalSettings.RIO);

    // Use `withSignal` to log extra signals beyond the base six.
    pivotMotor
     .withSignal(pivotMotor.getReverseLimit());
}

Updating Inputs

Call updateInputs(TalonFXInputs) from the subsystem's IO implementation to refresh the motor telemetry:

@Override
public void updateInputs(IntakeIOInputs inputs) {
    pivotMotor.updateInputs(inputs.pivotInputs);
    rollerMotor.updateInputs(inputs.rollerInputs);
}
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.ctre.phoenix6.hardware.ParentDevice

    com.ctre.phoenix6.hardware.ParentDevice.MapGenerator
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final List<org.wpilib.util.Alert>
     
    private final List<com.ctre.phoenix6.StatusSignal<?>>
     
    private final com.ctre.phoenix6.StatusSignal<org.wpilib.units.measure.Voltage>
     
    private final com.ctre.phoenix6.StatusSignal<org.wpilib.units.measure.Angle>
     
    private final com.ctre.phoenix6.StatusSignal<org.wpilib.units.measure.Current>
     
    private final com.ctre.phoenix6.StatusSignal<org.wpilib.units.measure.Current>
     
    private final com.ctre.phoenix6.StatusSignal<org.wpilib.units.measure.Temperature>
     
    private final com.ctre.phoenix6.StatusSignal<org.wpilib.units.measure.AngularVelocity>
     

    Fields inherited from class com.ctre.phoenix6.hardware.TalonFX

    kDefaultSafetyExpiration

    Fields inherited from class com.ctre.phoenix6.hardware.ParentDevice

    _emptyControl, deviceIdentifier
  • Constructor Summary

    Constructors
    Constructor
    Description
    LoggedTalonFX(int deviceId)
     
    LoggedTalonFX(int deviceId, com.ctre.phoenix6.CANBus bus)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Refreshes the motor status signals and updates the provided inputs.
    withSignal(com.ctre.phoenix6.StatusSignal<T> signal)
    Adds a status signal to be logged and replayed.

    Methods inherited from class com.ctre.phoenix6.hardware.TalonFX

    close, configNeutralMode, configNeutralMode, disable, feed, getDescription, getExpiration, getTelemetryType, getThrottle, isAlive, isSafetyEnabled, logTo, none, setControlPrivate, setExpiration, setSafetyEnabled, setThrottle, setVoltage, setVoltage, stopMotor

    Methods inherited from class com.ctre.phoenix6.hardware.core.CoreTalonFX

    clearStickyFault_BootDuringEnable, clearStickyFault_BootDuringEnable, clearStickyFault_BridgeBrownout, clearStickyFault_BridgeBrownout, clearStickyFault_DeviceTemp, clearStickyFault_DeviceTemp, clearStickyFault_ForwardHardLimit, clearStickyFault_ForwardHardLimit, clearStickyFault_ForwardSoftLimit, clearStickyFault_ForwardSoftLimit, clearStickyFault_FusedSensorOutOfSync, clearStickyFault_FusedSensorOutOfSync, clearStickyFault_Hardware, clearStickyFault_Hardware, clearStickyFault_MissingDifferentialFX, clearStickyFault_MissingDifferentialFX, clearStickyFault_MissingHardLimitRemote, clearStickyFault_MissingHardLimitRemote, clearStickyFault_MissingSoftLimitRemote, clearStickyFault_MissingSoftLimitRemote, clearStickyFault_OverSupplyV, clearStickyFault_OverSupplyV, clearStickyFault_ProcTemp, clearStickyFault_ProcTemp, clearStickyFault_RemoteSensorDataInvalid, clearStickyFault_RemoteSensorDataInvalid, clearStickyFault_RemoteSensorPosOverflow, clearStickyFault_RemoteSensorPosOverflow, clearStickyFault_RemoteSensorReset, clearStickyFault_RemoteSensorReset, clearStickyFault_ReverseHardLimit, clearStickyFault_ReverseHardLimit, clearStickyFault_ReverseSoftLimit, clearStickyFault_ReverseSoftLimit, clearStickyFault_RotorFault1, clearStickyFault_RotorFault1, clearStickyFault_RotorFault2, clearStickyFault_RotorFault2, clearStickyFault_StaticBrakeDisabled, clearStickyFault_StaticBrakeDisabled, clearStickyFault_StatorCurrLimit, clearStickyFault_StatorCurrLimit, clearStickyFault_SupplyCurrLimit, clearStickyFault_SupplyCurrLimit, clearStickyFault_Undervoltage, clearStickyFault_Undervoltage, clearStickyFault_UnlicensedFeatureInUse, clearStickyFault_UnlicensedFeatureInUse, clearStickyFault_UnstableSupplyV, clearStickyFault_UnstableSupplyV, clearStickyFault_UsingFusedCANcoderWhileUnlicensed, clearStickyFault_UsingFusedCANcoderWhileUnlicensed, clearStickyFaults, clearStickyFaults, getAcceleration, getAcceleration, getAncillaryDeviceTemp, getAncillaryDeviceTemp, getAppliedRotorPolarity, getAppliedRotorPolarity, getBridgeOutput, getBridgeOutput, getClosedLoopDerivativeOutput, getClosedLoopDerivativeOutput, getClosedLoopError, getClosedLoopError, getClosedLoopFeedForward, getClosedLoopFeedForward, getClosedLoopIntegratedOutput, getClosedLoopIntegratedOutput, getClosedLoopOutput, getClosedLoopOutput, getClosedLoopProportionalOutput, getClosedLoopProportionalOutput, getClosedLoopReference, getClosedLoopReference, getClosedLoopReferenceSlope, getClosedLoopReferenceSlope, getClosedLoopSlot, getClosedLoopSlot, getConfigurator, getConnectedMotor, getConnectedMotor, getControlMode, getControlMode, getDeviceEnable, getDeviceEnable, getDeviceTemp, getDeviceTemp, getDifferentialAveragePosition, getDifferentialAveragePosition, getDifferentialAverageVelocity, getDifferentialAverageVelocity, getDifferentialClosedLoopDerivativeOutput, getDifferentialClosedLoopDerivativeOutput, getDifferentialClosedLoopError, getDifferentialClosedLoopError, getDifferentialClosedLoopFeedForward, getDifferentialClosedLoopFeedForward, getDifferentialClosedLoopIntegratedOutput, getDifferentialClosedLoopIntegratedOutput, getDifferentialClosedLoopOutput, getDifferentialClosedLoopOutput, getDifferentialClosedLoopProportionalOutput, getDifferentialClosedLoopProportionalOutput, getDifferentialClosedLoopReference, getDifferentialClosedLoopReference, getDifferentialClosedLoopReferenceSlope, getDifferentialClosedLoopReferenceSlope, getDifferentialClosedLoopSlot, getDifferentialClosedLoopSlot, getDifferentialControlMode, getDifferentialControlMode, getDifferentialDifferencePosition, getDifferentialDifferencePosition, getDifferentialDifferenceVelocity, getDifferentialDifferenceVelocity, getDifferentialOutput, getDifferentialOutput, getDutyCycle, getDutyCycle, getFault_BootDuringEnable, getFault_BootDuringEnable, getFault_BridgeBrownout, getFault_BridgeBrownout, getFault_DeviceTemp, getFault_DeviceTemp, getFault_ForwardHardLimit, getFault_ForwardHardLimit, getFault_ForwardSoftLimit, getFault_ForwardSoftLimit, getFault_FusedSensorOutOfSync, getFault_FusedSensorOutOfSync, getFault_Hardware, getFault_Hardware, getFault_MissingDifferentialFX, getFault_MissingDifferentialFX, getFault_MissingHardLimitRemote, getFault_MissingHardLimitRemote, getFault_MissingSoftLimitRemote, getFault_MissingSoftLimitRemote, getFault_OverSupplyV, getFault_OverSupplyV, getFault_ProcTemp, getFault_ProcTemp, getFault_RemoteSensorDataInvalid, getFault_RemoteSensorDataInvalid, getFault_RemoteSensorPosOverflow, getFault_RemoteSensorPosOverflow, getFault_RemoteSensorReset, getFault_RemoteSensorReset, getFault_ReverseHardLimit, getFault_ReverseHardLimit, getFault_ReverseSoftLimit, getFault_ReverseSoftLimit, getFault_RotorFault1, getFault_RotorFault1, getFault_RotorFault2, getFault_RotorFault2, getFault_StaticBrakeDisabled, getFault_StaticBrakeDisabled, getFault_StatorCurrLimit, getFault_StatorCurrLimit, getFault_SupplyCurrLimit, getFault_SupplyCurrLimit, getFault_Undervoltage, getFault_Undervoltage, getFault_UnlicensedFeatureInUse, getFault_UnlicensedFeatureInUse, getFault_UnstableSupplyV, getFault_UnstableSupplyV, getFault_UsingFusedCANcoderWhileUnlicensed, getFault_UsingFusedCANcoderWhileUnlicensed, getFaultField, getFaultField, getForwardLimit, getForwardLimit, getIsProLicensed, getIsProLicensed, getMotionMagicAtTarget, getMotionMagicAtTarget, getMotionMagicIsRunning, getMotionMagicIsRunning, getMotorKT, getMotorKT, getMotorKV, getMotorKV, getMotorOutputStatus, getMotorOutputStatus, getMotorStallCurrent, getMotorStallCurrent, getMotorVoltage, getMotorVoltage, getPosition, getPosition, getProcessorTemp, getProcessorTemp, getReverseLimit, getReverseLimit, getRobotEnable, getRobotEnable, getRotorPosition, getRotorPosition, getRotorVelocity, getRotorVelocity, getSimState, getStatorCurrent, getStatorCurrent, getStickyFault_BootDuringEnable, getStickyFault_BootDuringEnable, getStickyFault_BridgeBrownout, getStickyFault_BridgeBrownout, getStickyFault_DeviceTemp, getStickyFault_DeviceTemp, getStickyFault_ForwardHardLimit, getStickyFault_ForwardHardLimit, getStickyFault_ForwardSoftLimit, getStickyFault_ForwardSoftLimit, getStickyFault_FusedSensorOutOfSync, getStickyFault_FusedSensorOutOfSync, getStickyFault_Hardware, getStickyFault_Hardware, getStickyFault_MissingDifferentialFX, getStickyFault_MissingDifferentialFX, getStickyFault_MissingHardLimitRemote, getStickyFault_MissingHardLimitRemote, getStickyFault_MissingSoftLimitRemote, getStickyFault_MissingSoftLimitRemote, getStickyFault_OverSupplyV, getStickyFault_OverSupplyV, getStickyFault_ProcTemp, getStickyFault_ProcTemp, getStickyFault_RemoteSensorDataInvalid, getStickyFault_RemoteSensorDataInvalid, getStickyFault_RemoteSensorPosOverflow, getStickyFault_RemoteSensorPosOverflow, getStickyFault_RemoteSensorReset, getStickyFault_RemoteSensorReset, getStickyFault_ReverseHardLimit, getStickyFault_ReverseHardLimit, getStickyFault_ReverseSoftLimit, getStickyFault_ReverseSoftLimit, getStickyFault_RotorFault1, getStickyFault_RotorFault1, getStickyFault_RotorFault2, getStickyFault_RotorFault2, getStickyFault_StaticBrakeDisabled, getStickyFault_StaticBrakeDisabled, getStickyFault_StatorCurrLimit, getStickyFault_StatorCurrLimit, getStickyFault_SupplyCurrLimit, getStickyFault_SupplyCurrLimit, getStickyFault_Undervoltage, getStickyFault_Undervoltage, getStickyFault_UnlicensedFeatureInUse, getStickyFault_UnlicensedFeatureInUse, getStickyFault_UnstableSupplyV, getStickyFault_UnstableSupplyV, getStickyFault_UsingFusedCANcoderWhileUnlicensed, getStickyFault_UsingFusedCANcoderWhileUnlicensed, getStickyFaultField, getStickyFaultField, getSupplyCurrent, getSupplyCurrent, getSupplyVoltage, getSupplyVoltage, getTorqueCurrent, getTorqueCurrent, getVelocity, getVelocity, getVersion, getVersion, getVersionBugfix, getVersionBugfix, getVersionBuild, getVersionBuild, getVersionMajor, getVersionMajor, getVersionMinor, getVersionMinor, registerAlerts, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setPosition, setPosition, setPosition, setPosition

    Methods inherited from class com.ctre.phoenix6.hardware.ParentDevice

    getAppliedControl, getDeviceHash, getDeviceID, getIsConnectedChecker, getIsConnectedChecker, getNetwork, getResetOccurredChecker, hasResetOccurred, isConnected, isConnected, lookupStatusSignal, lookupStatusSignal, optimizeBusUtilization, optimizeBusUtilization, optimizeBusUtilization, optimizeBusUtilization, optimizeBusUtilization, optimizeBusUtilizationForAll, optimizeBusUtilizationForAll, optimizeBusUtilizationForAll, resetSignalFrequencies, resetSignalFrequencies, resetSignalFrequenciesForAll, toString

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.ctre.phoenix6.hardware.traits.CommonDevice

    getAppliedControl, getDeviceHash, getDeviceID, getIsConnectedChecker, getIsConnectedChecker, getNetwork, getResetOccurredChecker, hasResetOccurred, isConnected, isConnected, optimizeBusUtilization, optimizeBusUtilization, optimizeBusUtilization, optimizeBusUtilization, optimizeBusUtilization, resetSignalFrequencies, resetSignalFrequencies
  • Field Details

    • supplyCurrent

      private final com.ctre.phoenix6.StatusSignal<org.wpilib.units.measure.Current> supplyCurrent
    • statorCurrent

      private final com.ctre.phoenix6.StatusSignal<org.wpilib.units.measure.Current> statorCurrent
    • temperature

      private final com.ctre.phoenix6.StatusSignal<org.wpilib.units.measure.Temperature> temperature
    • position

      private final com.ctre.phoenix6.StatusSignal<org.wpilib.units.measure.Angle> position
    • appliedVoltage

      private final com.ctre.phoenix6.StatusSignal<org.wpilib.units.measure.Voltage> appliedVoltage
    • velocity

      private final com.ctre.phoenix6.StatusSignal<org.wpilib.units.measure.AngularVelocity> velocity
    • additionalSignals

      private final List<com.ctre.phoenix6.StatusSignal<?>> additionalSignals
    • additionalSignalAlerts

      private final List<org.wpilib.util.Alert> additionalSignalAlerts
  • Constructor Details

    • LoggedTalonFX

      public LoggedTalonFX(int deviceId, com.ctre.phoenix6.CANBus bus)
    • LoggedTalonFX

      public LoggedTalonFX(int deviceId)
  • Method Details

    • withSignal

      public <T> LoggedTalonFX withSignal(com.ctre.phoenix6.StatusSignal<T> signal)
      Adds a status signal to be logged and replayed.
      Parameters:
      signal - The status signal to log.
      Returns:
      This instance of the class, for method chaining.
    • updateInputs

      public void updateInputs(TalonFXInputs inputs)
      Refreshes the motor status signals and updates the provided inputs.
      Parameters:
      inputs - The inputs object to update.