:py:mod:`phoenix6.hardware.talon_fx` ==================================== .. py:module:: phoenix6.hardware.talon_fx Module Contents --------------- .. py:class:: TalonFX(device_id: int, canbus: phoenix6.canbus.CANBus) Bases: :py:obj:`phoenix6.hardware.core.core_talon_fx.CoreTalonFX`, :py:obj:`telemetry.TelemetryLoggable` Class description for the Talon FX integrated motor controller. Constructs a new Talon FX motor controller object. :param device_id: ID of the device, as configured in Phoenix Tuner :type device_id: int :param canbus: The CAN bus this device is on :type canbus: CANBus .. py:method:: none() -> Self :classmethod: Constructs a stubbed-out TalonFX, 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 TalonFX :rtype: TalonFX .. py:method:: close() .. py:method:: set_throttle(throttle: float) Sets the throttle of the motor controller. :param throttle: The throttle where -1 indicates full reverse and 1 indicates full forward. :type throttle: float .. py:method:: set_voltage(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). :param voltage: The voltage. :type voltage: units.volts .. py:method:: get_throttle() -> float Gets the throttle of the motor controller. :returns: The throttle where -1 represents full reverse and 1 represents full forward. :rtype: float .. py:method:: disable() Disables the motor controller. .. py:method:: config_neutral_mode(neutral_mode: 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 TalonFXConfiguration to the motor. Since neutral mode is a config, this API is blocking. We recommend that users avoid calling this API periodically. :param neutral_mode: The state of the motor controller bridge when output is neutral or disabled :type neutral_mode: signals.NeutralModeValue :param timeout_seconds: Maximum amount of time to wait when performing configuration :type timeout_seconds: units.seconds :returns: Status of refreshing and applying the neutral mode config :rtype: StatusCode .. py:method:: feed() .. py:method:: set_expiration(expiration_time: wpimath.units.seconds) Set the expiration time for the corresponding motor safety object. :param expiration_time: The timeout value in seconds. :type expiration_time: units.seconds .. py:method:: get_expiration() -> wpimath.units.seconds Retrieve the timeout value for the corresponding motor safety object. :returns: the timeout value in seconds. :rtype: units.seconds .. py:method:: is_alive() -> 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 :rtype: bool .. py:method:: set_safety_enabled(enabled: bool) Enable/disable motor safety for this device. Turn on and off the motor safety option for this object. :param enabled: True if motor safety is enforced for this object. :type enabled: bool .. py:method:: is_safety_enabled() -> 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 :rtype: bool .. py:method:: stop_motor() Called to stop the motor when the timeout expires. .. py:method:: get_description() -> str :returns: Description of the motor controller :rtype: str .. py:method:: log_to(table: telemetry.TelemetryTable) Logs the object to a TelemetryTable. :param table: telemetry table :type table: TelemetryTable .. py:method:: get_telemetry_type() -> str Gets the telemetry table type. :returns: Table type :rtype: str