phoenix6.hardware.talon_fx
#
Module Contents#
- class phoenix6.hardware.talon_fx.TalonFX(device_id: int, canbus: str | phoenix6.canbus.CANBus = '')#
Bases:
phoenix6.hardware.core.core_talon_fx.CoreTalonFX
,wpiutil.Sendable
Constructs a new Talon FX motor controller object.
- Parameters:
device_id (int) – ID of the device, as configured in Phoenix Tuner.
canbus (str | CANBus, optional) –
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
- close()#
- set(speed: float)#
Common interface for setting the speed of a motor controller.
- Parameters:
speed (float) – The speed to set. Value should be between -1.0 and 1.0.
- setVoltage(volts: wpimath.units.volts)#
Common interface for seting the direct voltage output of a motor controller.
- Parameters:
volts (units.volts) – The voltage to output.
- get() float #
Common interface for getting the current set speed of a motor controller.
- Returns:
The current set speed. Value is between -1.0 and 1.0.
- Return type:
float
- disable()#
Common interface for disabling a motor controller.
- stopMotor()#
Common interface to stop motor movement until set is called again.
- setNeutralMode(neutralMode: phoenix6.signals.NeutralModeValue, timeout_seconds: wpimath.units.seconds = 0.1) phoenix6.status_code.StatusCode #
Sets the mode of operation when output is neutral or disabled.
Since neutral mode is a config, this API is blocking. We recommend that users avoid calling this API periodically.
- Parameters:
neutralMode (signals.NeutralModeValue) – The state of the motor controller bridge when output is neutral or disabled
timeout_seconds (units.seconds) – Maximum amount of time to wait when performing configuration
- Returns:
Status of refreshing and applying the neutral mode config
- Return type:
- initSendable(builder: wpiutil.SendableBuilder)#
- getDescription() str #
- Returns:
Description of motor
- Return type:
str
- feed()#
- setExpiration(expirationTime: wpimath.units.seconds)#
Set the expiration time for the corresponding motor safety object.
- Parameters:
expirationTime (units.seconds) – The timeout value in seconds.
- getExpiration() wpimath.units.seconds #
Retrieve the timeout value for the corresponding motor safety object.
- Returns:
the timeout value in seconds.
- Return type:
units.seconds
- isAlive() bool #
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
- Return type:
bool
- setSafetyEnabled(enabled: bool)#
Enable/disable motor safety for this device.
Turn on and off the motor safety option for this object.
- Parameters:
enabled (bool) – True if motor safety is enforced for this object.
- isSafetyEnabled() bool #
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
- Return type:
bool