Class TalonFXWrapper

java.lang.Object
com.ctre.phoenix6.jni.CtreJniWrapper
com.ctre.phoenix6.hardware.ParentDevice
com.ctre.phoenix6.hardware.core.CoreTalonFX
com.ctre.phoenix6.hardware.TalonFX
frc.robot.motors.TalonFXWrapper
All Implemented Interfaces:
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, edu.wpi.first.util.sendable.Sendable, LoggedMotor, AutoCloseable

public class TalonFXWrapper extends com.ctre.phoenix6.hardware.TalonFX implements LoggedMotor
TalonFx wrapper class, using DC motor sim + sim states.
  • 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
    static final double
     

    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
    TalonFXWrapper(int deviceId)
    Constructor with device ID.
    TalonFXWrapper(int deviceId, edu.wpi.first.math.system.plant.DCMotor motorConfigs)
    Constructor with device ID and motor type.
    TalonFXWrapper(int deviceId, String canbus)
    Constructor with device ID and CAN bus string.
    TalonFXWrapper(int deviceId, String canbus, edu.wpi.first.math.system.plant.DCMotor motorConfigs)
    Constructor with device ID, CAN bus string, and motor type.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the unique identifier of a motor for logging purposes.
    double
    Gets the current of the motor in amperes.
    double
    Gets the position of the motor in rotations.
    double
    Gets the setpoint of the motor in range [-1, 1].
    double
    Gets the angular velocity of the motor in rotations per minute.
    double
    Gets the voltage of the motor in volts.
    void
    setRawPosition(double pos)
    Sets the raw position of the motor.
    void
    Updates the motors every tick.

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

    close, disable, feed, get, getDescription, getExpiration, initSendable, isAlive, isSafetyEnabled, set, setControlPrivate, setExpiration, setNeutralMode, setNeutralMode, setSafetyEnabled, 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_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_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_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, 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, getNetwork, getResetOccurredChecker, hasResetOccurred, isConnected, isConnected, lookupStatusSignal, lookupStatusSignal, optimizeBusUtilization, optimizeBusUtilization, optimizeBusUtilization, optimizeBusUtilization, optimizeBusUtilization, optimizeBusUtilizationForAll, optimizeBusUtilizationForAll, optimizeBusUtilizationForAll, resetSignalFrequencies, resetSignalFrequencies, resetSignalFrequenciesForAll

    Methods inherited from class java.lang.Object

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

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

    getAppliedControl, getDeviceHash, getDeviceID, getNetwork, getResetOccurredChecker, hasResetOccurred, isConnected, isConnected, optimizeBusUtilization, optimizeBusUtilization, optimizeBusUtilization, optimizeBusUtilization, optimizeBusUtilization, resetSignalFrequencies, resetSignalFrequencies

    Methods inherited from interface frc.robot.motors.LoggedMotor

    init
  • Field Details

  • Constructor Details

    • TalonFXWrapper

      public TalonFXWrapper(int deviceId)
      Constructor with device ID.
      Parameters:
      deviceId - the CAN ID of the motor
    • TalonFXWrapper

      public TalonFXWrapper(int deviceId, edu.wpi.first.math.system.plant.DCMotor motorConfigs)
      Constructor with device ID and motor type.
      Parameters:
      deviceId - the CAN ID of the motor
      motorConfigs - the motor type
    • TalonFXWrapper

      public TalonFXWrapper(int deviceId, String canbus)
      Constructor with device ID and CAN bus string.
      Parameters:
      deviceId - the CAN ID of the motor
      canbus - the string form of the canbus
    • TalonFXWrapper

      public TalonFXWrapper(int deviceId, String canbus, edu.wpi.first.math.system.plant.DCMotor motorConfigs)
      Constructor with device ID, CAN bus string, and motor type.
      Parameters:
      deviceId - the CAN ID of the motor
      canbus - the string form of the canbus
      motorConfigs - the motor type
  • Method Details

    • updateSimState

      public void updateSimState()
      Description copied from interface: LoggedMotor
      Updates the motors every tick.
      Specified by:
      updateSimState in interface LoggedMotor
    • getIdentifier

      public String getIdentifier()
      Description copied from interface: LoggedMotor
      Gets the unique identifier of a motor for logging purposes. This value is intended to be the CAN ID.
      Specified by:
      getIdentifier in interface LoggedMotor
      Returns:
      the unique identifier for the motor
    • getLoggedPosition

      public double getLoggedPosition()
      Description copied from interface: LoggedMotor
      Gets the position of the motor in rotations.
      Specified by:
      getLoggedPosition in interface LoggedMotor
      Returns:
      the position of the motor in rotations
    • getLoggedVelocity

      public double getLoggedVelocity()
      Description copied from interface: LoggedMotor
      Gets the angular velocity of the motor in rotations per minute.
      Specified by:
      getLoggedVelocity in interface LoggedMotor
      Returns:
      the angular velocity of the motor in rotations per minute
    • getLoggedSetpoint

      public double getLoggedSetpoint()
      Description copied from interface: LoggedMotor
      Gets the setpoint of the motor in range [-1, 1].
      Specified by:
      getLoggedSetpoint in interface LoggedMotor
      Returns:
      the setpoint in range [-1, 1]
    • getLoggedVoltage

      public double getLoggedVoltage()
      Description copied from interface: LoggedMotor
      Gets the voltage of the motor in volts.
      Specified by:
      getLoggedVoltage in interface LoggedMotor
      Returns:
      the voltage of the motor
    • getLoggedCurrent

      public double getLoggedCurrent()
      Description copied from interface: LoggedMotor
      Gets the current of the motor in amperes.
      Specified by:
      getLoggedCurrent in interface LoggedMotor
      Returns:
      the current of the motor
    • setRawPosition

      public void setRawPosition(double pos)
      Sets the raw position of the motor.
      Parameters:
      pos - the position to set