WPILibC++ 2024.3.2
frc::PWMTalonSRX Class Reference

Cross the Road Electronics (CTRE) Talon SRX Motor Controller with PWM control. More...

#include <frc/motorcontrol/PWMTalonSRX.h>

Inheritance diagram for frc::PWMTalonSRX:
frc::PWMMotorController frc::MotorController frc::MotorSafety wpi::Sendable wpi::SendableHelper< PWMMotorController >

Public Member Functions

 PWMTalonSRX (int channel)
 Construct a Talon SRX connected via PWM. More...
 
 PWMTalonSRX (PWMTalonSRX &&)=default
 
PWMTalonSRXoperator= (PWMTalonSRX &&)=default
 
- Public Member Functions inherited from frc::PWMMotorController
 PWMMotorController (PWMMotorController &&)=default
 
PWMMotorControlleroperator= (PWMMotorController &&)=default
 
void Set (double value) override
 Set the PWM value. More...
 
void SetVoltage (units::volt_t output) override
 Sets the voltage output of the PWMMotorController. More...
 
double Get () const override
 Get the recently set value of the PWM. 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...
 
void Disable () override
 Common interface for disabling a motor. More...
 
void StopMotor () override
 Called to stop the motor when the timeout expires. More...
 
std::string GetDescription () const override
 Returns a description to print when an error occurs. More...
 
int GetChannel () const
 
void EnableDeadbandElimination (bool eliminateDeadband)
 Optionally eliminate the deadband from a motor controller. More...
 
void AddFollower (PWMMotorController &follower)
 Make the given PWM motor controller follow the output of this one. More...
 
template<std::derived_from< PWMMotorController > T>
void AddFollower (T &&follower)
 Make the given PWM motor controller follow the output of this one. More...
 
- Public Member Functions inherited from frc::MotorController
virtual ~MotorController ()=default
 
virtual void Set (double speed)=0
 Common interface for setting the speed of a motor controller. More...
 
virtual void SetVoltage (units::volt_t output)
 Sets the voltage output of the MotorController. More...
 
virtual double Get () const =0
 Common interface for getting the current set speed of a motor controller. More...
 
virtual void SetInverted (bool isInverted)=0
 Common interface for inverting direction of a motor controller. More...
 
virtual bool GetInverted () const =0
 Common interface for returning the inversion state of a motor controller. More...
 
virtual void Disable ()=0
 Common interface for disabling a motor. More...
 
virtual void StopMotor ()=0
 Common interface to stop the motor until Set is called again. More...
 
- Public Member Functions inherited from frc::MotorSafety
 MotorSafety ()
 
virtual ~MotorSafety ()
 
 MotorSafety (MotorSafety &&rhs)
 
MotorSafetyoperator= (MotorSafety &&rhs)
 
void Feed ()
 Feed the motor safety object. More...
 
void SetExpiration (units::second_t expirationTime)
 Set the expiration time for the corresponding motor safety object. More...
 
units::second_t GetExpiration () const
 Retrieve the timeout value for the corresponding motor safety object. More...
 
bool IsAlive () const
 Determine if the motor is still operating or has timed out. More...
 
void SetSafetyEnabled (bool enabled)
 Enable/disable motor safety for this device. More...
 
bool IsSafetyEnabled () const
 Return the state of the motor safety enabled flag. More...
 
void Check ()
 Check if this motor has exceeded its timeout. More...
 
virtual void StopMotor ()=0
 Called to stop the motor when the timeout expires. More...
 
virtual std::string GetDescription () const =0
 Returns a description to print when an error occurs. More...
 
- Public Member Functions inherited from wpi::Sendable
virtual ~Sendable ()=default
 
virtual void InitSendable (SendableBuilder &builder)=0
 Initializes this Sendable object. More...
 
- Public Member Functions inherited from wpi::SendableHelper< PWMMotorController >
 SendableHelper (const SendableHelper &rhs)=default
 
 SendableHelper (SendableHelper &&rhs)
 
SendableHelperoperator= (const SendableHelper &rhs)=default
 
SendableHelperoperator= (SendableHelper &&rhs)
 

Additional Inherited Members

- Static Public Member Functions inherited from frc::MotorSafety
static void CheckMotors ()
 Check the motors to see if any have timed out. More...
 
- Protected Member Functions inherited from frc::PWMMotorController
 PWMMotorController (std::string_view name, int channel)
 Constructor for a PWM Motor Controller connected via PWM. More...
 
void InitSendable (wpi::SendableBuilder &builder) override
 Initializes this Sendable object. More...
 
- Protected Member Functions inherited from wpi::SendableHelper< PWMMotorController >
 SendableHelper ()=default
 
 ~SendableHelper ()
 
- Protected Attributes inherited from frc::PWMMotorController
PWM m_pwm
 PWM instances for motor controller. More...
 

Detailed Description

Cross the Road Electronics (CTRE) Talon SRX Motor Controller with PWM control.

Note that the Talon SRX uses the following bounds for PWM values. These values should work reasonably well for most controllers, but if users experience issues such as asymmetric behavior around the deadband or inability to saturate the controller in either direction, calibration is recommended. The calibration procedure can be found in the Talon SRX User Manual available from Cross The Road Electronics.

  • 2.004ms = full "forward"
  • 1.520ms = the "high end" of the deadband range
  • 1.500ms = center of the deadband range (off)
  • 1.480ms = the "low end" of the deadband range
  • 0.997ms = full "reverse"

Constructor & Destructor Documentation

◆ PWMTalonSRX() [1/2]

frc::PWMTalonSRX::PWMTalonSRX ( int  channel)
explicit

Construct a Talon SRX connected via PWM.

Parameters
channelThe PWM channel that the Talon SRX is attached to. 0-9 are on-board, 10-19 are on the MXP port

◆ PWMTalonSRX() [2/2]

frc::PWMTalonSRX::PWMTalonSRX ( PWMTalonSRX &&  )
default

Member Function Documentation

◆ operator=()

PWMTalonSRX & frc::PWMTalonSRX::operator= ( PWMTalonSRX &&  )
default

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