CTRE_Phoenix 5.20.2
ctre::phoenix::motorcontrol::can::TalonFX Class Reference

#include <TalonFX.h>

Inherits ctre::phoenix::motorcontrol::can::BaseTalon.

Inherited by ctre::phoenix::motorcontrol::can::WPI_TalonFX [virtual].

Public Member Functions

 TalonFX (int deviceNumber, std::string const &canbus="")
 
 TalonFX (TalonFX const &)=delete
 
TalonFXoperator= (TalonFX const &)=delete
 
void Set (TalonFXControlMode mode, double value)
 
void Set (TalonFXControlMode mode, double demand0, DemandType demand1Type, double demand1)
 
void SetInverted (TalonFXInvertType invertType)
 
ctre::phoenix::ErrorCode ConfigSelectedFeedbackSensor (TalonFXFeedbackDevice feedbackDevice, int pidIdx=0, int timeoutMs=0)
 
ctre::phoenix::ErrorCode ConfigSupplyCurrentLimit (const ctre::phoenix::motorcontrol::SupplyCurrentLimitConfiguration &currLimitConfigs, int timeoutMs=50)
 
ctre::phoenix::ErrorCode ConfigStatorCurrentLimit (const ctre::phoenix::motorcontrol::StatorCurrentLimitConfiguration &currLimitConfigs, int timeoutMs=50)
 
ctre::phoenix::ErrorCode ConfigGetSupplyCurrentLimit (ctre::phoenix::motorcontrol::SupplyCurrentLimitConfiguration &currLimitConfigsToFill, int timeoutMs=50)
 
ctre::phoenix::ErrorCode ConfigGetStatorCurrentLimit (ctre::phoenix::motorcontrol::StatorCurrentLimitConfiguration &currLimitConfigsToFill, int timeoutMs=50)
 
ctre::phoenix::motorcontrol::TalonFXSensorCollectionGetSensorCollection ()
 
ctre::phoenix::motorcontrol::TalonFXSimCollectionGetSimCollection ()
 
ctre::phoenix::ErrorCode ConfigurePID (const TalonFXPIDSetConfiguration &pid, int pidIdx=0, int timeoutMs=50)
 
void GetPIDConfigs (TalonFXPIDSetConfiguration &pid, int pidIdx=0, int timeoutMs=50)
 
ctre::phoenix::ErrorCode ConfigAllSettings (const TalonFXConfiguration &allConfigs, int timeoutMs=50)
 
void GetAllConfigs (TalonFXConfiguration &allConfigs, int timeoutMs=50)
 
ctre::phoenix::ErrorCode ConfigMotorCommutation (ctre::phoenix::motorcontrol::MotorCommutation motorCommutation, int timeoutMs=0)
 
ctre::phoenix::ErrorCode ConfigGetMotorCommutation (ctre::phoenix::motorcontrol::MotorCommutation &motorCommutation, int timeoutMs=0)
 
ErrorCode ConfigIntegratedSensorAbsoluteRange (ctre::phoenix::sensors::AbsoluteSensorRange absoluteSensorRange, int timeoutMs=0)
 
ErrorCode ConfigIntegratedSensorOffset (double offsetDegrees, int timeoutMs=0)
 
ErrorCode ConfigIntegratedSensorInitializationStrategy (ctre::phoenix::sensors::SensorInitializationStrategy initializationStrategy, int timeoutMs=0)
 
virtual void Set (ControlMode mode, double value)
 
virtual void Set (ControlMode mode, double demand0, DemandType demand1Type, double demand1)
 
virtual void SetInverted (InvertType invertType)
 
virtual void SetInverted (bool bInvert)
 
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)
 
- Public Member Functions inherited from ctre::phoenix::motorcontrol::can::BaseTalon
 BaseTalon (int deviceNumber, const char *model, std::string const &canbus="")
 
 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 (ctre::phoenix::sensors::SensorVelocityMeasPeriod period, int timeoutMs=0)
 
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, std::string const &canbus="")
 
 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 ConfigSelectedFeedbackSensor (RemoteFeedbackDevice feedbackDevice, int pidIdx=0, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigSelectedFeedbackSensor (FeedbackDevice feedbackDevice, int pidIdx=0, int timeoutMs=0)
 
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 ErrorCode ConfigRemoteFeedbackFilter (ctre::phoenix::motorcontrol::can::BaseTalon &talonRef, 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)
 
virtual ctre::phoenix::ErrorCode SetStatusFramePeriod (StatusFrame frame, uint8_t periodMs, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode SetStatusFramePeriod (StatusFrameEnhanced frame, uint8_t periodMs, int timeoutMs=0)
 
virtual int GetStatusFramePeriod (StatusFrame frame, int timeoutMs=0)
 
virtual int GetStatusFramePeriod (StatusFrameEnhanced frame, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigVelocityMeasurementPeriod (ctre::phoenix::sensors::SensorVelocityMeasPeriod period, int timeoutMs=0)
 
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 (RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose, int deviceID, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigReverseLimitSwitchSource (RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose, int deviceID, int timeoutMs=0)
 
void OverrideLimitSwitchesEnable (bool enable)
 
virtual ctre::phoenix::ErrorCode ConfigForwardLimitSwitchSource (LimitSwitchSource type, LimitSwitchNormal normalOpenOrClose, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigReverseLimitSwitchSource (LimitSwitchSource type, LimitSwitchNormal normalOpenOrClose, int timeoutMs=0)
 
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 ()
 
virtual void Set (ControlMode Mode, double demand)=0
 
virtual void Set (ControlMode mode, double demand0, DemandType demand1Type, double demand1)=0
 
virtual void NeutralOutput ()=0
 
virtual void SetNeutralMode (NeutralMode neutralMode)=0
 
virtual void SetSensorPhase (bool PhaseSensor)=0
 
virtual void SetInverted (bool invert)=0
 
virtual void SetInverted (InvertType invertType)=0
 
virtual bool GetInverted () const =0
 
virtual ErrorCode ConfigFactoryDefault (int timeout)=0
 
virtual ErrorCode ConfigOpenloopRamp (double secondsFromNeutralToFull, int timeoutMs=0)=0
 
virtual ErrorCode ConfigClosedloopRamp (double secondsFromNeutralToFull, int timeoutMs=0)=0
 
virtual ErrorCode ConfigPeakOutputForward (double percentOut, int timeoutMs=0)=0
 
virtual ErrorCode ConfigPeakOutputReverse (double percentOut, int timeoutMs=0)=0
 
virtual ErrorCode ConfigNominalOutputForward (double percentOut, int timeoutMs=0)=0
 
virtual ErrorCode ConfigNominalOutputReverse (double percentOut, int timeoutMs=0)=0
 
virtual ErrorCode ConfigNeutralDeadband (double percentDeadband, int timeoutMs=0)=0
 
virtual ErrorCode ConfigVoltageCompSaturation (double voltage, int timeoutMs=0)=0
 
virtual ErrorCode ConfigVoltageMeasurementFilter (int filterWindowSamples, int timeoutMs=0)=0
 
virtual void EnableVoltageCompensation (bool enable)=0
 
virtual bool IsVoltageCompensationEnabled ()=0
 
virtual double GetBusVoltage ()=0
 
virtual double GetMotorOutputPercent ()=0
 
virtual double GetMotorOutputVoltage ()=0
 
virtual double GetTemperature ()=0
 
virtual ErrorCode ConfigSelectedFeedbackSensor (RemoteFeedbackDevice feedbackDevice, int pidIdx=0, int timeoutMs=0)=0
 
virtual ErrorCode ConfigSelectedFeedbackCoefficient (double coefficient, int pidIdx=0, int timeoutMs=0)=0
 
virtual ErrorCode ConfigRemoteFeedbackFilter (int deviceID, RemoteSensorSource remoteSensorSource, int remoteOrdinal, int timeoutMs=0)=0
 
virtual ErrorCode ConfigRemoteFeedbackFilter (ctre::phoenix::sensors::CANCoder &canCoderRef, int remoteOrdinal, int timeoutMs=0)=0
 
virtual ErrorCode ConfigRemoteFeedbackFilter (ctre::phoenix::motorcontrol::can::BaseTalon &talonRef, int remoteOrdinal, int timeoutMs=0)=0
 
virtual ErrorCode ConfigSensorTerm (SensorTerm sensorTerm, FeedbackDevice feedbackDevice, int timeoutMs=0)=0
 
virtual double GetSelectedSensorPosition (int pidIdx=0)=0
 
virtual double GetSelectedSensorVelocity (int pidIdx=0)=0
 
virtual ErrorCode SetSelectedSensorPosition (double sensorPos, int pidIdx=0, int timeoutMs=50)=0
 
virtual ErrorCode SetControlFramePeriod (ControlFrame frame, int periodMs)=0
 
virtual ErrorCode SetStatusFramePeriod (StatusFrame frame, uint8_t periodMs, int timeoutMs=0)=0
 
virtual int GetStatusFramePeriod (StatusFrame frame, int timeoutMs=0)=0
 
virtual ErrorCode ConfigForwardLimitSwitchSource (RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose, int deviceID, int timeoutMs=0)=0
 
virtual ErrorCode ConfigReverseLimitSwitchSource (RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose, int deviceID, int timeoutMs=0)=0
 
virtual void OverrideLimitSwitchesEnable (bool enable)=0
 
virtual ErrorCode ConfigForwardSoftLimitThreshold (double forwardSensorLimit, int timeoutMs=0)=0
 
virtual ErrorCode ConfigReverseSoftLimitThreshold (double reverseSensorLimit, int timeoutMs=0)=0
 
virtual ErrorCode ConfigForwardSoftLimitEnable (bool enable, int timeoutMs=0)=0
 
virtual ErrorCode ConfigReverseSoftLimitEnable (bool enable, int timeoutMs=0)=0
 
virtual void OverrideSoftLimitsEnable (bool enable)=0
 
virtual ErrorCode Config_kP (int slotIdx, double value, int timeoutMs=0)=0
 
virtual ErrorCode Config_kI (int slotIdx, double value, int timeoutMs=0)=0
 
virtual ErrorCode Config_kD (int slotIdx, double value, int timeoutMs=0)=0
 
virtual ErrorCode Config_kF (int slotIdx, double value, int timeoutMs=0)=0
 
virtual ErrorCode Config_IntegralZone (int slotIdx, double izone, int timeoutMs=0)=0
 
virtual ErrorCode ConfigAllowableClosedloopError (int slotIdx, double allowableCloseLoopError, int timeoutMs=0)=0
 
virtual ErrorCode ConfigMaxIntegralAccumulator (int slotIdx, double iaccum, int timeoutMs=0)=0
 
virtual ErrorCode ConfigClosedLoopPeakOutput (int slotIdx, double percentOut, int timeoutMs=0)=0
 
virtual ErrorCode ConfigClosedLoopPeriod (int slotIdx, int loopTimeMs, int timeoutMs=0)=0
 
virtual ErrorCode ConfigAuxPIDPolarity (bool invert, int timeoutMs=0)=0
 
virtual ErrorCode SetIntegralAccumulator (double iaccum, int pidIdx=0, int timeoutMs=0)=0
 
virtual double GetClosedLoopError (int pidIdx=0)=0
 
virtual double GetIntegralAccumulator (int pidIdx=0)=0
 
virtual double GetErrorDerivative (int pidIdx=0)=0
 
virtual ErrorCode SelectProfileSlot (int slotIdx, int pidIdx)=0
 
virtual double GetClosedLoopTarget (int pidIdx=0)=0
 
virtual double GetActiveTrajectoryPosition (int pidIdx=0)=0
 
virtual double GetActiveTrajectoryVelocity (int pidIdx=0)=0
 
virtual double GetActiveTrajectoryArbFeedFwd (int pidIdx=0)=0
 
virtual ErrorCode ConfigMotionCruiseVelocity (double sensorUnitsPer100ms, int timeoutMs=0)=0
 
virtual ErrorCode ConfigMotionAcceleration (double sensorUnitsPer100msPerSec, int timeoutMs=0)=0
 
virtual ErrorCode ConfigMotionSCurveStrength (int curveStrength, int timeoutMs)=0
 
virtual ErrorCode ClearMotionProfileTrajectories ()=0
 
virtual int GetMotionProfileTopLevelBufferCount ()=0
 
virtual ErrorCode PushMotionProfileTrajectory (const ctre::phoenix::motion::TrajectoryPoint &trajPt)=0
 
virtual bool IsMotionProfileTopLevelBufferFull ()=0
 
virtual void ProcessMotionProfileBuffer ()=0
 
virtual ErrorCode GetMotionProfileStatus (ctre::phoenix::motion::MotionProfileStatus &statusToFill)=0
 
virtual ErrorCode ClearMotionProfileHasUnderrun (int timeoutMs=0)=0
 
virtual ErrorCode ChangeMotionControlFramePeriod (int periodMs)=0
 
virtual ErrorCode ConfigMotionProfileTrajectoryPeriod (int baseTrajDurationMs, int timeoutMs=0)=0
 
virtual ErrorCode ConfigFeedbackNotContinuous (bool feedbackNotContinuous, int timeoutMs=0)=0
 
virtual ErrorCode ConfigRemoteSensorClosedLoopDisableNeutralOnLOS (bool remoteSensorClosedLoopDisableNeutralOnLOS, int timeoutMs=0)=0
 
virtual ErrorCode ConfigClearPositionOnLimitF (bool clearPositionOnLimitF, int timeoutMs=0)=0
 
virtual ErrorCode ConfigClearPositionOnLimitR (bool clearPositionOnLimitR, int timeoutMs=0)=0
 
virtual ErrorCode ConfigClearPositionOnQuadIdx (bool clearPositionOnQuadIdx, int timeoutMs=0)=0
 
virtual ErrorCode ConfigLimitSwitchDisableNeutralOnLOS (bool limitSwitchDisableNeutralOnLOS, int timeoutMs=0)=0
 
virtual ErrorCode ConfigSoftLimitDisableNeutralOnLOS (bool softLimitDisableNeutralOnLOS, int timeoutMs=0)=0
 
virtual ErrorCode ConfigPulseWidthPeriod_EdgesPerRot (int pulseWidthPeriod_EdgesPerRot, int timeoutMs=0)=0
 
virtual ErrorCode ConfigPulseWidthPeriod_FilterWindowSz (int pulseWidthPeriod_FilterWindowSz, int timeoutMs=0)=0
 
virtual ErrorCode GetLastError ()=0
 
virtual ErrorCode GetFaults (Faults &toFill)=0
 
virtual ErrorCode GetStickyFaults (StickyFaults &toFill)=0
 
virtual ErrorCode ClearStickyFaults (int timeoutMs=0)=0
 
virtual int GetFirmwareVersion ()=0
 
virtual bool HasResetOccurred ()=0
 
virtual ErrorCode ConfigSetCustomParam (int newValue, int paramIndex, int timeoutMs=0)=0
 
virtual int ConfigGetCustomParam (int paramIndex, int timeoutMs=0)=0
 
virtual ErrorCode ConfigSetParameter (ParamEnum param, double value, uint8_t subValue, int ordinal, int timeoutMs=0)=0
 
virtual double ConfigGetParameter (ParamEnum paramEnum, int ordinal, int timeoutMs=0)=0
 
virtual int GetBaseID ()=0
 
virtual int GetDeviceID ()=0
 
virtual ControlMode GetControlMode ()=0
 
virtual void Follow (ctre::phoenix::motorcontrol::IMotorController &masterToFollow)=0
 
virtual void ValueUpdated ()=0
 
virtual ErrorCode ConfigSelectedFeedbackSensor (FeedbackDevice feedbackDevice, int pidIdx=0, int timeoutMs=0)=0
 
virtual ErrorCode ConfigSelectedFeedbackSensor (RemoteFeedbackDevice feedbackDevice, int pidIdx=0, int timeoutMs=0)=0
 
virtual ErrorCode ConfigSupplyCurrentLimit (const SupplyCurrentLimitConfiguration &currLimitConfigs, int timeoutMs=50)=0
 
virtual ErrorCode SetStatusFramePeriod (StatusFrame frame, uint8_t periodMs, int timeoutMs=0)=0
 
virtual ErrorCode SetStatusFramePeriod (StatusFrameEnhanced frame, uint8_t periodMs, int timeoutMs=0)=0
 
virtual int GetStatusFramePeriod (StatusFrame frame, int timeoutMs=0)=0
 
virtual int GetStatusFramePeriod (StatusFrameEnhanced frame, int timeoutMs=0)=0
 
virtual double GetOutputCurrent ()=0
 
virtual ErrorCode ConfigVelocityMeasurementPeriod (VelocityMeasPeriod period, int timeoutMs=0)=0
 
virtual ErrorCode ConfigVelocityMeasurementWindow (int windowSize, int timeoutMs=0)=0
 
virtual ErrorCode ConfigForwardLimitSwitchSource (RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose, int deviceID, int timeoutMs=0)=0
 
virtual ErrorCode ConfigReverseLimitSwitchSource (RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose, int deviceID, int timeoutMs=0)=0
 
virtual ErrorCode ConfigForwardLimitSwitchSource (LimitSwitchSource type, LimitSwitchNormal normalOpenOrClose, int timeoutMs=0)=0
 
virtual ErrorCode ConfigReverseLimitSwitchSource (LimitSwitchSource type, LimitSwitchNormal normalOpenOrClose, int timeoutMs=0)=0
 

Additional Inherited Members

- Static Public Member Functions inherited from ctre::phoenix::motorcontrol::can::BaseMotorController
static void DestroyAllMotControllers ()
 
- Protected Member Functions inherited from ctre::phoenix::motorcontrol::can::BaseTalon
ctre::phoenix::motorcontrol::SensorCollectionGetTalonSRXSensorCollection ()
 
ctre::phoenix::motorcontrol::TalonFXSensorCollectionGetTalonFXSensorCollection ()
 
ctre::phoenix::motorcontrol::TalonSRXSimCollectionGetTalonSRXSimCollection ()
 
ctre::phoenix::motorcontrol::TalonFXSimCollectionGetTalonFXSimCollection ()
 
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)
 
virtual double GetOutputCurrent ()
 

Detailed Description

CTRE Talon FX Motor Controller when used on CAN Bus.


// Example usage of a TalonFX motor controller
TalonFX motor{0}; // creates a new TalonFX with ID 0

TalonFXConfiguration config;
config.supplyCurrLimit.enable = true;
config.supplyCurrLimit.triggerThresholdCurrent = 40; // the peak supply current, in amps
config.supplyCurrLimit.triggerThresholdTime = 1.5; // the time at the peak supply current before the limit triggers, in sec
config.supplyCurrLimit.currentLimit = 30; // the current to maintain if the peak supply limit is triggered
motor.ConfigAllSettings(config); // apply the config settings; this selects the quadrature encoder

motor.Set(TalonFXControlMode::PercentOutput, 0.5); // runs the motor at 50% power

std::cout << motor.GetSelectedSensorPosition() << std::endl; // prints the position of the selected sensor
std::cout << motor.GetSelectedSensorVelocity() << std::endl; // prints the velocity recorded by the selected sensor
std::cout << motor.GetMotorOutputPercent() << std::endl; // prints the percent output of the motor (0.5)
std::cout << motor.GetStatorCurrent() << std::endl; // prints the output current of the motor

ErrorCode error = motor.GetLastError(); // gets the last error generated by the motor controller
Faults faults;
ErrorCode faultsError = motor.GetFaults(faults); // fills faults with the current motor controller faults; returns the last error generated

motor.SetStatusFramePeriod(StatusFrameEnhanced::Status_2_Feedback0, 10); // changes the period of the Status 2 frame (GetSelectedSensor*()) to 10ms

Constructor & Destructor Documentation

◆ TalonFX()

ctre::phoenix::motorcontrol::can::TalonFX::TalonFX ( int  deviceNumber,
std::string const &  canbus = "" 
)

Constructor for a Talon

Parameters
deviceNumberCAN Device ID of TalonFX
canbusName of the CANbus; can be a SocketCAN interface (on Linux), or a CANivore device name or serial number

Member Function Documentation

◆ ConfigAllSettings()

ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::TalonFX::ConfigAllSettings ( const TalonFXConfiguration allConfigs,
int  timeoutMs = 50 
)

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.

◆ ConfigGetMotorCommutation()

ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::TalonFX::ConfigGetMotorCommutation ( ctre::phoenix::motorcontrol::MotorCommutation motorCommutation,
int  timeoutMs = 0 
)
Parameters
timeoutMsTimeout value in ms. If nonzero, function will wait for config success and report an error if it times out.
Returns
The motor commutation type.

◆ ConfigGetStatorCurrentLimit()

ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::TalonFX::ConfigGetStatorCurrentLimit ( ctre::phoenix::motorcontrol::StatorCurrentLimitConfiguration currLimitConfigsToFill,
int  timeoutMs = 50 
)

Gets the stator (output) current limit configuration.

Parameters
currLimitConfigsToFillConfiguration object to fill with read values.
timeoutMsTimeout value in ms. If nonzero, function will wait for config success and report an error if it times out.
Returns
Error Code generated by function. 0 indicates no error.

◆ ConfigGetSupplyCurrentLimit()

ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::TalonFX::ConfigGetSupplyCurrentLimit ( ctre::phoenix::motorcontrol::SupplyCurrentLimitConfiguration currLimitConfigsToFill,
int  timeoutMs = 50 
)

Gets the supply current limit configuration.

Parameters
currLimitConfigsToFillConfiguration object to fill with read values.
timeoutMsTimeout value in ms. If nonzero, function will wait for config success and report an error if it times out.
Returns
Error Code generated by function. 0 indicates no error.

◆ ConfigIntegratedSensorAbsoluteRange()

ErrorCode ctre::phoenix::motorcontrol::can::TalonFX::ConfigIntegratedSensorAbsoluteRange ( ctre::phoenix::sensors::AbsoluteSensorRange  absoluteSensorRange,
int  timeoutMs = 0 
)

Sets the signage and range of the "Absolute Position" signal. Choose unsigned for an absolute range of [0,+1) rotations, [0,360) deg, etc... Choose signed for an absolute range of [-0.5,+0.5) rotations, [-180,+180) deg, etc...

Parameters
absoluteSensorRangeDesired Sign/Range for the absolute position register.
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.

◆ ConfigIntegratedSensorInitializationStrategy()

ErrorCode ctre::phoenix::motorcontrol::can::TalonFX::ConfigIntegratedSensorInitializationStrategy ( ctre::phoenix::sensors::SensorInitializationStrategy  initializationStrategy,
int  timeoutMs = 0 
)

Pick the strategy on how to initialize the integrated sensor absolute position register. Depending on the mechanism, it may be desirable to auto set the Position register to match the Absolute Position (swerve for example). Or it may be desired to zero the sensor on boot (drivetrain translation sensor or a relative servo).

TIP: Tuner's self-test feature will report what the boot sensor value will be in the event the product is reset.

Parameters
initializationStrategyThe sensor initialization strategy to use. This will impact the behavior the next time product boots up.
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.

◆ ConfigIntegratedSensorOffset()

ErrorCode ctre::phoenix::motorcontrol::can::TalonFX::ConfigIntegratedSensorOffset ( double  offsetDegrees,
int  timeoutMs = 0 
)

Adjusts the zero point for the absolute position register. The absolute position of the sensor will always have a discontinuity (360 -> 0 deg) or (+180 -> -180) and a hard-limited mechanism may have such a discontinuity in its functional range. In which case use this config to move the discontinuity outside of the function range.

Parameters
offsetDegreesOffset in degrees (unit string and coefficient DO NOT apply for this config).
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.

◆ ConfigMotorCommutation()

ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::TalonFX::ConfigMotorCommutation ( ctre::phoenix::motorcontrol::MotorCommutation  motorCommutation,
int  timeoutMs = 0 
)

Configure the motor commutation type.

Parameters
motorCommutationMotor Commutation Type.
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.

◆ ConfigSelectedFeedbackSensor() [1/3]

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::TalonFX::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::BaseTalon.

Reimplemented in ctre::phoenix::motorcontrol::can::WPI_TalonFX.

◆ ConfigSelectedFeedbackSensor() [2/3]

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::TalonFX::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::BaseTalon.

Reimplemented in ctre::phoenix::motorcontrol::can::WPI_TalonFX.

◆ ConfigSelectedFeedbackSensor() [3/3]

ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::TalonFX::ConfigSelectedFeedbackSensor ( TalonFXFeedbackDevice  feedbackDevice,
int  pidIdx = 0,
int  timeoutMs = 0 
)

Select the feedback device for the motor controller.

Parameters
feedbackDeviceTalon FX 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.

◆ ConfigStatorCurrentLimit()

ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::TalonFX::ConfigStatorCurrentLimit ( const ctre::phoenix::motorcontrol::StatorCurrentLimitConfiguration currLimitConfigs,
int  timeoutMs = 50 
)

Configures the stator (output) 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.

◆ ConfigSupplyCurrentLimit()

ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::TalonFX::ConfigSupplyCurrentLimit ( const ctre::phoenix::motorcontrol::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.

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

◆ ConfigurePID()

ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::TalonFX::ConfigurePID ( const TalonFXPIDSetConfiguration pid,
int  pidIdx = 0,
int  timeoutMs = 50 
)

Sets all PID 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.

◆ GetAllConfigs()

void ctre::phoenix::motorcontrol::can::TalonFX::GetAllConfigs ( TalonFXConfiguration allConfigs,
int  timeoutMs = 50 
)

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.

◆ GetPIDConfigs()

void ctre::phoenix::motorcontrol::can::TalonFX::GetPIDConfigs ( TalonFXPIDSetConfiguration pid,
int  pidIdx = 0,
int  timeoutMs = 50 
)

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.

◆ GetSensorCollection()

ctre::phoenix::motorcontrol::TalonFXSensorCollection & ctre::phoenix::motorcontrol::can::TalonFX::GetSensorCollection ( )
Returns
object that can get/set individual RAW sensor values.

◆ GetSimCollection()

ctre::phoenix::motorcontrol::TalonFXSimCollection & ctre::phoenix::motorcontrol::can::TalonFX::GetSimCollection ( )
Returns
object that can set simulation inputs.

◆ Set() [1/4]

virtual void ctre::phoenix::motorcontrol::can::TalonFX::Set ( ControlMode  mode,
double  demand0,
DemandType  demand1Type,
double  demand1 
)
virtual
Parameters
modeSets the appropriate output on the talon, depending on the mode.
demand0The output value to apply. such as advanced feed forward and/or auxiliary close-looping in firmware. In PercentOutput, the output is between -1.0 and 1.0, with 0.0 as stopped. In Current mode, output value is in amperes. In Velocity mode, output value is in position change / 100ms. In Position mode, output value is in encoder ticks or an analog value, depending on the sensor. See In Follower mode, the output value is the integer device ID of the talon to duplicate.
demand1TypeThe demand type for demand1. Neutral: Ignore demand1 and apply no change to the demand0 output. AuxPID: Use demand1 to set the target for the auxiliary PID 1. Auxiliary PID is always executed as standard Position PID control. ArbitraryFeedForward: Use demand1 as an arbitrary additive value to the demand0 output. In PercentOutput the demand0 output is the motor output, and in closed-loop modes the demand0 output is the output of PID0.
demand1Supplmental output value. AuxPID: Target position in Sensor Units ArbitraryFeedForward: Percent Output between -1.0 and 1.0

Arcade Drive Example: _talonLeft.set(ControlMode.PercentOutput, joyForward, DemandType.ArbitraryFeedForward, +joyTurn); _talonRght.set(ControlMode.PercentOutput, joyForward, DemandType.ArbitraryFeedForward, -joyTurn);

Drive Straight Example: Note: Selected Sensor Configuration is necessary for both PID0 and PID1. _talonLeft.follow(_talonRght, FollwerType.AuxOutput1); _talonRght.set(ControlMode.PercentOutput, joyForward, DemandType.AuxPID, desiredRobotHeading);

Drive Straight to a Distance Example: Note: Other configurations (sensor selection, PID gains, etc.) need to be set. _talonLeft.follow(_talonRght, FollwerType.AuxOutput1); _talonRght.set(ControlMode.MotionMagic, targetDistance, DemandType.AuxPID, desiredRobotHeading);

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

Reimplemented in ctre::phoenix::motorcontrol::can::WPI_TalonFX.

◆ Set() [2/4]

virtual void ctre::phoenix::motorcontrol::can::TalonFX::Set ( ControlMode  mode,
double  value 
)
virtual

Sets the appropriate output on the talon, depending on the mode.

Parameters
modeThe output mode to apply. In PercentOutput, the output is between -1.0 and 1.0, with 0.0 as stopped. In Current mode, output value is in amperes. In Velocity mode, output value is in position change / 100ms. In Position mode, output value is in encoder ticks or an analog value, depending on the sensor. In Follower mode, the output value is the integer device ID of the talon to duplicate.
valueThe setpoint value, as described above.

Standard Driving Example: _talonLeft.set(ControlMode.PercentOutput, leftJoy); _talonRght.set(ControlMode.PercentOutput, rghtJoy);

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

Reimplemented in ctre::phoenix::motorcontrol::can::WPI_TalonFX.

◆ Set() [3/4]

void ctre::phoenix::motorcontrol::can::TalonFX::Set ( TalonFXControlMode  mode,
double  demand0,
DemandType  demand1Type,
double  demand1 
)
Parameters
modeSets the appropriate output on the talon, depending on the mode.
demand0The output value to apply. such as advanced feed forward and/or auxiliary close-looping in firmware. In PercentOutput, the output is between -1.0 and 1.0, with 0.0 as stopped. In Current mode, output value is in amperes. In Velocity mode, output value is in position change / 100ms. In Position mode, output value is in encoder ticks or an analog value, depending on the sensor. See In Follower mode, the output value is the integer device ID of the talon to duplicate.
demand1TypeThe demand type for demand1. Neutral: Ignore demand1 and apply no change to the demand0 output. AuxPID: Use demand1 to set the target for the auxiliary PID 1. Auxiliary PID is always executed as standard Position PID control. ArbitraryFeedForward: Use demand1 as an arbitrary additive value to the demand0 output. In PercentOutput the demand0 output is the motor output, and in closed-loop modes the demand0 output is the output of PID0.
demand1Supplmental output value. AuxPID: Target position in Sensor Units ArbitraryFeedForward: Percent Output between -1.0 and 1.0

Arcade Drive Example: _talonLeft.set(ControlMode.PercentOutput, joyForward, DemandType.ArbitraryFeedForward, +joyTurn); _talonRght.set(ControlMode.PercentOutput, joyForward, DemandType.ArbitraryFeedForward, -joyTurn);

Drive Straight Example: Note: Selected Sensor Configuration is necessary for both PID0 and PID1. _talonLeft.follow(_talonRght, FollwerType.AuxOutput1); _talonRght.set(ControlMode.PercentOutput, joyForward, DemandType.AuxPID, desiredRobotHeading);

Drive Straight to a Distance Example: Note: Other configurations (sensor selection, PID gains, etc.) need to be set. _talonLeft.follow(_talonRght, FollwerType.AuxOutput1); _talonRght.set(ControlMode.MotionMagic, targetDistance, DemandType.AuxPID, desiredRobotHeading);

◆ Set() [4/4]

void ctre::phoenix::motorcontrol::can::TalonFX::Set ( TalonFXControlMode  mode,
double  value 
)

Sets the appropriate output on the talon, depending on the mode.

Parameters
modeThe output mode to apply. In PercentOutput, the output is between -1.0 and 1.0, with 0.0 as stopped. In Current mode, output value is in amperes. In Velocity mode, output value is in position change / 100ms. In Position mode, output value is in encoder ticks or an analog value, depending on the sensor. In Follower mode, the output value is the integer device ID of the talon to duplicate.
valueThe setpoint value, as described above.

Standard Driving Example: _talonLeft.set(ControlMode.PercentOutput, leftJoy); _talonRght.set(ControlMode.PercentOutput, rghtJoy);

◆ SetInverted() [1/3]

virtual void ctre::phoenix::motorcontrol::can::TalonFX::SetInverted ( bool  invert)
virtual

Inverts the hbridge output of the motor controller.

This does not impact sensor phase and should not be used to correct sensor polarity.

This will invert the hbridge output but NOT the LEDs. This ensures....

  • Green LEDs always represents positive request from robot-controller/closed-looping mode.
  • Green LEDs correlates to forward limit switch.
  • Green LEDs correlates to forward soft limit.
Parameters
invertInvert state to set.

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

Reimplemented in ctre::phoenix::motorcontrol::can::WPI_TalonFX.

◆ SetInverted() [2/3]

virtual void ctre::phoenix::motorcontrol::can::TalonFX::SetInverted ( InvertType  invertType)
virtual

Inverts the hbridge output of the motor controller in relation to the master if present

This does not impact sensor phase and should not be used to correct sensor polarity.

This will allow you to either:

  • Not invert the motor
  • Invert the motor
  • Always follow the master regardless of master's inversion
  • Always oppose the master regardless of master's inversion
Parameters
invertTypeInvert state to set.

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

Reimplemented in ctre::phoenix::motorcontrol::can::WPI_TalonFX.

◆ SetInverted() [3/3]

void ctre::phoenix::motorcontrol::can::TalonFX::SetInverted ( TalonFXInvertType  invertType)

Inverts the hbridge output of the motor controller in relation to the master if present

This does not impact sensor phase and should not be used to correct sensor polarity.

This will allow you to either:

  • Not invert the motor
  • Invert the motor
  • Always follow the master regardless of master's inversion
  • Always oppose the master regardless of master's inversion
Parameters
invertTypeInvert state to set.

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