Class WPI_TalonFX
java.lang.Object
com.ctre.phoenix.motorcontrol.can.BaseMotorController
com.ctre.phoenix.motorcontrol.can.BaseTalon
com.ctre.phoenix.motorcontrol.can.TalonFX
com.ctre.phoenix.motorcontrol.can.WPI_TalonFX
- All Implemented Interfaces:
IFollower
,IMotorController
,IMotorControllerEnhanced
,IInvertable
,IOutputSignal
,Sendable
,MotorController
,AutoCloseable
@Deprecated(since="2024", forRemoval=true) public class WPI_TalonFX extends TalonFX implements MotorController, Sendable, AutoCloseable
Deprecated, for removal: This API element is subject to removal in a future version.
This device's Phoenix 5 API is deprecated for removal in the
2025 season. Users should update to Phoenix 6 firmware and migrate to the
Phoenix 6 API. A migration guide is available at
https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html.
If the Phoenix 5 API must be used for this device, the device must have 22.X firmware. This firmware is available in Tuner X after selecting Phoenix 5 in the firmware year dropdown.
CTRE Talon FX Motor Controller when used on CAN Bus.
-
Field Summary
Fields Modifier and Type Field Description static double
kDefaultSafetyExpiration
Deprecated, for removal: This API element is subject to removal in a future version.The default motor safety timeout IF calling application enables the feature. -
Constructor Summary
Constructors Constructor Description WPI_TalonFX(int deviceNumber)
Deprecated, for removal: This API element is subject to removal in a future version.Constructor for motor controllerWPI_TalonFX(int deviceNumber, String canbus)
Deprecated, for removal: This API element is subject to removal in a future version.Constructor for motor controller -
Method Summary
Modifier and Type Method Description void
close()
Deprecated, for removal: This API element is subject to removal in a future version.void
disable()
Deprecated, for removal: This API element is subject to removal in a future version.Common interface for disabling a motor.void
feed()
Deprecated, for removal: This API element is subject to removal in a future version.Feed the motor safety object.double
get()
Deprecated, for removal: This API element is subject to removal in a future version.Common interface for getting the current set speed of a speed controller.String
getDescription()
Deprecated, for removal: This API element is subject to removal in a future version.double
getExpiration()
Deprecated, for removal: This API element is subject to removal in a future version.Retrieve the timeout value for the corresponding motor safety object.boolean
getInverted()
Deprecated, for removal: This API element is subject to removal in a future version.Common interface for returning the inversion state of a speed controller.void
initSendable(SendableBuilder builder)
Deprecated, for removal: This API element is subject to removal in a future version.Initialize sendableboolean
isAlive()
Deprecated, for removal: This API element is subject to removal in a future version.Determine of the motor is still operating or has timed out.boolean
isSafetyEnabled()
Deprecated, for removal: This API element is subject to removal in a future version.Return the state of the motor safety enabled flag.void
set(double speed)
Deprecated, for removal: This API element is subject to removal in a future version.Common interface for setting the speed of a simple speed controller.void
set(ControlMode mode, double value)
Deprecated, for removal: This API element is subject to removal in a future version.Sets the appropriate output on the talon, depending on the mode.void
set(ControlMode mode, double demand0, DemandType demand1Type, double demand1)
Deprecated, for removal: This API element is subject to removal in a future version.void
setExpiration(double expirationTime)
Deprecated, for removal: This API element is subject to removal in a future version.Set the expiration time for the corresponding motor safety object.void
setInverted(boolean isInverted)
Deprecated, for removal: This API element is subject to removal in a future version.Common interface for inverting direction of a speed controller.void
setSafetyEnabled(boolean enabled)
Deprecated, for removal: This API element is subject to removal in a future version.Enable/disable motor safety for this device.void
setVoltage(double outputVolts)
Deprecated, for removal: This API element is subject to removal in a future version.Sets the voltage output of the SpeedController.void
stopMotor()
Deprecated, for removal: This API element is subject to removal in a future version.Common interface to stop the motor until Set is called again.Methods inherited from class com.ctre.phoenix.motorcontrol.can.TalonFX
configAllSettings, configAllSettings, configGetMotorCommutation, configGetMotorCommutation, configGetStatorCurrentLimit, configGetStatorCurrentLimit, configGetSupplyCurrentLimit, configGetSupplyCurrentLimit, configIntegratedSensorAbsoluteRange, configIntegratedSensorAbsoluteRange, configIntegratedSensorInitializationStrategy, configIntegratedSensorInitializationStrategy, configIntegratedSensorOffset, configIntegratedSensorOffset, configMotorCommutation, configMotorCommutation, configSelectedFeedbackSensor, configStatorCurrentLimit, configStatorCurrentLimit, configSupplyCurrentLimit, configSupplyCurrentLimit, configurePID, configurePID, getAllConfigs, getAllConfigs, getPIDConfigs, getPIDConfigs, getSensorCollection, getSimCollection, set, set, setInverted
Methods inherited from class com.ctre.phoenix.motorcontrol.can.BaseTalon
configAllSettings, configAllSettings, configForwardLimitSwitchSource, configForwardLimitSwitchSource, configReverseLimitSwitchSource, configReverseLimitSwitchSource, configurePID, configurePID, configVelocityMeasurementPeriod, configVelocityMeasurementPeriod, configVelocityMeasurementPeriod, configVelocityMeasurementPeriod, configVelocityMeasurementWindow, configVelocityMeasurementWindow, getAllConfigs, getAllConfigs, getOutputCurrent, getPIDConfigs, getPIDConfigs, getStatorCurrent, getStatusFramePeriod, getStatusFramePeriod, getSupplyCurrent, getTalonFXSensorCollection, getTalonFXSimCollection, getTalonSRXSensorCollection, getTalonSRXSimCollection, isFwdLimitSwitchClosed, isRevLimitSwitchClosed, setStatusFramePeriod, setStatusFramePeriod
Methods inherited from class com.ctre.phoenix.motorcontrol.can.BaseMotorController
baseConfigAllSettings, baseConfigurePID, baseGetAllConfigs, baseGetPIDConfigs, changeMotionControlFramePeriod, clearMotionProfileHasUnderrun, clearMotionProfileHasUnderrun, clearMotionProfileTrajectories, clearStickyFaults, clearStickyFaults, config_IntegralZone, config_IntegralZone, config_kD, config_kD, config_kF, config_kF, config_kI, config_kI, config_kP, config_kP, configAllowableClosedloopError, configAllowableClosedloopError, configAuxPIDPolarity, configAuxPIDPolarity, configClearPositionOnLimitF, configClearPositionOnLimitR, configClearPositionOnQuadIdx, configClosedLoopPeakOutput, configClosedLoopPeakOutput, configClosedLoopPeriod, configClosedLoopPeriod, configClosedloopRamp, configClosedloopRamp, configFactoryDefault, configFactoryDefault, configFeedbackNotContinuous, configForwardLimitSwitchSource, configForwardLimitSwitchSource, configForwardLimitSwitchSource, configForwardSoftLimitEnable, configForwardSoftLimitEnable, configForwardSoftLimitThreshold, configForwardSoftLimitThreshold, configGetCustomParam, configGetCustomParam, configGetParameter, configGetParameter, configGetParameter, configGetParameter, configLimitSwitchDisableNeutralOnLOS, configMaxIntegralAccumulator, configMaxIntegralAccumulator, configMotionAcceleration, configMotionAcceleration, configMotionCruiseVelocity, configMotionCruiseVelocity, configMotionProfileTrajectoryInterpolationEnable, configMotionProfileTrajectoryInterpolationEnable, configMotionProfileTrajectoryPeriod, configMotionProfileTrajectoryPeriod, configMotionSCurveStrength, configMotionSCurveStrength, configNeutralDeadband, configNeutralDeadband, configNominalOutputForward, configNominalOutputForward, configNominalOutputReverse, configNominalOutputReverse, configOpenloopRamp, configOpenloopRamp, configPeakOutputForward, configPeakOutputForward, configPeakOutputReverse, configPeakOutputReverse, configPulseWidthPeriod_EdgesPerRot, configPulseWidthPeriod_FilterWindowSz, configRemoteFeedbackFilter, configRemoteFeedbackFilter, configRemoteFeedbackFilter, configRemoteFeedbackFilter, configRemoteFeedbackFilter, configRemoteFeedbackFilter, configRemoteSensorClosedLoopDisableNeutralOnLOS, configReverseLimitSwitchSource, configReverseLimitSwitchSource, configReverseLimitSwitchSource, configReverseSoftLimitEnable, configReverseSoftLimitEnable, configReverseSoftLimitThreshold, configReverseSoftLimitThreshold, configSelectedFeedbackCoefficient, configSelectedFeedbackCoefficient, configSelectedFeedbackSensor, configSelectedFeedbackSensor, configSelectedFeedbackSensor, configSelectedFeedbackSensor, configSensorTerm, configSensorTerm, configSensorTerm, configSensorTerm, configSetCustomParam, configSetCustomParam, configSetParameter, configSetParameter, configSetParameter, configSetParameter, configSoftLimitDisableNeutralOnLOS, configureFilter, configureFilter, configureFilter, configureSlot, configureSlot, configVoltageCompSaturation, configVoltageCompSaturation, configVoltageMeasurementFilter, configVoltageMeasurementFilter, DestroyObject, enableVoltageCompensation, follow, follow, getActiveTrajectoryArbFeedFwd, getActiveTrajectoryArbFeedFwd, getActiveTrajectoryPosition, getActiveTrajectoryPosition, getActiveTrajectoryVelocity, getActiveTrajectoryVelocity, getBaseID, getBusVoltage, getClosedLoopError, getClosedLoopError, getClosedLoopTarget, getClosedLoopTarget, getControlMode, getDeviceID, getErrorDerivative, getErrorDerivative, getFaults, getFilterConfigs, getFilterConfigs, getFirmwareVersion, getHandle, getIntegralAccumulator, getIntegralAccumulator, getLastError, getMotionProfileStatus, getMotionProfileTopLevelBufferCount, getMotorOutputPercent, getMotorOutputVoltage, getSelectedSensorPosition, getSelectedSensorPosition, getSelectedSensorVelocity, getSelectedSensorVelocity, getSlotConfigs, getSlotConfigs, getStatusFramePeriod, getStatusFramePeriod, getStatusFramePeriod, getStatusFramePeriod, getStickyFaults, getTemperature, getVictorSPXSimCollection, hasResetOccurred, isMotionProfileFinished, isMotionProfileTopLevelBufferFull, isVoltageCompensationEnabled, neutralOutput, overrideLimitSwitchesEnable, overrideSoftLimitsEnable, processMotionProfileBuffer, pushMotionProfileTrajectory, selectProfileSlot, setControlFramePeriod, setControlFramePeriod, setIntegralAccumulator, setIntegralAccumulator, setInverted, setNeutralMode, setSelectedSensorPosition, setSelectedSensorPosition, setSensorPhase, setStatusFramePeriod, setStatusFramePeriod, setStatusFramePeriod, setStatusFramePeriod, startMotionProfile, valueUpdated
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.ctre.phoenix.motorcontrol.IMotorController
changeMotionControlFramePeriod, clearMotionProfileHasUnderrun, clearMotionProfileTrajectories, clearStickyFaults, config_IntegralZone, config_kD, config_kF, config_kI, config_kP, configAllowableClosedloopError, configAuxPIDPolarity, configClosedLoopPeakOutput, configClosedLoopPeriod, configClosedloopRamp, configForwardLimitSwitchSource, configForwardSoftLimitEnable, configForwardSoftLimitThreshold, configGetCustomParam, configGetParameter, configGetParameter, configMaxIntegralAccumulator, configMotionAcceleration, configMotionCruiseVelocity, configMotionProfileTrajectoryPeriod, configMotionSCurveStrength, configNeutralDeadband, configNominalOutputForward, configNominalOutputReverse, configOpenloopRamp, configPeakOutputForward, configPeakOutputReverse, configRemoteFeedbackFilter, configRemoteFeedbackFilter, configRemoteFeedbackFilter, configReverseLimitSwitchSource, configReverseSoftLimitEnable, configReverseSoftLimitThreshold, configSelectedFeedbackCoefficient, configSelectedFeedbackSensor, configSensorTerm, configSetCustomParam, configSetParameter, configSetParameter, configVoltageCompSaturation, configVoltageMeasurementFilter, enableVoltageCompensation, getActiveTrajectoryPosition, getActiveTrajectoryVelocity, getBaseID, getBusVoltage, getClosedLoopError, getClosedLoopTarget, getControlMode, getDeviceID, getErrorDerivative, getFaults, getFirmwareVersion, getIntegralAccumulator, getLastError, getMotionProfileStatus, getMotionProfileTopLevelBufferCount, getMotorOutputPercent, getMotorOutputVoltage, getSelectedSensorPosition, getSelectedSensorVelocity, getStatusFramePeriod, getStickyFaults, getTemperature, hasResetOccurred, isMotionProfileTopLevelBufferFull, neutralOutput, overrideLimitSwitchesEnable, overrideSoftLimitsEnable, processMotionProfileBuffer, pushMotionProfileTrajectory, selectProfileSlot, setControlFramePeriod, setIntegralAccumulator, setInverted, setNeutralMode, setSelectedSensorPosition, setSensorPhase, setStatusFramePeriod
Methods inherited from interface com.ctre.phoenix.motorcontrol.IMotorControllerEnhanced
configSelectedFeedbackSensor
-
Field Details
-
kDefaultSafetyExpiration
Deprecated, for removal: This API element is subject to removal in a future version.The default motor safety timeout IF calling application enables the feature.- See Also:
- Constant Field Values
-
-
Constructor Details
-
WPI_TalonFX
Deprecated, for removal: This API element is subject to removal in a future version.Constructor for motor controller- Parameters:
deviceNumber
- device ID of motor controllercanbus
- Name of the CANbus; can be a CANivore device name or serial number. Pass in nothing or "rio" to use the roboRIO.
-
WPI_TalonFX
Deprecated, for removal: This API element is subject to removal in a future version.Constructor for motor controller- Parameters:
deviceNumber
- device ID of motor controller
-
-
Method Details
-
close
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
close
in interfaceAutoCloseable
-
set
Deprecated, for removal: This API element is subject to removal in a future version.Common interface for setting the speed of a simple speed controller.- Specified by:
set
in interfaceMotorController
- Parameters:
speed
- The speed to set. Value should be between -1.0 and 1.0. Value is also saved for Get().
-
get
Deprecated, for removal: This API element is subject to removal in a future version.Common interface for getting the current set speed of a speed controller.- Specified by:
get
in interfaceMotorController
- Returns:
- The current set speed. Value is between -1.0 and 1.0.
-
set
Deprecated, for removal: This API element is subject to removal in a future version.Sets the appropriate output on the talon, depending on the mode.- Specified by:
set
in interfaceIMotorController
- Overrides:
set
in classBaseMotorController
- Parameters:
mode
- The output mode to apply. In PercentOutput, the output is between -1.0 and 1.0, with 0.0 as stopped. In Current mode, output value is in amperes. In Velocity mode, output value is in position change / 100ms. In Position mode, output value is in encoder ticks or an analog value, depending on the sensor. In Follower mode, the output value is the integer device ID of the talon to duplicate.value
- The setpoint value, as described above. Standard Driving Example: _talonLeft.set(ControlMode.PercentOutput, leftJoy); _talonRght.set(ControlMode.PercentOutput, rghtJoy);
-
set
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
set
in interfaceIMotorController
- Overrides:
set
in classBaseMotorController
- Parameters:
mode
- Sets the appropriate output on the talon, depending on the mode.demand0
- The output value to apply. such as advanced feed forward and/or auxiliary close-looping in firmware. In PercentOutput, the output is between -1.0 and 1.0, with 0.0 as stopped. In Current mode, output value is in amperes. In Velocity mode, output value is in position change / 100ms. In Position mode, output value is in encoder ticks or an analog value, depending on the sensor. See In Follower mode, the output value is the integer device ID of the talon to duplicate.demand1Type
- The demand type for demand1. Neutral: Ignore demand1 and apply no change to the demand0 output. AuxPID: Use demand1 to set the target for the auxiliary PID 1. ArbitraryFeedForward: Use demand1 as an arbitrary additive value to the demand0 output. In PercentOutput the demand0 output is the motor output, and in closed-loop modes the demand0 output is the output of PID0.demand1
- Supplmental output value. Units match the set mode. Arcade Drive Example: _talonLeft.set(ControlMode.PercentOutput, joyForward, DemandType.ArbitraryFeedForward, +joyTurn); _talonRght.set(ControlMode.PercentOutput, joyForward, DemandType.ArbitraryFeedForward, -joyTurn); Drive Straight Example: Note: Selected Sensor Configuration is necessary for both PID0 and PID1. _talonLeft.follow(_talonRght, FollwerType.AuxOutput1); _talonRght.set(ControlMode.PercentOutput, joyForward, DemandType.AuxPID, desiredRobotHeading); Drive Straight to a Distance Example: Note: Other configurations (sensor selection, PID gains, etc.) need to be set. _talonLeft.follow(_talonRght, FollwerType.AuxOutput1); _talonRght.set(ControlMode.MotionMagic, targetDistance, DemandType.AuxPID, desiredRobotHeading);
-
setVoltage
Deprecated, for removal: This API element is subject to removal in a future version.Sets the voltage output of the SpeedController. Compensates for the current bus voltage to ensure that the desired voltage is output even if the battery voltage is below 12V - highly useful when the voltage outputs are "meaningful" (e.g. they come from a feedforward calculation).NOTE: This function *must* be called regularly in order for voltage compensation to work properly - unlike the ordinary set function, it is not "set it and forget it."
- Specified by:
setVoltage
in interfaceMotorController
- Parameters:
outputVolts
- The voltage to output.
-
setInverted
Deprecated, for removal: This API element is subject to removal in a future version.Common interface for inverting direction of a speed controller.- Specified by:
setInverted
in interfaceIInvertable
- Specified by:
setInverted
in interfaceIMotorController
- Specified by:
setInverted
in interfaceMotorController
- Overrides:
setInverted
in classBaseMotorController
- Parameters:
isInverted
- The state of inversion, true is inverted.
-
getInverted
Deprecated, for removal: This API element is subject to removal in a future version.Common interface for returning the inversion state of a speed controller.- Specified by:
getInverted
in interfaceIInvertable
- Specified by:
getInverted
in interfaceIMotorController
- Specified by:
getInverted
in interfaceMotorController
- Overrides:
getInverted
in classBaseMotorController
- Returns:
- The state of inversion, true is inverted.
-
disable
Deprecated, for removal: This API element is subject to removal in a future version.Common interface for disabling a motor.- Specified by:
disable
in interfaceMotorController
-
stopMotor
Deprecated, for removal: This API element is subject to removal in a future version.Common interface to stop the motor until Set is called again.- Specified by:
stopMotor
in interfaceMotorController
-
initSendable
Deprecated, for removal: This API element is subject to removal in a future version.Initialize sendable- Specified by:
initSendable
in interfaceSendable
- Parameters:
builder
- Base sendable to build on
-
getDescription
Deprecated, for removal: This API element is subject to removal in a future version.- Returns:
- description of controller
-
feed
Deprecated, for removal: This API element is subject to removal in a future version.Feed the motor safety object.Resets the timer on this object that is used to do the timeouts.
-
setExpiration
Deprecated, for removal: This API element is subject to removal in a future version.Set the expiration time for the corresponding motor safety object.- Parameters:
expirationTime
- The timeout value in seconds.
-
getExpiration
Deprecated, for removal: This API element is subject to removal in a future version.Retrieve the timeout value for the corresponding motor safety object.- Returns:
- the timeout value in seconds.
-
isAlive
Deprecated, for removal: This API element is subject to removal in a future version.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
Deprecated, for removal: This API element is subject to removal in a future version.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
Deprecated, for removal: This API element is subject to removal in a future version.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
-