Package frc.robot.motors
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.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
-
Nested Class Summary
Nested classes/interfaces inherited from class com.ctre.phoenix6.hardware.ParentDevice
com.ctre.phoenix6.hardware.ParentDevice.MapGenerator<T extends Object> -
Field Summary
FieldsFields inherited from class com.ctre.phoenix6.hardware.TalonFX
kDefaultSafetyExpirationFields inherited from class com.ctre.phoenix6.hardware.ParentDevice
_emptyControl, deviceIdentifier -
Constructor Summary
ConstructorsConstructorDescriptionTalonFXWrapper(int deviceId) Constructor with device ID.TalonFXWrapper(int deviceId, edu.wpi.first.math.system.plant.DCMotor motorType) 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 motorType) Constructor with device ID, CAN bus string, and motor type. -
Method Summary
Modifier and TypeMethodDescriptionGets the unique identifier of a motor for logging purposes.doubleGets the position of the motor in rotations.doubleGets the setpoint of the motor in range [-1, 1].doubleGets the angular velocity of the motor in rotations per minute.doublea.voidsetRawPosition(double pos) Sets the raw position of the motor.voidupdate()Updates the motors every tick.Methods inherited from class com.ctre.phoenix6.hardware.TalonFX
close, disable, feed, get, getDescription, getExpiration, getInverted, initSendable, isAlive, isSafetyEnabled, set, setControlPrivate, setExpiration, setInverted, setNeutralMode, setNeutralMode, setSafetyEnabled, setVoltage, stopMotorMethods 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, getMotionMagicIsRunning, getMotionMagicIsRunning, getMotorKT, getMotorKT, getMotorKV, getMotorKV, getMotorOutputStatus, getMotorOutputStatus, getMotorStallCurrent, getMotorStallCurrent, getMotorVoltage, getMotorVoltage, getPosition, getPosition, getProcessorTemp, getProcessorTemp, getReverseLimit, getReverseLimit, 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, setPosition, setPosition, setPosition, setPositionMethods inherited from class com.ctre.phoenix6.hardware.ParentDevice
getAppliedControl, getDeviceHash, getDeviceID, getNetwork, getResetOccurredChecker, hasResetOccurred, isConnected, isConnected, lookupStatusSignal, lookupStatusSignal, optimizeBusUtilization, optimizeBusUtilization, optimizeBusUtilization, optimizeBusUtilizationForAll, optimizeBusUtilizationForAll, resetSignalFrequencies, resetSignalFrequencies, resetSignalFrequenciesForAllMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface frc.robot.motors.LoggedMotor
init
-
Field Details
-
LOOP_PERIOD_MS
public static final double LOOP_PERIOD_MS- See Also:
-
-
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 motorType) Constructor with device ID and motor type.- Parameters:
deviceId- the CAN ID of the motormotorType- the motor type
-
TalonFXWrapper
Constructor with device ID and CAN bus string.- Parameters:
deviceId- the CAN ID of the motorcanbus- the string form of the canbus
-
TalonFXWrapper
public TalonFXWrapper(int deviceId, String canbus, edu.wpi.first.math.system.plant.DCMotor motorType) Constructor with device ID, CAN bus string, and motor type.- Parameters:
deviceId- the CAN ID of the motorcanbus- the string form of the canbusmotorType- the motor type
-
-
Method Details
-
update
public void update()Description copied from interface:LoggedMotorUpdates the motors every tick.- Specified by:
updatein interfaceLoggedMotor
-
getIdentifier
Description copied from interface:LoggedMotorGets the unique identifier of a motor for logging purposes. This value is intended to be the CAN ID.- Specified by:
getIdentifierin interfaceLoggedMotor- Returns:
- the unique identifier for the motor
-
getLoggedPosition
public double getLoggedPosition()Description copied from interface:LoggedMotorGets the position of the motor in rotations.- Specified by:
getLoggedPositionin interfaceLoggedMotor- Returns:
- the position of the motor in rotations
-
getLoggedVelocity
public double getLoggedVelocity()Description copied from interface:LoggedMotorGets the angular velocity of the motor in rotations per minute.- Specified by:
getLoggedVelocityin interfaceLoggedMotor- Returns:
- the angular velocity of the motor in rotations per minute
-
getLoggedSetpoint
public double getLoggedSetpoint()Description copied from interface:LoggedMotorGets the setpoint of the motor in range [-1, 1].- Specified by:
getLoggedSetpointin interfaceLoggedMotor- Returns:
- the setpoint in range [-1, 1]
-
getLoggedVoltage
public double getLoggedVoltage()Description copied from interface:LoggedMotora.- Specified by:
getLoggedVoltagein interfaceLoggedMotor- Returns:
- a
-
setRawPosition
public void setRawPosition(double pos) Sets the raw position of the motor.- Parameters:
pos- the position to set
-