phoenix6.hardware.talon_fxs

Module Contents

class phoenix6.hardware.talon_fxs.TalonFXS(device_id: int, canbus: phoenix6.canbus.CANBus)

Bases: phoenix6.hardware.core.core_talon_fxs.CoreTalonFXS

Class description for the Talon FXS motor controller.

Constructs a new Talon FXS motor controller object.

Parameters:
  • device_id (int) – ID of the device, as configured in Phoenix Tuner

  • canbus (CANBus) – The CAN bus this device is on

classmethod none() Self

Constructs a stubbed-out TalonFXS, where all status signals, controls, configs, etc. perform no action and immediately return OK. This can be used to silence error messages for devices that have been completely removed from the robot.

Returns:

Stubbed-out TalonFXS

Return type:

TalonFXS

close()
setThrottle(throttle: float)

Sets the throttle of the motor controller.

Parameters:

throttle (float) – The throttle where -1 indicates full reverse and 1 indicates full forward.

setVoltage(voltage: wpimath.units.volts)

Sets the direct voltage output of the motor controller.

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).

Parameters:

voltage (units.volts) – The voltage.

getThrottle() float

Gets the throttle of the motor controller.

Returns:

The throttle where -1 represents full reverse and 1 represents full forward.

Return type:

float

disable()

Disables the motor controller.

configNeutralMode(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. This is equivalent to setting the MotorOutputConfigs.neutral_mode when applying a TalonFXSConfiguration to the motor.

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:

StatusCode

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

stopMotor()

Called to stop the motor when the timeout expires.

getDescription() str
Returns:

Description of the motor controller

Return type:

str