Package com.ctre.phoenixpro.hardware
Class TalonFX
java.lang.Object
com.ctre.phoenixpro.jni.CtreJniWrapper
com.ctre.phoenixpro.hardware.ParentDevice
com.ctre.phoenixpro.hardware.core.CoreTalonFX
com.ctre.phoenixpro.hardware.TalonFX
- All Implemented Interfaces:
Sendable,MotorController,AutoCloseable
public class TalonFX extends CoreTalonFX implements MotorController, Sendable, AutoCloseable
-
Nested Class Summary
Nested classes/interfaces inherited from class com.ctre.phoenixpro.hardware.ParentDevice
ParentDevice.MapGenerator<T> -
Field Summary
Fields Modifier and Type Field Description static doublekDefaultSafetyExpirationThe default motor safety timeout IF calling application enables the feature.Fields inherited from class com.ctre.phoenixpro.hardware.ParentDevice
deviceIdentifier, kDefaultControlRatePeriodsSec -
Constructor Summary
-
Method Summary
Modifier and Type Method Description voidclose()voiddisable()Common interface for disabling a motor controller.voidfeed()Feed the motor safety object.doubleget()Common interface for getting the current set speed of a motor controller.StringgetDescription()doublegetExpiration()Retrieve the timeout value for the corresponding motor safety object.booleangetInverted()Common interface for returning the inversion state of a motor controller.voidinitSendable(SendableBuilder builder)booleanisAlive()Determine of the motor is still operating or has timed out.booleanisSafetyEnabled()Return the state of the motor safety enabled flag.voidset(double speed)Common interface for setting the speed of a motor controller.protected StatusCodesetControlPrivate(ControlRequest request)voidsetExpiration(double expirationTime)Set the expiration time for the corresponding motor safety object.voidsetInverted(boolean isInverted)Common interface for inverting direction of a motor controller.voidsetSafetyEnabled(boolean enabled)Enable/disable motor safety for this device.voidsetVoltage(double volts)Common interface for seting the direct voltage output of a motor controller.voidstopMotor()Common interface to stop motor movement until set is called again.Methods inherited from class com.ctre.phoenixpro.hardware.core.CoreTalonFX
clearStickyFaults, clearStickyFaults, getAppliedRotorPolarity, getBridgeOuput, getClosedLoopDerivativeOutput, getClosedLoopError, getClosedLoopFeedForward, getClosedLoopIntegratedOutput, getClosedLoopOutput, getClosedLoopProportionalOutput, getClosedLoopReference, getClosedLoopReferenceSlope, getClosedLoopSlot, getConfigurator, getControlMode, getDeviceEnable, getDeviceTemp, getDutyCycle, getFault_BootDuringEnable, getFault_DeviceTemp, getFault_ForwardHardLimit, getFault_ForwardSoftLimit, getFault_FusedSensorOutOfSync, getFault_Hardware, getFault_MissingRemoteSensor, getFault_OverSupplyV, getFault_ProcTemp, getFault_ReverseHardLimit, getFault_ReverseSoftLimit, getFault_StatorCurrLimit, getFault_SupplyCurrLimit, getFault_Undervoltage, getFault_UnstableSupplyV, getFaultField, getForwardLimit, getMotionMagicIsRunning, getPosition, getProcessorTemp, getReverseLimit, getRotorPosition, getRotorVelocity, getSimState, getStatorCurrent, getStickyFault_BootDuringEnable, getStickyFault_DeviceTemp, getStickyFault_ForwardHardLimit, getStickyFault_ForwardSoftLimit, getStickyFault_FusedSensorOutOfSync, getStickyFault_Hardware, getStickyFault_MissingRemoteSensor, getStickyFault_OverSupplyV, getStickyFault_ProcTemp, getStickyFault_ReverseHardLimit, getStickyFault_ReverseSoftLimit, getStickyFault_StatorCurrLimit, getStickyFault_SupplyCurrLimit, getStickyFault_Undervoltage, getStickyFault_UnstableSupplyV, getStickyFaultField, getSupplyCurrent, getSupplyVoltage, getTorqueCurrent, getVelocity, getVersion, getVersionBugfix, getVersionBuild, getVersionMajor, getVersionMinor, hasResetOccurred, reportIfTooOld, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setControl, setRotorPosition, setRotorPositionMethods inherited from class com.ctre.phoenixpro.hardware.ParentDevice
getAppliedControl, getCANBus, getDeviceID, lookupStatusSignalValue, lookupStatusSignalValue
-
Field Details
-
kDefaultSafetyExpiration
The default motor safety timeout IF calling application enables the feature.- See Also:
- Constant Field Values
-
-
Constructor Details
-
TalonFX
Constructs a new Talon FX motor controller object.Constructs the device using the default CAN bus for the system:
- "rio" on roboRIO
- "can0" on Linux
- "*" on Windows
- Parameters:
deviceId- ID of the device, as configured in Phoenix Tuner.
-
TalonFX
Constructs a new Talon FX motor controller object.- Parameters:
deviceId- ID of the device, as configured in Phoenix Tuner.canbus- Name of the CAN bus this device is on. Possible CAN bus strings are:- "rio" for the native roboRIO CAN bus
- CANivore name or serial number
- SocketCAN interface (non-FRC Linux only)
- "*" for any CANivore seen by the program
- empty string (default) to select the default for the
system:
- "rio" on roboRIO
- "can0" on Linux
- "*" on Windows
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable
-
set
Common interface for setting the speed of a motor controller.- Specified by:
setin interfaceMotorController- Parameters:
speed- The speed to set. Value should be between -1.0 and 1.0.
-
setVoltage
Common interface for seting the direct voltage output of a motor controller.- Specified by:
setVoltagein interfaceMotorController- Parameters:
volts- The voltage to output.
-
get
Common interface for getting the current set speed of a motor controller.- Specified by:
getin interfaceMotorController- Returns:
- The current set speed. Value is between -1.0 and 1.0.
-
setControlPrivate
- Overrides:
setControlPrivatein classParentDevice
-
disable
Common interface for disabling a motor controller.- Specified by:
disablein interfaceMotorController
-
stopMotor
Common interface to stop motor movement until set is called again.- Specified by:
stopMotorin interfaceMotorController
-
setInverted
Common interface for inverting direction of a motor controller.- Specified by:
setInvertedin interfaceMotorController- Parameters:
isInverted- The state of inversion, true is inverted.
-
getInverted
Common interface for returning the inversion state of a motor controller.- Specified by:
getInvertedin interfaceMotorController- Returns:
- The state of the inversion, true is inverted.
-
initSendable
- Specified by:
initSendablein interfaceSendable
-
getDescription
- Returns:
- Description of motor controller
-
feed
Feed the motor safety object.Resets the timer on this object that is used to do the timeouts.
-
setExpiration
Set the expiration time for the corresponding motor safety object.- Parameters:
expirationTime- The timeout value in seconds.
-
getExpiration
Retrieve the timeout value for the corresponding motor safety object.- Returns:
- the timeout value in seconds.
-
isAlive
Determine of the motor is still operating or has timed out.- Returns:
- a true value if the motor is still operating normally and hasn't timed out.
-
setSafetyEnabled
Enable/disable motor safety for this device.Turn on and off the motor safety option for this PWM object.
- Parameters:
enabled- True if motor safety is enforced for this object
-
isSafetyEnabled
Return the state of the motor safety enabled flag.Return if the motor safety is currently enabled for this device.
- Returns:
- True if motor safety is enforced for this device
-