CTRE Phoenix Pro C++ 23.0.12
ctre::phoenixpro::hardware::TalonFX Class Reference

Class description for the Talon FX integrated motor controller that runs on associated Falcon motors. More...

#include <ctre/phoenixpro/TalonFX.hpp>

Inheritance diagram for ctre::phoenixpro::hardware::TalonFX:
ctre::phoenixpro::hardware::core::CoreTalonFX ctre::phoenixpro::hardware::ParentDevice

Public Member Functions

 TalonFX (int deviceId, std::string canbus="")
 Constructs a new Talon FX motor controller object. More...
 
 ~TalonFX ()
 
void Set (double speed) override
 Common interface for setting the speed of a motor controller. More...
 
void SetVoltage (units::volt_t volts) override
 Common interface for seting the direct voltage output of a motor controller. More...
 
double Get () const override
 Common interface for getting the current set speed of a motor controller. More...
 
void Disable () override
 Common interface for disabling a motor controller. More...
 
void StopMotor () override
 Common interface to stop motor movement until Set is called again. More...
 
void SetInverted (bool isInverted) override
 Common interface for inverting direction of a motor controller. More...
 
bool GetInverted () const override
 Common interface for returning the inversion state of a motor controller. More...
 
std::string GetDescription () const override
 
void InitSendable (wpi::SendableBuilder &builder) override
 
- Public Member Functions inherited from ctre::phoenixpro::hardware::core::CoreTalonFX
 CoreTalonFX (int deviceId, std::string canbus="")
 Constructs a new Talon FX motor controller object. More...
 
 CoreTalonFX (CoreTalonFX const &)=delete
 
CoreTalonFXoperator= (CoreTalonFX const &)=delete
 
bool HasResetOccurred ()
 
configs::TalonFXConfiguratorGetConfigurator ()
 Gets the configurator for this TalonFX. More...
 
configs::TalonFXConfigurator const & GetConfigurator () const
 Gets the configurator for this TalonFX. More...
 
sim::TalonFXSimStateGetSimState ()
 Get the simulation state for this device. More...
 
StatusSignalValue< int > & GetVersionMajor ()
 App Major Version number. More...
 
StatusSignalValue< int > & GetVersionMinor ()
 App Minor Version number. More...
 
StatusSignalValue< int > & GetVersionBugfix ()
 App Bugfix Version number. More...
 
StatusSignalValue< int > & GetVersionBuild ()
 App Build Version number. More...
 
StatusSignalValue< int > & GetVersion ()
 Full Version. More...
 
StatusSignalValue< int > & GetFaultField ()
 Integer representing all faults. More...
 
StatusSignalValue< int > & GetStickyFaultField ()
 Integer representing all sticky faults. More...
 
StatusSignalValue< signals::ForwardLimitValue > & GetForwardLimit ()
 Forward Limit Pin. More...
 
StatusSignalValue< signals::ReverseLimitValue > & GetReverseLimit ()
 Reverse Limit Pin. More...
 
StatusSignalValue< signals::AppliedRotorPolarityValue > & GetAppliedRotorPolarity ()
 The applied rotor polarity. More...
 
StatusSignalValue< units::dimensionless::scalar_t > & GetDutyCycle ()
 The applied motor duty cycle. More...
 
StatusSignalValue< units::current::ampere_t > & GetTorqueCurrent ()
 Current corresponding to the torque output by the motor. More...
 
StatusSignalValue< units::current::ampere_t > & GetStatorCurrent ()
 Current corresponding to the stator windings. More...
 
StatusSignalValue< units::current::ampere_t > & GetSupplyCurrent ()
 Measured supply side current. More...
 
StatusSignalValue< units::voltage::volt_t > & GetSupplyVoltage ()
 Measured supply voltage to the TalonFX. More...
 
StatusSignalValue< units::temperature::celsius_t > & GetDeviceTemp ()
 Temperature of device. More...
 
StatusSignalValue< units::temperature::celsius_t > & GetProcessorTemp ()
 Temperature of the processor. More...
 
StatusSignalValue< units::angular_velocity::turns_per_second_t > & GetRotorVelocity ()
 Velocity of motor rotor. More...
 
StatusSignalValue< units::angle::turn_t > & GetRotorPosition ()
 Position of motor rotor. More...
 
StatusSignalValue< units::angular_velocity::turns_per_second_t > & GetVelocity ()
 Velocity of device. More...
 
StatusSignalValue< units::angle::turn_t > & GetPosition ()
 Position of device. More...
 
StatusSignalValue< signals::ControlModeValue > & GetControlMode ()
 The active control mode of the motor controller. More...
 
StatusSignalValue< signals::MotionMagicIsRunningValue > & GetMotionMagicIsRunning ()
 Check if Motion Magic® is running. More...
 
StatusSignalValue< signals::DeviceEnableValue > & GetDeviceEnable ()
 Indicates if device is actuator enabled. More...
 
StatusSignalValue< int > & GetClosedLoopSlot ()
 Closed loop slot in use. More...
 
StatusSignalValue< signals::BridgeOuputValue > & GetBridgeOuput ()
 The applied output of the bridge. More...
 
StatusSignalValue< bool > & GetFault_Hardware ()
 Hardware fault occurred. More...
 
StatusSignalValue< bool > & GetStickyFault_Hardware ()
 Hardware fault occurred. More...
 
StatusSignalValue< bool > & GetFault_ProcTemp ()
 Processor temperature exceeded limit. More...
 
StatusSignalValue< bool > & GetStickyFault_ProcTemp ()
 Processor temperature exceeded limit. More...
 
StatusSignalValue< bool > & GetFault_DeviceTemp ()
 Device temperature exceeded limit. More...
 
StatusSignalValue< bool > & GetStickyFault_DeviceTemp ()
 Device temperature exceeded limit. More...
 
StatusSignalValue< bool > & GetFault_Undervoltage ()
 Device supply voltage dropped to near brownout levels. More...
 
StatusSignalValue< bool > & GetStickyFault_Undervoltage ()
 Device supply voltage dropped to near brownout levels. More...
 
StatusSignalValue< bool > & GetFault_BootDuringEnable ()
 Device boot while detecting the enable signal. More...
 
StatusSignalValue< bool > & GetStickyFault_BootDuringEnable ()
 Device boot while detecting the enable signal. More...
 
StatusSignalValue< bool > & GetFault_OverSupplyV ()
 Supply Voltage has exceeded the maximum voltage rating of device. More...
 
StatusSignalValue< bool > & GetStickyFault_OverSupplyV ()
 Supply Voltage has exceeded the maximum voltage rating of device. More...
 
StatusSignalValue< bool > & GetFault_UnstableSupplyV ()
 Supply Voltage is unstable. More...
 
StatusSignalValue< bool > & GetStickyFault_UnstableSupplyV ()
 Supply Voltage is unstable. More...
 
StatusSignalValue< bool > & GetFault_ReverseHardLimit ()
 Reverse limit switch has been asserted. More...
 
StatusSignalValue< bool > & GetStickyFault_ReverseHardLimit ()
 Reverse limit switch has been asserted. More...
 
StatusSignalValue< bool > & GetFault_ForwardHardLimit ()
 Forward limit switch has been asserted. More...
 
StatusSignalValue< bool > & GetStickyFault_ForwardHardLimit ()
 Forward limit switch has been asserted. More...
 
StatusSignalValue< bool > & GetFault_ReverseSoftLimit ()
 Reverse soft limit has been asserted. More...
 
StatusSignalValue< bool > & GetStickyFault_ReverseSoftLimit ()
 Reverse soft limit has been asserted. More...
 
StatusSignalValue< bool > & GetFault_ForwardSoftLimit ()
 Forward soft limit has been asserted. More...
 
StatusSignalValue< bool > & GetStickyFault_ForwardSoftLimit ()
 Forward soft limit has been asserted. More...
 
StatusSignalValue< bool > & GetFault_MissingRemoteSensor ()
 The remote sensor is not present on CAN Bus. More...
 
StatusSignalValue< bool > & GetStickyFault_MissingRemoteSensor ()
 The remote sensor is not present on CAN Bus. More...
 
StatusSignalValue< bool > & GetFault_FusedSensorOutOfSync ()
 The remote sensor used for fusion has fallen out of sync to the local sensor. More...
 
StatusSignalValue< bool > & GetStickyFault_FusedSensorOutOfSync ()
 The remote sensor used for fusion has fallen out of sync to the local sensor. More...
 
StatusSignalValue< bool > & GetFault_StatorCurrLimit ()
 Stator current limit occured. More...
 
StatusSignalValue< bool > & GetStickyFault_StatorCurrLimit ()
 Stator current limit occured. More...
 
StatusSignalValue< bool > & GetFault_SupplyCurrLimit ()
 Supply current limit occured. More...
 
StatusSignalValue< bool > & GetStickyFault_SupplyCurrLimit ()
 Supply current limit occured. More...
 
StatusSignalValue< double > & GetClosedLoopProportionalOutput ()
 Closed loop proportional component. More...
 
StatusSignalValue< double > & GetClosedLoopIntegratedOutput ()
 Closed loop integrated component. More...
 
StatusSignalValue< double > & GetClosedLoopFeedForward ()
 Feed Forward passed by the user. More...
 
StatusSignalValue< double > & GetClosedLoopDerivativeOutput ()
 Closed loop derivative component. More...
 
StatusSignalValue< double > & GetClosedLoopOutput ()
 Closed loop total output. More...
 
StatusSignalValue< double > & GetClosedLoopReference ()
 Value that the closed loop is targeting. More...
 
StatusSignalValue< double > & GetClosedLoopReferenceSlope ()
 Derivative of the target that the closed loop is targeting. More...
 
StatusSignalValue< double > & GetClosedLoopError ()
 The difference between target reference and current measurement. More...
 
ctre::phoenix::StatusCode SetControl (controls::DutyCycleOut &request)
 Request a specified motor duty cycle. More...
 
ctre::phoenix::StatusCode SetControl (controls::DutyCycleOut &&request)
 Request a specified motor duty cycle. More...
 
ctre::phoenix::StatusCode SetControl (controls::TorqueCurrentFOC &request)
 Request a specified motor current (field oriented control). More...
 
ctre::phoenix::StatusCode SetControl (controls::TorqueCurrentFOC &&request)
 Request a specified motor current (field oriented control). More...
 
ctre::phoenix::StatusCode SetControl (controls::VoltageOut &request)
 Request a specified voltage. More...
 
ctre::phoenix::StatusCode SetControl (controls::VoltageOut &&request)
 Request a specified voltage. More...
 
ctre::phoenix::StatusCode SetControl (controls::PositionDutyCycle &request)
 Request PID to target position with duty cycle feedforward. More...
 
ctre::phoenix::StatusCode SetControl (controls::PositionDutyCycle &&request)
 Request PID to target position with duty cycle feedforward. More...
 
ctre::phoenix::StatusCode SetControl (controls::PositionVoltage &request)
 Request PID to target position with voltage feedforward. More...
 
ctre::phoenix::StatusCode SetControl (controls::PositionVoltage &&request)
 Request PID to target position with voltage feedforward. More...
 
ctre::phoenix::StatusCode SetControl (controls::PositionTorqueCurrentFOC &request)
 Request PID to target position with torque current feedforward. More...
 
ctre::phoenix::StatusCode SetControl (controls::PositionTorqueCurrentFOC &&request)
 Request PID to target position with torque current feedforward. More...
 
ctre::phoenix::StatusCode SetControl (controls::VelocityDutyCycle &request)
 Request PID to target velocity with duty cycle feedforward. More...
 
ctre::phoenix::StatusCode SetControl (controls::VelocityDutyCycle &&request)
 Request PID to target velocity with duty cycle feedforward. More...
 
ctre::phoenix::StatusCode SetControl (controls::VelocityVoltage &request)
 Request PID to target velocity with voltage feedforward. More...
 
ctre::phoenix::StatusCode SetControl (controls::VelocityVoltage &&request)
 Request PID to target velocity with voltage feedforward. More...
 
ctre::phoenix::StatusCode SetControl (controls::VelocityTorqueCurrentFOC &request)
 Request PID to target velocity with torque current feedforward. More...
 
ctre::phoenix::StatusCode SetControl (controls::VelocityTorqueCurrentFOC &&request)
 Request PID to target velocity with torque current feedforward. More...
 
ctre::phoenix::StatusCode SetControl (controls::MotionMagicDutyCycle &request)
 Requests Motion Magic® to target a final position using a motion profile. More...
 
ctre::phoenix::StatusCode SetControl (controls::MotionMagicDutyCycle &&request)
 Requests Motion Magic® to target a final position using a motion profile. More...
 
ctre::phoenix::StatusCode SetControl (controls::MotionMagicVoltage &request)
 Requests Motion Magic® to target a final position using a motion profile. More...
 
ctre::phoenix::StatusCode SetControl (controls::MotionMagicVoltage &&request)
 Requests Motion Magic® to target a final position using a motion profile. More...
 
ctre::phoenix::StatusCode SetControl (controls::MotionMagicTorqueCurrentFOC &request)
 Requests Motion Magic® to target a final position using a motion profile. More...
 
ctre::phoenix::StatusCode SetControl (controls::MotionMagicTorqueCurrentFOC &&request)
 Requests Motion Magic® to target a final position using a motion profile. More...
 
ctre::phoenix::StatusCode SetControl (controls::Follower &request)
 Follow the motor output of another Talon. More...
 
ctre::phoenix::StatusCode SetControl (controls::Follower &&request)
 Follow the motor output of another Talon. More...
 
ctre::phoenix::StatusCode SetControl (controls::StrictFollower &request)
 Follow the motor output of another Talon while ignoring the master's invert setting. More...
 
ctre::phoenix::StatusCode SetControl (controls::StrictFollower &&request)
 Follow the motor output of another Talon while ignoring the master's invert setting. More...
 
ctre::phoenix::StatusCode SetControl (controls::NeutralOut &request)
 Request neutral output of actuator. More...
 
ctre::phoenix::StatusCode SetControl (controls::NeutralOut &&request)
 Request neutral output of actuator. More...
 
ctre::phoenix::StatusCode SetControl (controls::CoastOut &request)
 Request coast neutral output of actuator. More...
 
ctre::phoenix::StatusCode SetControl (controls::CoastOut &&request)
 Request coast neutral output of actuator. More...
 
ctre::phoenix::StatusCode SetControl (controls::StaticBrake &request)
 Applies full neutral-brake by shorting motor leads together. More...
 
ctre::phoenix::StatusCode SetControl (controls::StaticBrake &&request)
 Applies full neutral-brake by shorting motor leads together. More...
 
ctre::phoenix::StatusCode SetControl (controls::ControlRequest &request)
 Control motor with generic control request object. More...
 
ctre::phoenix::StatusCode SetControl (controls::ControlRequest &&request)
 Control motor with generic control request object. More...
 
ctre::phoenix::StatusCode SetRotorPosition (units::angle::turn_t newValue, units::time::second_t timeoutSeconds)
 The position to set the rotor position to right now. More...
 
ctre::phoenix::StatusCode SetRotorPosition (units::angle::turn_t newValue)
 The position to set the rotor position to right now. More...
 
ctre::phoenix::StatusCode ClearStickyFaults (units::time::second_t timeoutSeconds)
 Clear the sticky faults in the device. More...
 
ctre::phoenix::StatusCode ClearStickyFaults ()
 Clear the sticky faults in the device. More...
 
- Public Member Functions inherited from ctre::phoenixpro::hardware::ParentDevice
 ParentDevice (int deviceID, std::string model, std::string canbus)
 
int GetDeviceID () const
 
const std::string & GetCANBus () const
 
std::shared_ptr< const controls::ControlRequestGetAppliedControl () const
 Get the latest applied control. More...
 
std::shared_ptr< controls::ControlRequestGetAppliedControl ()
 Get the latest applied control. More...
 

Protected Member Functions

ctre::phoenix::StatusCode SetControlPrivate (controls::ControlRequest &request) override
 
- Protected Member Functions inherited from ctre::phoenixpro::hardware::ParentDevice
virtual void ReportIfTooOld ()=0
 
virtual ctre::phoenix::StatusCode SetControlPrivate (controls::ControlRequest &request)
 
template<typename T >
StatusSignalValue< T > & LookupStatusSignalValue (uint16_t spn, std::string signalName, bool reportOnConstruction)
 
template<typename T >
StatusSignalValue< T > & LookupStatusSignalValue (uint16_t spn, uint16_t mapper_iter, std::function< std::map< int, StatusSignalValue< T > >()> map_filler, std::string signalName, bool reportOnConstruction)
 
template<typename T , typename U >
StatusSignalValue< T > LookupDimensionlessStatusSignalValue (uint16_t spn, std::string signalName)
 Returns a unitless version of the StatusSignalValue by value. More...
 
void ReportIfTooOld (int minMajor, int minMinor, int minBugfix, int minBuild)
 

Additional Inherited Members

- Static Public Attributes inherited from ctre::phoenixpro::hardware::ParentDevice
static constexpr double kDefaultControlRatePeriodsSec = 0.010
 
- Protected Attributes inherited from ctre::phoenixpro::hardware::ParentDevice
DeviceIdentifier deviceIdentifier
 

Detailed Description

Class description for the Talon FX integrated motor controller that runs on associated Falcon motors.

This must be constructed after main executes. We recommend constructing inside the robot class or your subsystem classes. Otherwise WPILib motor safety may produce erroneous behavior.

Constructor & Destructor Documentation

◆ TalonFX()

ctre::phoenixpro::hardware::TalonFX::TalonFX ( int  deviceId,
std::string  canbus = "" 
)

Constructs a new Talon FX motor controller object.

This must be constructed after main executes. We recommend constructing inside the robot class or your subsystem classes. Otherwise WPILib motor safety may produce erroneous behavior.

Parameters
deviceIdID of the device, as configured in Phoenix Tuner.
canbusName 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

◆ ~TalonFX()

ctre::phoenixpro::hardware::TalonFX::~TalonFX ( )

Member Function Documentation

◆ Disable()

void ctre::phoenixpro::hardware::TalonFX::Disable ( )
override

Common interface for disabling a motor controller.

◆ Get()

double ctre::phoenixpro::hardware::TalonFX::Get ( ) const
override

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.

◆ GetDescription()

std::string ctre::phoenixpro::hardware::TalonFX::GetDescription ( ) const
override
Returns
Description of motor controller

◆ GetInverted()

bool ctre::phoenixpro::hardware::TalonFX::GetInverted ( ) const
override

Common interface for returning the inversion state of a motor controller.

Returns
The state of the inversion, true is inverted.

◆ InitSendable()

void ctre::phoenixpro::hardware::TalonFX::InitSendable ( wpi::SendableBuilder &  builder)
override

◆ Set()

void ctre::phoenixpro::hardware::TalonFX::Set ( double  speed)
override

Common interface for setting the speed of a motor controller.

Parameters
speedThe speed to set. Value should be between -1.0 and 1.0.

◆ SetControlPrivate()

ctre::phoenix::StatusCode ctre::phoenixpro::hardware::TalonFX::SetControlPrivate ( controls::ControlRequest request)
overrideprotectedvirtual

◆ SetInverted()

void ctre::phoenixpro::hardware::TalonFX::SetInverted ( bool  isInverted)
override

Common interface for inverting direction of a motor controller.

Parameters
isInvertedThe state of inversion, true is inverted.

◆ SetVoltage()

void ctre::phoenixpro::hardware::TalonFX::SetVoltage ( units::volt_t  volts)
override

Common interface for seting the direct voltage output of a motor controller.

Parameters
voltsThe voltage to output.

◆ StopMotor()

void ctre::phoenixpro::hardware::TalonFX::StopMotor ( )
override

Common interface to stop motor movement until Set is called again.


The documentation for this class was generated from the following file: