CTRE Phoenix C++ 5.36.0
Loading...
Searching...
No Matches
ctre::phoenix::motorcontrol::can::BaseTalon Class Reference

CTRE Talon SRX Motor Controller when used on CAN Bus. More...

#include <ctre/phoenix/motorcontrol/can/BaseTalon.h>

Inheritance diagram for ctre::phoenix::motorcontrol::can::BaseTalon:
ctre::phoenix::motorcontrol::can::BaseMotorController ctre::phoenix::motorcontrol::IMotorControllerEnhanced ctre::phoenix::motorcontrol::IMotorController ctre::phoenix::motorcontrol::IMotorController ctre::phoenix::motorcontrol::IFollower ctre::phoenix::motorcontrol::IFollower ctre::phoenix::motorcontrol::can::TalonSRX ctre::phoenix::motorcontrol::can::WPI_TalonSRX

Public Member Functions

 BaseTalon (int deviceNumber, const char *model, std::string const &canbus="")
 Constructor for a Talon.
 
virtual ~BaseTalon ()
 
 BaseTalon ()=delete
 
 BaseTalon (BaseTalon const &)=delete
 
BaseTalonoperator= (BaseTalon const &)=delete
 
virtual ctre::phoenix::ErrorCode ConfigSelectedFeedbackSensor (FeedbackDevice feedbackDevice, int pidIdx=0, int timeoutMs=0)
 Select the remote feedback device for the motor controller.
 
virtual ctre::phoenix::ErrorCode ConfigSelectedFeedbackSensor (RemoteFeedbackDevice feedbackDevice, int pidIdx=0, int timeoutMs=0)
 Select the remote feedback device for the motor controller.
 
virtual ctre::phoenix::ErrorCode SetStatusFramePeriod (StatusFrameEnhanced frame, uint8_t periodMs, int timeoutMs=0)
 Sets the period of the given status frame.
 
virtual ctre::phoenix::ErrorCode SetStatusFramePeriod (StatusFrame frame, uint8_t periodMs, int timeoutMs=0)
 Sets the period of the given status frame.
 
virtual int GetStatusFramePeriod (StatusFrameEnhanced frame, int timeoutMs=0)
 Gets the period of the given status frame.
 
virtual int GetStatusFramePeriod (StatusFrame frame, int timeoutMs=0)
 Gets the period of the given status frame.
 
virtual double GetOutputCurrent ()
 Gets the output current of the motor controller.
 
double GetStatorCurrent ()
 Gets the stator/output current of the motor controller.
 
double GetSupplyCurrent ()
 Gets the supply/input current of the motor controller.
 
virtual ctre::phoenix::ErrorCode ConfigVelocityMeasurementPeriod (ctre::phoenix::sensors::SensorVelocityMeasPeriod period, int timeoutMs=0)
 Configures the period of each velocity sample.
 
virtual ctre::phoenix::ErrorCode ConfigVelocityMeasurementPeriod (VelocityMeasPeriod period, int timeoutMs=0)
 
virtual ctre::phoenix::ErrorCode ConfigVelocityMeasurementWindow (int windowSize, int timeoutMs=0)
 Sets the number of velocity samples used in the rolling average velocity measurement.
 
virtual ctre::phoenix::ErrorCode ConfigForwardLimitSwitchSource (LimitSwitchSource limitSwitchSource, LimitSwitchNormal normalOpenOrClose, int timeoutMs=0)
 Configures a limit switch for a local/remote source.
 
virtual ctre::phoenix::ErrorCode ConfigForwardLimitSwitchSource (RemoteLimitSwitchSource limitSwitchSource, LimitSwitchNormal normalOpenOrClose, int deviceID, int timeoutMs=0)
 Configures a limit switch for a local/remote source.
 
virtual ctre::phoenix::ErrorCode ConfigReverseLimitSwitchSource (LimitSwitchSource limitSwitchSource, LimitSwitchNormal normalOpenOrClose, int timeoutMs=0)
 Configures a limit switch for a local/remote source.
 
virtual ctre::phoenix::ErrorCode ConfigReverseLimitSwitchSource (RemoteLimitSwitchSource limitSwitchSource, LimitSwitchNormal normalOpenOrClose, int deviceID, int timeoutMs=0)
 Configures a limit switch for a local/remote source.
 
virtual ctre::phoenix::ErrorCode ConfigSupplyCurrentLimit (const SupplyCurrentLimitConfiguration &currLimitConfigs, int timeoutMs=50)
 Configures the supply-side current limit.
 
int IsFwdLimitSwitchClosed ()
 Is forward limit switch closed.
 
int IsRevLimitSwitchClosed ()
 Is reverse limit switch closed.
 
- Public Member Functions inherited from ctre::phoenix::motorcontrol::can::BaseMotorController
 BaseMotorController (int deviceNumber, const char *model, std::string const &canbus="")
 Constructor for motor controllers.
 
virtual ~BaseMotorController ()
 
 BaseMotorController ()=delete
 
 BaseMotorController (BaseMotorController const &)=delete
 
BaseMotorControlleroperator= (BaseMotorController const &)=delete
 
virtual int GetDeviceID ()
 Returns the Device ID.
 
virtual void Set (ControlMode mode, double value)
 Sets the appropriate output on the talon, depending on the mode.
 
virtual void Set (ControlMode mode, double demand0, DemandType demand1Type, double demand1)
 
virtual void NeutralOutput ()
 Neutral the motor output by setting control mode to disabled.
 
virtual void SetNeutralMode (NeutralMode neutralMode)
 Sets the mode of operation during neutral throttle output.
 
virtual void SetSensorPhase (bool PhaseSensor)
 Sets the phase of the sensor.
 
virtual void SetInverted (bool invert)
 Inverts the hbridge output of the motor controller.
 
virtual void SetInverted (InvertType invertType)
 Inverts the hbridge output of the motor controller in relation to the master if present.
 
virtual bool GetInverted () const
 
virtual ctre::phoenix::ErrorCode ConfigFactoryDefault (int timeoutMs=50)
 Revert all configurations to factory default values.
 
virtual ctre::phoenix::ErrorCode ConfigOpenloopRamp (double secondsFromNeutralToFull, int timeoutMs=0)
 Configures the open-loop ramp rate of throttle output.
 
virtual ctre::phoenix::ErrorCode ConfigClosedloopRamp (double secondsFromNeutralToFull, int timeoutMs=0)
 Configures the closed-loop ramp rate of throttle output.
 
virtual ctre::phoenix::ErrorCode ConfigPeakOutputForward (double percentOut, int timeoutMs=0)
 Configures the forward peak output percentage.
 
virtual ctre::phoenix::ErrorCode ConfigPeakOutputReverse (double percentOut, int timeoutMs=0)
 Configures the reverse peak output percentage.
 
virtual ctre::phoenix::ErrorCode ConfigNominalOutputForward (double percentOut, int timeoutMs=0)
 Configures the forward nominal output percentage.
 
virtual ctre::phoenix::ErrorCode ConfigNominalOutputReverse (double percentOut, int timeoutMs=0)
 Configures the reverse nominal output percentage.
 
virtual ctre::phoenix::ErrorCode ConfigNeutralDeadband (double percentDeadband, int timeoutMs=0)
 Configures the output deadband percentage.
 
virtual ctre::phoenix::ErrorCode ConfigVoltageCompSaturation (double voltage, int timeoutMs=0)
 Configures the Voltage Compensation saturation voltage.
 
virtual ctre::phoenix::ErrorCode ConfigVoltageMeasurementFilter (int filterWindowSamples, int timeoutMs=0)
 Configures the voltage measurement filter.
 
virtual void EnableVoltageCompensation (bool enable)
 Enables voltage compensation.
 
virtual bool IsVoltageCompensationEnabled ()
 Returns the enable state of Voltage Compensation that the caller has set.
 
virtual double GetBusVoltage ()
 Gets the bus voltage seen by the device.
 
virtual double GetMotorOutputPercent ()
 Gets the output percentage of the motor controller.
 
virtual double GetMotorOutputVoltage ()
 
virtual double GetTemperature ()
 Gets the temperature of the motor controller.
 
virtual ctre::phoenix::ErrorCode ConfigSelectedFeedbackCoefficient (double coefficient, int pidIdx=0, int timeoutMs=0)
 The Feedback Coefficient is a scalar applied to the value of the feedback sensor.
 
virtual ctre::phoenix::ErrorCode ConfigRemoteFeedbackFilter (int deviceID, RemoteSensorSource remoteSensorSource, int remoteOrdinal, int timeoutMs=0)
 Select what remote device and signal to assign to Remote Sensor 0 or Remote Sensor 1.
 
virtual ErrorCode ConfigRemoteFeedbackFilter (ctre::phoenix::motorcontrol::can::BaseTalon &talonRef, int remoteOrdinal, int timeoutMs=0)
 Select what remote device and signal to assign to Remote Sensor 0 or Remote Sensor 1.
 
virtual ctre::phoenix::ErrorCode ConfigSensorTerm (SensorTerm sensorTerm, FeedbackDevice feedbackDevice, int timeoutMs=0)
 Select what sensor term should be bound to switch feedback device.
 
virtual ctre::phoenix::ErrorCode ConfigSensorTerm (SensorTerm sensorTerm, RemoteFeedbackDevice feedbackDevice, int timeoutMs=0)
 Select what sensor term should be bound to switch feedback device.
 
virtual double GetSelectedSensorPosition (int pidIdx=0)
 Get the selected sensor position (in raw sensor units).
 
virtual double GetSelectedSensorVelocity (int pidIdx=0)
 Get the selected sensor velocity.
 
virtual ctre::phoenix::ErrorCode SetSelectedSensorPosition (double sensorPos, int pidIdx=0, int timeoutMs=50)
 Sets the sensor position to the given value.
 
virtual ctre::phoenix::ErrorCode SetControlFramePeriod (ControlFrame frame, int periodMs)
 Sets the period of the given control frame.
 
void OverrideLimitSwitchesEnable (bool enable)
 Sets the enable state for limit switches.
 
virtual ctre::phoenix::ErrorCode ConfigForwardSoftLimitThreshold (double forwardSensorLimit, int timeoutMs=0)
 Configures the forward soft limit threhold.
 
virtual ctre::phoenix::ErrorCode ConfigReverseSoftLimitThreshold (double reverseSensorLimit, int timeoutMs=0)
 Configures the reverse soft limit threshold.
 
virtual ctre::phoenix::ErrorCode ConfigForwardSoftLimitEnable (bool enable, int timeoutMs=0)
 Configures the forward soft limit enable.
 
virtual ctre::phoenix::ErrorCode ConfigReverseSoftLimitEnable (bool enable, int timeoutMs=0)
 Configures the reverse soft limit enable.
 
virtual void OverrideSoftLimitsEnable (bool enable)
 Can be used to override-disable the soft limits.
 
virtual ctre::phoenix::ErrorCode Config_kP (int slotIdx, double value, int timeoutMs=0)
 Sets the 'P' constant in the given parameter slot.
 
virtual ctre::phoenix::ErrorCode Config_kI (int slotIdx, double value, int timeoutMs=0)
 Sets the 'I' constant in the given parameter slot.
 
virtual ctre::phoenix::ErrorCode Config_kD (int slotIdx, double value, int timeoutMs=0)
 Sets the 'D' constant in the given parameter slot.
 
virtual ctre::phoenix::ErrorCode Config_kF (int slotIdx, double value, int timeoutMs=0)
 Sets the 'F' constant in the given parameter slot.
 
virtual ctre::phoenix::ErrorCode Config_IntegralZone (int slotIdx, double izone, int timeoutMs=0)
 Sets the Integral Zone constant in the given parameter slot.
 
virtual ctre::phoenix::ErrorCode ConfigAllowableClosedloopError (int slotIdx, double allowableCloseLoopError, int timeoutMs=0)
 Sets the allowable closed-loop error in the given parameter slot.
 
virtual ctre::phoenix::ErrorCode ConfigMaxIntegralAccumulator (int slotIdx, double iaccum, int timeoutMs=0)
 Sets the maximum integral accumulator in the given parameter slot.
 
virtual ctre::phoenix::ErrorCode ConfigClosedLoopPeakOutput (int slotIdx, double percentOut, int timeoutMs=0)
 Sets the peak closed-loop output.
 
virtual ctre::phoenix::ErrorCode ConfigClosedLoopPeriod (int slotIdx, int loopTimeMs, int timeoutMs=0)
 Sets the loop time (in milliseconds) of the PID closed-loop calculations.
 
virtual ctre::phoenix::ErrorCode ConfigAuxPIDPolarity (bool invert, int timeoutMs=0)
 Configures the Polarity of the Auxiliary PID (PID1).
 
ctre::phoenix::ErrorCode ConfigureSlot (const SlotConfiguration &slot, int slotIdx, int timeoutMs)
 Configures all slot persistant settings.
 
virtual ctre::phoenix::ErrorCode SetIntegralAccumulator (double iaccum, int pidIdx=0, int timeoutMs=0)
 Sets the integral accumulator.
 
virtual double GetClosedLoopError (int pidIdx=0)
 Gets the closed-loop error.
 
virtual double GetIntegralAccumulator (int pidIdx=0)
 Gets the iaccum value.
 
virtual double GetErrorDerivative (int pidIdx=0)
 Gets the derivative of the closed-loop error.
 
virtual ctre::phoenix::ErrorCode SelectProfileSlot (int slotIdx, int pidIdx)
 Selects which profile slot to use for closed-loop control.
 
virtual double GetClosedLoopTarget (int pidIdx=0)
 Gets the current target of a given closed loop.
 
virtual double GetActiveTrajectoryPosition (int pidIdx=0)
 Gets the active trajectory target position using MotionMagic/MotionProfile control modes.
 
virtual double GetActiveTrajectoryVelocity (int pidIdx=0)
 Gets the active trajectory target velocity using MotionMagic/MotionProfile control modes.
 
virtual double GetActiveTrajectoryArbFeedFwd (int pidIdx=0)
 Gets the active trajectory arbitrary feedforward using MotionMagic/MotionProfile control modes.
 
virtual ctre::phoenix::ErrorCode ConfigMotionCruiseVelocity (double sensorUnitsPer100ms, int timeoutMs=0)
 Sets the Motion Magic Cruise Velocity.
 
virtual ctre::phoenix::ErrorCode ConfigMotionAcceleration (double sensorUnitsPer100msPerSec, int timeoutMs=0)
 Sets the Motion Magic Acceleration.
 
virtual ctre::phoenix::ErrorCode ConfigMotionSCurveStrength (int curveStrength, int timeoutMs=0)
 Sets the Motion Magic S Curve Strength.
 
virtual ErrorCode ClearMotionProfileTrajectories ()
 Clear the buffered motion profile in both controller's RAM (bottom), and in the API (top).
 
virtual int GetMotionProfileTopLevelBufferCount ()
 Retrieve just the buffer count for the api-level (top) buffer.
 
virtual ctre::phoenix::ErrorCode PushMotionProfileTrajectory (const ctre::phoenix::motion::TrajectoryPoint &trajPt)
 Push another trajectory point into the top level buffer (which is emptied into the motor controller's bottom buffer as room allows).
 
virtual ctre::phoenix::ErrorCode StartMotionProfile (ctre::phoenix::motion::BufferedTrajectoryPointStream &stream, uint32_t minBufferedPts, ControlMode motionProfControlMode)
 Simple one-shot firing of a complete MP.
 
virtual bool IsMotionProfileFinished ()
 Determine if running MP is complete.
 
virtual bool IsMotionProfileTopLevelBufferFull ()
 Retrieve just the buffer full for the api-level (top) buffer.
 
virtual void ProcessMotionProfileBuffer ()
 This must be called periodically to funnel the trajectory points from the API's top level buffer to the controller's bottom level buffer.
 
virtual ctre::phoenix::ErrorCode GetMotionProfileStatus (ctre::phoenix::motion::MotionProfileStatus &statusToFill)
 Retrieve all status information.
 
virtual ctre::phoenix::ErrorCode ClearMotionProfileHasUnderrun (int timeoutMs=0)
 Clear the "Has Underrun" flag.
 
virtual ctre::phoenix::ErrorCode ChangeMotionControlFramePeriod (int periodMs)
 Calling application can opt to speed up the handshaking between the robot API and the controller to increase the download rate of the controller's Motion Profile.
 
virtual ctre::phoenix::ErrorCode ConfigMotionProfileTrajectoryPeriod (int baseTrajDurationMs, int timeoutMs=0)
 When trajectory points are processed in the motion profile executer, the MPE determines how long to apply the active trajectory point by summing baseTrajDurationMs with the timeDur of the trajectory point (see TrajectoryPoint).
 
virtual ctre::phoenix::ErrorCode ConfigMotionProfileTrajectoryInterpolationEnable (bool enable, int timeoutMs=0)
 When trajectory points are processed in the buffer, the motor controller can linearly interpolate additional trajectory points between the buffered points.
 
virtual ErrorCode ConfigFeedbackNotContinuous (bool feedbackNotContinuous, int timeoutMs=0)
 Disables continuous tracking of the position for analog and pulse-width.
 
virtual ErrorCode ConfigRemoteSensorClosedLoopDisableNeutralOnLOS (bool remoteSensorClosedLoopDisableNeutralOnLOS, int timeoutMs=0)
 Disables going to neutral (brake/coast) when a remote sensor is no longer detected.
 
virtual ErrorCode ConfigClearPositionOnLimitF (bool clearPositionOnLimitF, int timeoutMs=0)
 Enables clearing the position of the feedback sensor when the forward limit switch is triggered.
 
virtual ErrorCode ConfigClearPositionOnLimitR (bool clearPositionOnLimitR, int timeoutMs=0)
 Enables clearing the position of the feedback sensor when the reverse limit switch is triggered.
 
virtual ErrorCode ConfigClearPositionOnQuadIdx (bool clearPositionOnQuadIdx, int timeoutMs=0)
 Enables clearing the position of the feedback sensor when the quadrature index signal is detected.
 
virtual ErrorCode ConfigLimitSwitchDisableNeutralOnLOS (bool limitSwitchDisableNeutralOnLOS, int timeoutMs=0)
 Disables limit switches triggering (if enabled) when the sensor is no longer detected.
 
virtual ErrorCode ConfigSoftLimitDisableNeutralOnLOS (bool softLimitDisableNeutralOnLOS, int timeoutMs=0)
 Disables soft limits triggering (if enabled) when the sensor is no longer detected.
 
virtual ErrorCode ConfigPulseWidthPeriod_EdgesPerRot (int pulseWidthPeriod_EdgesPerRot, int timeoutMs=0)
 Sets the edges per rotation of a pulse width sensor.
 
virtual ErrorCode ConfigPulseWidthPeriod_FilterWindowSz (int pulseWidthPeriod_FilterWindowSz, int timeoutMs=0)
 Sets the number of samples to use in smoothing a pulse width sensor with a rolling average.
 
virtual ctre::phoenix::ErrorCode GetLastError ()
 Gets the last error generated by this object.
 
virtual ctre::phoenix::ErrorCode GetFaults (Faults &toFill)
 Polls the various fault flags.
 
virtual ctre::phoenix::ErrorCode GetStickyFaults (StickyFaults &toFill)
 Polls the various sticky fault flags.
 
virtual ctre::phoenix::ErrorCode ClearStickyFaults (int timeoutMs=0)
 Clears all sticky faults.
 
virtual int GetFirmwareVersion ()
 Gets the firmware version of the device.
 
virtual bool HasResetOccurred ()
 Returns true if the device has reset since last call.
 
virtual ctre::phoenix::ErrorCode ConfigSetCustomParam (int newValue, int paramIndex, int timeoutMs=0)
 Sets the value of a custom parameter.
 
virtual int ConfigGetCustomParam (int paramIndex, int timeoutMs=0)
 Gets the value of a custom parameter.
 
virtual ctre::phoenix::ErrorCode ConfigSetParameter (ctre::phoenix::ParamEnum param, double value, uint8_t subValue, int ordinal, int timeoutMs=0)
 Sets a parameter.
 
virtual double ConfigGetParameter (ctre::phoenix::ParamEnum param, int ordinal, int timeoutMs=0)
 Gets a parameter.
 
virtual ErrorCode ConfigGetParameter (ParamEnum param, int32_t valueToSend, int32_t &valueReceived, uint8_t &subValue, int32_t ordinal, int32_t timeoutMs)
 Gets a parameter by passing an int by reference.
 
virtual int GetBaseID ()
 
virtual ControlMode GetControlMode ()
 
void Follow (IMotorController &masterToFollow, ctre::phoenix::motorcontrol::FollowerType followerType)
 Set the control mode and output value so that this motor controller will follow another motor controller.
 
virtual void Follow (IMotorController &masterToFollow)
 Set the control mode and output value so that this motor controller will follow another motor controller.
 
virtual void ValueUpdated ()
 When master makes a device, this routine is called to signal the update.
 
void GetSlotConfigs (SlotConfiguration &slot, int slotIdx=0, int timeoutMs=50)
 Gets all slot persistant settings.
 
void GetFilterConfigs (FilterConfiguration &Filter, int ordinal=0, int timeoutMs=50)
 Gets all filter persistant settings.
 
void * GetHandle ()
 
- Public Member Functions inherited from ctre::phoenix::motorcontrol::IMotorController
virtual ~IMotorController ()
 
- Public Member Functions inherited from ctre::phoenix::motorcontrol::IFollower
virtual ~IFollower ()
 
- Public Member Functions inherited from ctre::phoenix::motorcontrol::IMotorControllerEnhanced
virtual ~IMotorControllerEnhanced ()
 

Protected Member Functions

ctre::phoenix::motorcontrol::SensorCollectionGetTalonSRXSensorCollection ()
 
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)
 Gets all PID set persistant settings.
 
ctre::phoenix::ErrorCode BaseTalonConfigAllSettings (const BaseTalonConfiguration &allConfigs, int timeoutMs=50)
 Configures all persistent settings.
 
void BaseTalonGetAllConfigs (BaseTalonConfiguration &allConfigs, int timeoutMs=50)
 Gets all persistant settings.
 
- Protected Member Functions inherited from ctre::phoenix::motorcontrol::can::BaseMotorController
ctre::phoenix::motorcontrol::VictorSPXSimCollectionGetVictorSPXSimCollection ()
 
virtual ctre::phoenix::ErrorCode BaseConfigAllSettings (const BaseMotorControllerConfiguration &allConfigs, int timeoutMs)
 Configures all base persistant settings.
 
virtual void BaseGetAllConfigs (BaseMotorControllerConfiguration &allConfigs, int timeoutMs)
 Gets all base persistant settings.
 
virtual void BaseGetPIDConfigs (BasePIDSetConfiguration &pid, int pidIdx, int timeoutMs)
 Gets all base PID set persistant settings.
 

Additional Inherited Members

- Static Public Member Functions inherited from ctre::phoenix::motorcontrol::can::BaseMotorController
static void DestroyAllMotControllers ()
 Destructs all motor controller objects.
 

Detailed Description

CTRE Talon SRX Motor Controller when used on CAN Bus.

Constructor & Destructor Documentation

◆ BaseTalon() [1/3]

ctre::phoenix::motorcontrol::can::BaseTalon::BaseTalon ( int deviceNumber,
const char * model,
std::string const & canbus = "" )

Constructor for a Talon.

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

◆ ~BaseTalon()

virtual ctre::phoenix::motorcontrol::can::BaseTalon::~BaseTalon ( )
virtual

◆ BaseTalon() [2/3]

ctre::phoenix::motorcontrol::can::BaseTalon::BaseTalon ( )
delete

◆ BaseTalon() [3/3]

ctre::phoenix::motorcontrol::can::BaseTalon::BaseTalon ( BaseTalon const & )
delete

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::TalonSRX, 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::TalonSRX, 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.

◆ ConfigurePID()

ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseTalon::ConfigurePID ( const BaseTalonPIDSetConfiguration & pid,
int pidIdx,
int timeoutMs,
bool enableOptimizations )
protected

◆ ConfigVelocityMeasurementPeriod() [1/2]

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseTalon::ConfigVelocityMeasurementPeriod ( ctre::phoenix::sensors::SensorVelocityMeasPeriod 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
#SensorVelocityMeasPeriod
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.

◆ ConfigVelocityMeasurementPeriod() [2/2]

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

◆ 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().

[[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 ( 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.

◆ GetStatusFramePeriod() [2/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.

◆ GetSupplyCurrent()

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

Gets the supply/input current of the motor controller.

Returns
The supply/input current (in amps).

◆ GetTalonSRXSensorCollection()

ctre::phoenix::motorcontrol::SensorCollection & ctre::phoenix::motorcontrol::can::BaseTalon::GetTalonSRXSensorCollection ( )
inlineprotected

◆ GetTalonSRXSimCollection()

ctre::phoenix::motorcontrol::TalonSRXSimCollection & ctre::phoenix::motorcontrol::can::BaseTalon::GetTalonSRXSimCollection ( )
inlineprotected

◆ 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.

◆ operator=()

BaseTalon & ctre::phoenix::motorcontrol::can::BaseTalon::operator= ( BaseTalon const & )
delete

◆ SetStatusFramePeriod() [1/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.

◆ SetStatusFramePeriod() [2/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.


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