CTRE_Phoenix  5.19.4
ctre::phoenix::motorcontrol::can::BaseTalon Class Reference

#include <BaseTalon.h>

Inherits ctre::phoenix::motorcontrol::can::BaseMotorController, and ctre::phoenix::motorcontrol::IMotorControllerEnhanced.

Inherited by ctre::phoenix::motorcontrol::can::TalonFX [virtual], and ctre::phoenix::motorcontrol::can::TalonSRX [virtual].

Public Member Functions

 BaseTalon (int deviceNumber, const char *model)
 
 BaseTalon (BaseTalon const &)=delete
 
BaseTalonoperator= (BaseTalon const &)=delete
 
virtual ctre::phoenix::ErrorCode ConfigSelectedFeedbackSensor (FeedbackDevice feedbackDevice, int pidIdx=0, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigSelectedFeedbackSensor (RemoteFeedbackDevice feedbackDevice, int pidIdx=0, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode SetStatusFramePeriod (StatusFrameEnhanced frame, uint8_t periodMs, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode SetStatusFramePeriod (StatusFrame frame, uint8_t periodMs, int timeoutMs=0)
 
virtual int GetStatusFramePeriod (StatusFrameEnhanced frame, int timeoutMs=0)
 
virtual int GetStatusFramePeriod (StatusFrame frame, int timeoutMs=0)
 
virtual double GetOutputCurrent ()
 
double GetStatorCurrent ()
 
double GetSupplyCurrent ()
 
virtual ctre::phoenix::ErrorCode ConfigVelocityMeasurementPeriod (VelocityMeasPeriod period, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigVelocityMeasurementWindow (int windowSize, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigForwardLimitSwitchSource (LimitSwitchSource limitSwitchSource, LimitSwitchNormal normalOpenOrClose, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigForwardLimitSwitchSource (RemoteLimitSwitchSource limitSwitchSource, LimitSwitchNormal normalOpenOrClose, int deviceID, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigReverseLimitSwitchSource (LimitSwitchSource limitSwitchSource, LimitSwitchNormal normalOpenOrClose, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigReverseLimitSwitchSource (RemoteLimitSwitchSource limitSwitchSource, LimitSwitchNormal normalOpenOrClose, int deviceID, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigSupplyCurrentLimit (const SupplyCurrentLimitConfiguration &currLimitConfigs, int timeoutMs=50)
 
int IsFwdLimitSwitchClosed ()
 
int IsRevLimitSwitchClosed ()
 
- Public Member Functions inherited from ctre::phoenix::motorcontrol::can::BaseMotorController
 BaseMotorController (int deviceNumber, const char *model)
 
 BaseMotorController (BaseMotorController const &)=delete
 
BaseMotorControlleroperator= (BaseMotorController const &)=delete
 
virtual int GetDeviceID ()
 
virtual void Set (ControlMode mode, double value)
 
virtual void Set (ControlMode mode, double demand0, DemandType demand1Type, double demand1)
 
virtual void NeutralOutput ()
 
virtual void SetNeutralMode (NeutralMode neutralMode)
 
virtual void SetSensorPhase (bool PhaseSensor)
 
virtual void SetInverted (bool invert)
 
virtual void SetInverted (InvertType invertType)
 
virtual bool GetInverted () const
 
virtual ctre::phoenix::ErrorCode ConfigFactoryDefault (int timeoutMs=50)
 
virtual ctre::phoenix::ErrorCode ConfigOpenloopRamp (double secondsFromNeutralToFull, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigClosedloopRamp (double secondsFromNeutralToFull, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigPeakOutputForward (double percentOut, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigPeakOutputReverse (double percentOut, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigNominalOutputForward (double percentOut, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigNominalOutputReverse (double percentOut, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigNeutralDeadband (double percentDeadband, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigVoltageCompSaturation (double voltage, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigVoltageMeasurementFilter (int filterWindowSamples, int timeoutMs=0)
 
virtual void EnableVoltageCompensation (bool enable)
 
virtual bool IsVoltageCompensationEnabled ()
 
virtual double GetBusVoltage ()
 
virtual double GetMotorOutputPercent ()
 
virtual double GetMotorOutputVoltage ()
 
virtual double GetTemperature ()
 
virtual ctre::phoenix::ErrorCode ConfigSelectedFeedbackCoefficient (double coefficient, int pidIdx=0, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigRemoteFeedbackFilter (int deviceID, RemoteSensorSource remoteSensorSource, int remoteOrdinal, int timeoutMs=0)
 
virtual ErrorCode ConfigRemoteFeedbackFilter (ctre::phoenix::sensors::CANCoder &canCoderRef, int remoteOrdinal, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigSensorTerm (SensorTerm sensorTerm, FeedbackDevice feedbackDevice, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigSensorTerm (SensorTerm sensorTerm, RemoteFeedbackDevice feedbackDevice, int timeoutMs=0)
 
virtual double GetSelectedSensorPosition (int pidIdx=0)
 
virtual double GetSelectedSensorVelocity (int pidIdx=0)
 
virtual ctre::phoenix::ErrorCode SetSelectedSensorPosition (double sensorPos, int pidIdx=0, int timeoutMs=50)
 
virtual ctre::phoenix::ErrorCode SetControlFramePeriod (ControlFrame frame, int periodMs)
 
void OverrideLimitSwitchesEnable (bool enable)
 
virtual ctre::phoenix::ErrorCode ConfigForwardSoftLimitThreshold (double forwardSensorLimit, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigReverseSoftLimitThreshold (double reverseSensorLimit, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigForwardSoftLimitEnable (bool enable, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigReverseSoftLimitEnable (bool enable, int timeoutMs=0)
 
virtual void OverrideSoftLimitsEnable (bool enable)
 
virtual ctre::phoenix::ErrorCode Config_kP (int slotIdx, double value, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode Config_kI (int slotIdx, double value, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode Config_kD (int slotIdx, double value, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode Config_kF (int slotIdx, double value, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode Config_IntegralZone (int slotIdx, double izone, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigAllowableClosedloopError (int slotIdx, double allowableCloseLoopError, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigMaxIntegralAccumulator (int slotIdx, double iaccum, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigClosedLoopPeakOutput (int slotIdx, double percentOut, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigClosedLoopPeriod (int slotIdx, int loopTimeMs, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigAuxPIDPolarity (bool invert, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode SetIntegralAccumulator (double iaccum, int pidIdx=0, int timeoutMs=0)
 
virtual double GetClosedLoopError (int pidIdx=0)
 
virtual double GetIntegralAccumulator (int pidIdx=0)
 
virtual double GetErrorDerivative (int pidIdx=0)
 
virtual ctre::phoenix::ErrorCode SelectProfileSlot (int slotIdx, int pidIdx)
 
virtual double GetClosedLoopTarget (int pidIdx=0)
 
virtual double GetActiveTrajectoryPosition (int pidIdx=0)
 
virtual double GetActiveTrajectoryVelocity (int pidIdx=0)
 
virtual double GetActiveTrajectoryArbFeedFwd (int pidIdx=0)
 
virtual ctre::phoenix::ErrorCode ConfigMotionCruiseVelocity (double sensorUnitsPer100ms, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigMotionAcceleration (double sensorUnitsPer100msPerSec, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigMotionSCurveStrength (int curveStrength, int timeoutMs=0)
 
virtual ErrorCode ClearMotionProfileTrajectories ()
 
virtual int GetMotionProfileTopLevelBufferCount ()
 
virtual ctre::phoenix::ErrorCode PushMotionProfileTrajectory (const ctre::phoenix::motion::TrajectoryPoint &trajPt)
 
virtual ctre::phoenix::ErrorCode StartMotionProfile (ctre::phoenix::motion::BufferedTrajectoryPointStream &stream, uint32_t minBufferedPts, ControlMode motionProfControlMode)
 Simple one-shot firing of a complete MP. Starting in 2019, MPs can be fired by building a Buffered Trajectory Point Stream, and calling this routine. More...
 
virtual bool IsMotionProfileFinished ()
 Determine if running MP is complete. This requires using the StartMotionProfile routine to start the MP. That is because managing the trajectory points is now done in a background thread (if StartMotionProfile is called). More...
 
virtual bool IsMotionProfileTopLevelBufferFull ()
 
virtual void ProcessMotionProfileBuffer ()
 
virtual ctre::phoenix::ErrorCode GetMotionProfileStatus (ctre::phoenix::motion::MotionProfileStatus &statusToFill)
 
virtual ctre::phoenix::ErrorCode ClearMotionProfileHasUnderrun (int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ChangeMotionControlFramePeriod (int periodMs)
 
virtual ctre::phoenix::ErrorCode ConfigMotionProfileTrajectoryPeriod (int baseTrajDurationMs, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigMotionProfileTrajectoryInterpolationEnable (bool enable, int timeoutMs=0)
 
virtual ErrorCode ConfigFeedbackNotContinuous (bool feedbackNotContinuous, int timeoutMs=0)
 
virtual ErrorCode ConfigRemoteSensorClosedLoopDisableNeutralOnLOS (bool remoteSensorClosedLoopDisableNeutralOnLOS, int timeoutMs=0)
 
virtual ErrorCode ConfigClearPositionOnLimitF (bool clearPositionOnLimitF, int timeoutMs=0)
 
virtual ErrorCode ConfigClearPositionOnLimitR (bool clearPositionOnLimitR, int timeoutMs=0)
 
virtual ErrorCode ConfigClearPositionOnQuadIdx (bool clearPositionOnQuadIdx, int timeoutMs=0)
 
virtual ErrorCode ConfigLimitSwitchDisableNeutralOnLOS (bool limitSwitchDisableNeutralOnLOS, int timeoutMs=0)
 
virtual ErrorCode ConfigSoftLimitDisableNeutralOnLOS (bool softLimitDisableNeutralOnLOS, int timeoutMs=0)
 
virtual ErrorCode ConfigPulseWidthPeriod_EdgesPerRot (int pulseWidthPeriod_EdgesPerRot, int timeoutMs=0)
 
virtual ErrorCode ConfigPulseWidthPeriod_FilterWindowSz (int pulseWidthPeriod_FilterWindowSz, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode GetLastError ()
 
virtual ctre::phoenix::ErrorCode GetFaults (Faults &toFill)
 
virtual ctre::phoenix::ErrorCode GetStickyFaults (StickyFaults &toFill)
 
virtual ctre::phoenix::ErrorCode ClearStickyFaults (int timeoutMs=0)
 
virtual int GetFirmwareVersion ()
 
virtual bool HasResetOccurred ()
 
virtual ctre::phoenix::ErrorCode ConfigSetCustomParam (int newValue, int paramIndex, int timeoutMs=0)
 
virtual int ConfigGetCustomParam (int paramIndex, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigSetParameter (ctre::phoenix::ParamEnum param, double value, uint8_t subValue, int ordinal, int timeoutMs=0)
 
virtual double ConfigGetParameter (ctre::phoenix::ParamEnum param, int ordinal, int timeoutMs=0)
 
virtual ErrorCode ConfigGetParameter (ParamEnum param, int32_t valueToSend, int32_t &valueReceived, uint8_t &subValue, int32_t ordinal, int32_t timeoutMs)
 
virtual int GetBaseID ()
 
virtual ControlMode GetControlMode ()
 
void Follow (IMotorController &masterToFollow, ctre::phoenix::motorcontrol::FollowerType followerType)
 
virtual void Follow (IMotorController &masterToFollow)
 
virtual void ValueUpdated ()
 
void GetSlotConfigs (SlotConfiguration &slot, int slotIdx=0, int timeoutMs=50)
 
void GetFilterConfigs (FilterConfiguration &Filter, int ordinal=0, int timeoutMs=50)
 
void * GetHandle ()
 

Protected Member Functions

ctre::phoenix::motorcontrol::SensorCollectionGetTalonSRXSensorCollection ()
 
ctre::phoenix::motorcontrol::TalonFXSensorCollectionGetTalonFXSensorCollection ()
 
ctre::phoenix::motorcontrol::TalonSRXSimCollectionGetTalonSRXSimCollection ()
 
ctre::phoenix::ErrorCode ConfigurePID (const BaseTalonPIDSetConfiguration &pid, int pidIdx, int timeoutMs, bool enableOptimizations)
 
void GetPIDConfigs (BaseTalonPIDSetConfiguration &pid, int pidIdx=0, int timeoutMs=50)
 
ctre::phoenix::ErrorCode BaseTalonConfigAllSettings (const BaseTalonConfiguration &allConfigs, int timeoutMs=50)
 
void BaseTalonGetAllConfigs (BaseTalonConfiguration &allConfigs, int timeoutMs=50)
 
- Protected Member Functions inherited from ctre::phoenix::motorcontrol::can::BaseMotorController
ctre::phoenix::motorcontrol::VictorSPXSimCollectionGetVictorSPXSimCollection ()
 
virtual ctre::phoenix::ErrorCode BaseConfigAllSettings (const BaseMotorControllerConfiguration &allConfigs, int timeoutMs)
 
virtual void BaseGetAllConfigs (BaseMotorControllerConfiguration &allConfigs, int timeoutMs)
 
virtual void BaseGetPIDConfigs (BasePIDSetConfiguration &pid, int pidIdx, int timeoutMs)
 

Additional Inherited Members

- Static Public Member Functions inherited from ctre::phoenix::motorcontrol::can::BaseMotorController
static void DestroyAllMotControllers ()
 

Detailed Description

CTRE Talon SRX Motor Controller when used on CAN Bus.

Constructor & Destructor Documentation

◆ BaseTalon()

ctre::phoenix::motorcontrol::can::BaseTalon::BaseTalon ( int  deviceNumber,
const char *  model 
)

Constructor for a Talon

Parameters
deviceNumberCAN Device ID of BaseTalon

Member Function Documentation

◆ BaseTalonConfigAllSettings()

ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseTalon::BaseTalonConfigAllSettings ( const BaseTalonConfiguration allConfigs,
int  timeoutMs = 50 
)
protected

Configures all persistent settings.

Parameters
allConfigsObject with all of the persistant settings
timeoutMsTimeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
Returns
Error Code generated by function. 0 indicates no error.

◆ BaseTalonGetAllConfigs()

void ctre::phoenix::motorcontrol::can::BaseTalon::BaseTalonGetAllConfigs ( BaseTalonConfiguration allConfigs,
int  timeoutMs = 50 
)
protected

Gets all persistant settings.

Parameters
allConfigsObject with all of the persistant settings
timeoutMsTimeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.

◆ ConfigForwardLimitSwitchSource() [1/2]

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseTalon::ConfigForwardLimitSwitchSource ( LimitSwitchSource  limitSwitchSource,
LimitSwitchNormal  normalOpenOrClose,
int  timeoutMs = 0 
)
virtual

Configures a limit switch for a local/remote source.

For example, a CAN motor controller may need to monitor the Limit-R pin of another Talon, CANifier, or local Gadgeteer feedback connector.

If the sensor is remote, a device ID of zero is assumed. If that's not desired, use the four parameter version of this function.

Parameters
limitSwitchSourceLimit switch source. User can choose between the feedback connector, remote Talon SRX, CANifier, or deactivate the feature.
normalOpenOrCloseSetting for normally open, normally closed, or disabled. This setting matches the Phoenix Tuner drop down.
timeoutMsTimeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
Returns
Error Code generated by function. 0 indicates no error.

Reimplemented from ctre::phoenix::motorcontrol::can::BaseMotorController.

◆ ConfigForwardLimitSwitchSource() [2/2]

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseTalon::ConfigForwardLimitSwitchSource ( RemoteLimitSwitchSource  limitSwitchSource,
LimitSwitchNormal  normalOpenOrClose,
int  deviceID,
int  timeoutMs = 0 
)
virtual

Configures a limit switch for a local/remote source.

For example, a CAN motor controller may need to monitor the Limit-R pin of another Talon, CANifier, or local Gadgeteer feedback connector.

If the sensor is remote, a device ID of zero is assumed. If that's not desired, use the four parameter version of this function.

Parameters
limitSwitchSourceLimit switch source. User can choose between the feedback connector, remote Talon SRX, CANifier, or deactivate the feature.
normalOpenOrCloseSetting for normally open, normally closed, or disabled. This setting matches the Phoenix Tuner drop down.
deviceIDDevice ID of remote source (Talon SRX or CANifier device ID).
timeoutMsTimeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
Returns
Error Code generated by function. 0 indicates no error.

Reimplemented from ctre::phoenix::motorcontrol::can::BaseMotorController.

◆ ConfigReverseLimitSwitchSource() [1/2]

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseTalon::ConfigReverseLimitSwitchSource ( LimitSwitchSource  limitSwitchSource,
LimitSwitchNormal  normalOpenOrClose,
int  timeoutMs = 0 
)
virtual

Configures a limit switch for a local/remote source.

For example, a CAN motor controller may need to monitor the Limit-R pin of another Talon, CANifier, or local Gadgeteer feedback connector.

If the sensor is remote, a device ID of zero is assumed. If that's not desired, use the four parameter version of this function.

Parameters
limitSwitchSourceLimit switch source.
See also
LimitSwitchSource User can choose between the feedback connector, remote Talon SRX, CANifier, or deactivate the feature.
Parameters
normalOpenOrCloseSetting for normally open, normally closed, or disabled. This setting matches the Phoenix Tuner drop down.
timeoutMsTimeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
Returns
Error Code generated by function. 0 indicates no error.

Reimplemented from ctre::phoenix::motorcontrol::can::BaseMotorController.

◆ ConfigReverseLimitSwitchSource() [2/2]

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseTalon::ConfigReverseLimitSwitchSource ( RemoteLimitSwitchSource  limitSwitchSource,
LimitSwitchNormal  normalOpenOrClose,
int  deviceID,
int  timeoutMs = 0 
)
virtual

Configures a limit switch for a local/remote source.

For example, a CAN motor controller may need to monitor the Limit-R pin of another Talon, CANifier, or local Gadgeteer feedback connector.

If the sensor is remote, a device ID of zero is assumed. If that's not desired, use the four parameter version of this function.

Parameters
limitSwitchSourceLimit switch source.
See also
LimitSwitchSource User can choose between the feedback connector, remote Talon SRX, CANifier, or deactivate the feature.
Parameters
normalOpenOrCloseSetting for normally open, normally closed, or disabled. This setting matches the Phoenix Tuner drop down.
deviceIDDevice ID of remote source (Talon SRX or CANifier device ID).
timeoutMsTimeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
Returns
Error Code generated by function. 0 indicates no error.

Reimplemented from ctre::phoenix::motorcontrol::can::BaseMotorController.

◆ ConfigSelectedFeedbackSensor() [1/2]

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseTalon::ConfigSelectedFeedbackSensor ( FeedbackDevice  feedbackDevice,
int  pidIdx = 0,
int  timeoutMs = 0 
)
virtual

Select the remote feedback device for the motor controller. Most CTRE CAN motor controllers will support remote sensors over CAN.

Parameters
feedbackDeviceRemote Feedback Device to select.
pidIdx0 for Primary closed-loop. 1 for auxiliary closed-loop.
timeoutMsTimeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
Returns
Error Code generated by function. 0 indicates no error.

Reimplemented from ctre::phoenix::motorcontrol::can::BaseMotorController.

Reimplemented in ctre::phoenix::motorcontrol::can::TalonFX, ctre::phoenix::motorcontrol::can::TalonSRX, ctre::phoenix::motorcontrol::can::WPI_TalonFX, and ctre::phoenix::motorcontrol::can::WPI_TalonSRX.

◆ ConfigSelectedFeedbackSensor() [2/2]

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseTalon::ConfigSelectedFeedbackSensor ( RemoteFeedbackDevice  feedbackDevice,
int  pidIdx = 0,
int  timeoutMs = 0 
)
virtual

Select the remote feedback device for the motor controller. Most CTRE CAN motor controllers will support remote sensors over CAN.

Parameters
feedbackDeviceRemote Feedback Device to select.
pidIdx0 for Primary closed-loop. 1 for auxiliary closed-loop.
timeoutMsTimeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
Returns
Error Code generated by function. 0 indicates no error.

Reimplemented from ctre::phoenix::motorcontrol::can::BaseMotorController.

Reimplemented in ctre::phoenix::motorcontrol::can::TalonFX, ctre::phoenix::motorcontrol::can::TalonSRX, ctre::phoenix::motorcontrol::can::WPI_TalonFX, and ctre::phoenix::motorcontrol::can::WPI_TalonSRX.

◆ ConfigSupplyCurrentLimit()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseTalon::ConfigSupplyCurrentLimit ( const SupplyCurrentLimitConfiguration currLimitConfigs,
int  timeoutMs = 50 
)
virtual

Configures the supply-side current limit.

Parameters
currLimitCfgCurrent limit configuration
timeoutMsTimeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
Returns
Error Code generated by function. 0 indicates no error.

Implements ctre::phoenix::motorcontrol::IMotorControllerEnhanced.

Reimplemented in ctre::phoenix::motorcontrol::can::TalonSRX, and ctre::phoenix::motorcontrol::can::TalonFX.

◆ ConfigVelocityMeasurementPeriod()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseTalon::ConfigVelocityMeasurementPeriod ( VelocityMeasPeriod  period,
int  timeoutMs = 0 
)
virtual

Configures the period of each velocity sample. Every 1ms a position value is sampled, and the delta between that sample and the position sampled kPeriod ms ago is inserted into a filter. kPeriod is configured with this function.

Parameters
periodDesired period for the velocity measurement.
See also
VelocityMeasPeriod
Parameters
timeoutMsTimeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
Returns
Error Code generated by function. 0 indicates no error.

Reimplemented from ctre::phoenix::motorcontrol::can::BaseMotorController.

◆ ConfigVelocityMeasurementWindow()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseTalon::ConfigVelocityMeasurementWindow ( int  windowSize,
int  timeoutMs = 0 
)
virtual

Sets the number of velocity samples used in the rolling average velocity measurement.

Parameters
windowSizeNumber of samples in the rolling average of velocity measurement. Valid values are 1,2,4,8,16,32. If another value is specified, it will truncate to nearest support value.
timeoutMsTimeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
Returns
Error Code generated by function. 0 indicates no error.

Reimplemented from ctre::phoenix::motorcontrol::can::BaseMotorController.

◆ GetOutputCurrent()

virtual double ctre::phoenix::motorcontrol::can::BaseTalon::GetOutputCurrent ( )
virtual

Gets the output current of the motor controller. In the case of TalonSRX class, this routine returns supply current for legacy reasons. In order to get the "true" output current, call GetStatorCurrent(). In the case of TalonFX class, this routine returns the true output stator current.

[[deprecated("Use GetStatorCurrent/GetSupplyCurrent instead.")]]

Returns
The output current (in amps).

Reimplemented from ctre::phoenix::motorcontrol::can::BaseMotorController.

◆ GetPIDConfigs()

void ctre::phoenix::motorcontrol::can::BaseTalon::GetPIDConfigs ( BaseTalonPIDSetConfiguration pid,
int  pidIdx = 0,
int  timeoutMs = 50 
)
protected

Gets all PID set persistant settings.

Parameters
pidObject with all of the PID set persistant settings
pidIdx0 for Primary closed-loop. 1 for auxiliary closed-loop.
timeoutMsTimeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.

◆ GetStatorCurrent()

double ctre::phoenix::motorcontrol::can::BaseTalon::GetStatorCurrent ( )

Gets the stator/output current of the motor controller.

Returns
The stator/output current (in amps).

◆ GetStatusFramePeriod() [1/2]

virtual int ctre::phoenix::motorcontrol::can::BaseTalon::GetStatusFramePeriod ( StatusFrameEnhanced  frame,
int  timeoutMs = 0 
)
virtual

Gets the period of the given status frame.

Parameters
frameFrame to get the period of.
timeoutMsTimeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
Returns
Period of the given status frame.

Reimplemented from ctre::phoenix::motorcontrol::can::BaseMotorController.

◆ GetStatusFramePeriod() [2/2]

virtual int ctre::phoenix::motorcontrol::can::BaseTalon::GetStatusFramePeriod ( StatusFrame  frame,
int  timeoutMs = 0 
)
virtual

Gets the period of the given status frame.

Parameters
frameFrame to get the period of.
timeoutMsTimeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
Returns
Period of the given status frame.

Reimplemented from ctre::phoenix::motorcontrol::can::BaseMotorController.

◆ GetSupplyCurrent()

double ctre::phoenix::motorcontrol::can::BaseTalon::GetSupplyCurrent ( )

Gets the supply/input current of the motor controller.

Returns
The supply/input current (in amps).

◆ IsFwdLimitSwitchClosed()

int ctre::phoenix::motorcontrol::can::BaseTalon::IsFwdLimitSwitchClosed ( )

Is forward limit switch closed.

Returns
'1' iff forward limit switch is closed, 0 iff switch is open. This function works regardless if limit switch feature is enabled. Remote limit features do not impact this routine.

◆ IsRevLimitSwitchClosed()

int ctre::phoenix::motorcontrol::can::BaseTalon::IsRevLimitSwitchClosed ( )

Is reverse limit switch closed.

Returns
'1' iff reverse limit switch is closed, 0 iff switch is open. This function works regardless if limit switch feature is enabled. Remote limit features do not impact this routine.

◆ SetStatusFramePeriod() [1/2]

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseTalon::SetStatusFramePeriod ( StatusFrameEnhanced  frame,
uint8_t  periodMs,
int  timeoutMs = 0 
)
virtual

Sets the period of the given status frame.

User ensure CAN Bus utilization is not high.

This setting is not persistent and is lost when device is reset. If this is a concern, calling application can use HasResetOccurred() to determine if the status frame needs to be reconfigured.

Parameters
frameFrame whose period is to be changed.
periodMsPeriod in ms for the given frame.
timeoutMsTimeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
Returns
Error Code generated by function. 0 indicates no error.

Reimplemented from ctre::phoenix::motorcontrol::can::BaseMotorController.

◆ SetStatusFramePeriod() [2/2]

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseTalon::SetStatusFramePeriod ( StatusFrame  frame,
uint8_t  periodMs,
int  timeoutMs = 0 
)
virtual

Sets the period of the given status frame.

User ensure CAN Bus utilization is not high.

This setting is not persistent and is lost when device is reset. If this is a concern, calling application can use HasResetOccurred() to determine if the status frame needs to be reconfigured.

Parameters
frameFrame whose period is to be changed.
periodMsPeriod in ms for the given frame.
timeoutMsTimeout value in ms. If nonzero, function will wait for config success and report an error if it times out. If zero, no blocking or checking is performed.
Returns
Error Code generated by function. 0 indicates no error.

Reimplemented from ctre::phoenix::motorcontrol::can::BaseMotorController.


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