CTRE Phoenix C++ 5.33.0
ctre::phoenix::motorcontrol::can::BaseMotorController Class Reference

Base motor controller features for all CTRE CAN motor controllers. More...

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

Inheritance diagram for ctre::phoenix::motorcontrol::can::BaseMotorController:
ctre::phoenix::motorcontrol::IMotorController ctre::phoenix::motorcontrol::IFollower ctre::phoenix::motorcontrol::can::BaseTalon ctre::phoenix::motorcontrol::can::VictorSPX ctre::phoenix::motorcontrol::can::WPI_BaseMotorController ctre::phoenix::motorcontrol::can::TalonFX ctre::phoenix::motorcontrol::can::TalonSRX ctre::phoenix::motorcontrol::can::WPI_VictorSPX ctre::phoenix::motorcontrol::can::WPI_TalonFX ctre::phoenix::motorcontrol::can::WPI_TalonSRX ctre::phoenix::motorcontrol::can::WPI_VictorSPX ctre::phoenix::motorcontrol::can::WPI_TalonFX ctre::phoenix::motorcontrol::can::WPI_TalonSRX

Public Member Functions

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

Static Public Member Functions

static void DestroyAllMotControllers ()
 Destructs all motor controller objects. More...
 

Protected Member Functions

ctre::phoenix::motorcontrol::VictorSPXSimCollectionGetVictorSPXSimCollection ()
 
virtual ctre::phoenix::ErrorCode BaseConfigAllSettings (const BaseMotorControllerConfiguration &allConfigs, int timeoutMs)
 Configures all base persistant settings. More...
 
virtual void BaseGetAllConfigs (BaseMotorControllerConfiguration &allConfigs, int timeoutMs)
 Gets all base persistant settings. More...
 
virtual void BaseGetPIDConfigs (BasePIDSetConfiguration &pid, int pidIdx, int timeoutMs)
 Gets all base PID set persistant settings. More...
 
virtual double GetOutputCurrent ()
 Gets the output current of the motor controller. More...
 

Detailed Description

Base motor controller features for all CTRE CAN motor controllers.

Constructor & Destructor Documentation

◆ BaseMotorController() [1/3]

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

Constructor for motor controllers.

Parameters
arbIdDevice ID [0,62]
modelString model of device. Examples: "Talon SRX", "Talon FX", "Victor SPX".
canbusName of the CANbus; can be a SocketCAN interface (on Linux), or a CANivore device name or serial number

◆ ~BaseMotorController()

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

◆ BaseMotorController() [2/3]

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

◆ BaseMotorController() [3/3]

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

Member Function Documentation

◆ BaseConfigAllSettings()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::BaseConfigAllSettings ( const BaseMotorControllerConfiguration allConfigs,
int  timeoutMs 
)
protectedvirtual

Configures all base persistant settings.

Parameters
allConfigsObject with all of the base 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.

◆ BaseGetAllConfigs()

virtual void ctre::phoenix::motorcontrol::can::BaseMotorController::BaseGetAllConfigs ( BaseMotorControllerConfiguration allConfigs,
int  timeoutMs 
)
protectedvirtual

Gets all base persistant settings.

Parameters
allConfigsObject with all of the base 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.

◆ BaseGetPIDConfigs()

virtual void ctre::phoenix::motorcontrol::can::BaseMotorController::BaseGetPIDConfigs ( BasePIDSetConfiguration pid,
int  pidIdx,
int  timeoutMs 
)
protectedvirtual

Gets all base PID set persistant settings.

Parameters
pidObject with all of the base 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.

◆ ChangeMotionControlFramePeriod()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ChangeMotionControlFramePeriod ( int  periodMs)
virtual

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.

Ideally the period should be no more than half the period of a trajectory point.

Parameters
periodMsThe transmit period in ms.
Returns
Error Code generated by function. 0 indicates no error.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ ClearMotionProfileHasUnderrun()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ClearMotionProfileHasUnderrun ( int  timeoutMs = 0)
virtual

Clear the "Has Underrun" flag.

Typically this is called after application has confirmed an underrun had occured.

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.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ ClearMotionProfileTrajectories()

virtual ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ClearMotionProfileTrajectories ( )
virtual

Clear the buffered motion profile in both controller's RAM (bottom), and in the API (top).

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ ClearStickyFaults()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ClearStickyFaults ( int  timeoutMs = 0)
virtual

Clears all sticky faults.

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
Last Error Code generated by a function.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ Config_IntegralZone()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::Config_IntegralZone ( int  slotIdx,
double  izone,
int  timeoutMs = 0 
)
virtual

Sets the Integral Zone constant in the given parameter slot.

If the (absolute) closed-loop error is outside of this zone, integral accumulator is automatically cleared. This ensures than integral wind up events will stop after the sensor gets far enough from its target.

Parameters
slotIdxParameter slot for the constant.
izoneValue of the Integral Zone constant (closed loop error units X 1ms).
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::IMotorController.

◆ Config_kD()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::Config_kD ( int  slotIdx,
double  value,
int  timeoutMs = 0 
)
virtual

Sets the 'D' constant in the given parameter slot.

This is multiplied by derivative error (sensor units per PID loop, typically 1ms). Note the closed loop output interprets a final value of 1023 as full output. So use a gain of '250' to get full output if derr is 4096u (Mag Encoder 1 rotation) per 1000 loops (typ 1 sec)

Parameters
slotIdxParameter slot for the constant.
valueValue of the D constant.
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::IMotorController.

◆ Config_kF()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::Config_kF ( int  slotIdx,
double  value,
int  timeoutMs = 0 
)
virtual

Sets the 'F' constant in the given parameter slot.

See documentation for calculation details. If using velocity, motion magic, or motion profile, use (1023 * duty-cycle / sensor-velocity-sensor-units-per-100ms).

Parameters
slotIdxParameter slot for the constant.
valueValue of the F constant.
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::IMotorController.

◆ Config_kI()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::Config_kI ( int  slotIdx,
double  value,
int  timeoutMs = 0 
)
virtual

Sets the 'I' constant in the given parameter slot.

This is multiplied by accumulated closed loop error in sensor units every PID Loop. Note the closed loop output interprets a final value of 1023 as full output. So use a gain of '0.00025' to get full output if err is 4096u for 1000 loops (accumulater holds 4,096,000), [which is equivalent to one CTRE mag encoder rotation for 1000 milliseconds].

Parameters
slotIdxParameter slot for the constant.
valueValue of the I constant.
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::IMotorController.

◆ Config_kP()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::Config_kP ( int  slotIdx,
double  value,
int  timeoutMs = 0 
)
virtual

Sets the 'P' constant in the given parameter slot.

This is multiplied by closed loop error in sensor units. Note the closed loop output interprets a final value of 1023 as full output. So use a gain of '0.25' to get full output if err is 4096u (Mag Encoder 1 rotation)

Parameters
slotIdxParameter slot for the constant.
valueValue of the P constant.
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::IMotorController.

◆ ConfigAllowableClosedloopError()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigAllowableClosedloopError ( int  slotIdx,
double  allowableCloseLoopError,
int  timeoutMs = 0 
)
virtual

Sets the allowable closed-loop error in the given parameter slot.

Parameters
slotIdxParameter slot for the constant.
allowableCloseLoopErrorValue of the allowable closed-loop error in sensor units (or sensor units per 100ms for velocity).
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::IMotorController.

◆ ConfigAuxPIDPolarity()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigAuxPIDPolarity ( bool  invert,
int  timeoutMs = 0 
)
virtual

Configures the Polarity of the Auxiliary PID (PID1).

Standard Polarity: Primary Output = PID0 + PID1, Auxiliary Output = PID0 - PID1,

Inverted Polarity: Primary Output = PID0 - PID1, Auxiliary Output = PID0 + PID1,

Parameters
invertIf true, use inverted PID1 output polarity.
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

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ ConfigClearPositionOnLimitF()

virtual ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigClearPositionOnLimitF ( bool  clearPositionOnLimitF,
int  timeoutMs = 0 
)
virtual

Enables clearing the position of the feedback sensor when the forward limit switch is triggered.

Parameters
clearPositionOnLimitFWhether clearing is enabled, defaults false
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::IMotorController.

◆ ConfigClearPositionOnLimitR()

virtual ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigClearPositionOnLimitR ( bool  clearPositionOnLimitR,
int  timeoutMs = 0 
)
virtual

Enables clearing the position of the feedback sensor when the reverse limit switch is triggered.

Parameters
clearPositionOnLimitRWhether clearing is enabled, defaults false
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::IMotorController.

◆ ConfigClearPositionOnQuadIdx()

virtual ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigClearPositionOnQuadIdx ( bool  clearPositionOnQuadIdx,
int  timeoutMs = 0 
)
virtual

Enables clearing the position of the feedback sensor when the quadrature index signal is detected.

Parameters
clearPositionOnQuadIdxWhether clearing is enabled, defaults false
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::IMotorController.

◆ ConfigClosedLoopPeakOutput()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigClosedLoopPeakOutput ( int  slotIdx,
double  percentOut,
int  timeoutMs = 0 
)
virtual

Sets the peak closed-loop output.

This peak output is slot-specific and is applied to the output of the associated PID loop. This setting is seperate from the generic Peak Output setting.

Parameters
slotIdxParameter slot for the constant.
percentOutPeak Percent Output from 0 to 1. This value is absolute and the magnitude will apply in both forward and reverse directions.
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::IMotorController.

◆ ConfigClosedLoopPeriod()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigClosedLoopPeriod ( int  slotIdx,
int  loopTimeMs,
int  timeoutMs = 0 
)
virtual

Sets the loop time (in milliseconds) of the PID closed-loop calculations.

Default value is 1 ms.

Parameters
slotIdxParameter slot for the constant.
loopTimeMsLoop timing of the closed-loop calculations. Minimum value of 1 ms, maximum of 64 ms.
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::IMotorController.

◆ ConfigClosedloopRamp()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigClosedloopRamp ( double  secondsFromNeutralToFull,
int  timeoutMs = 0 
)
virtual

Configures the closed-loop ramp rate of throttle output.

Parameters
secondsFromNeutralToFullMinimum desired time to go from neutral to full throttle. A value of '0' will disable the ramp.
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::IMotorController.

◆ ConfigFactoryDefault()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigFactoryDefault ( int  timeoutMs = 50)
virtual

Revert all configurations to factory default values.

Use this before your individual config* calls to avoid having to config every single param.

Alternatively you can use the configAllSettings routine.

Parameters
timeoutMsTimeout value in ms. Function will generate error if config is not successful within timeout.
Returns
Error Code generated by function. 0 indicates no error.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ ConfigFeedbackNotContinuous()

virtual ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigFeedbackNotContinuous ( bool  feedbackNotContinuous,
int  timeoutMs = 0 
)
virtual

Disables continuous tracking of the position for analog and pulse-width.

If the signal goes from 4095 to 0 (pulse-width) a motor controller will continue to read 4096 by default. If overflow tracking is disabled, it will wrap to 0 (not continuous)

If using pulse-width on CTRE Mag Encoder (within one rotation) or absolute analog sensor (within one rotation), setting feedbackNotContinuous to true is recommended, to prevent intermittent connections from causing sensor "jumps" of 4096 (or 1024 for analog) units.

Parameters
feedbackNotContinuousTrue to disable the overflow tracking.
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::IMotorController.

◆ ConfigForwardLimitSwitchSource() [1/2]

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigForwardLimitSwitchSource ( LimitSwitchSource  type,
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
typeLimit 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 in ctre::phoenix::motorcontrol::can::BaseTalon.

◆ ConfigForwardLimitSwitchSource() [2/2]

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

Configures the forward limit switch for a remote source.

For example, a CAN motor controller may need to monitor the Limit-F pin of another Talon or CANifier.

Parameters
typeRemote limit switch source. User can choose between a 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.

Implements ctre::phoenix::motorcontrol::IMotorController.

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

◆ ConfigForwardSoftLimitEnable()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigForwardSoftLimitEnable ( bool  enable,
int  timeoutMs = 0 
)
virtual

Configures the forward soft limit enable.

Parameters
enableForward Sensor Position Limit Enable.
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::IMotorController.

◆ ConfigForwardSoftLimitThreshold()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigForwardSoftLimitThreshold ( double  forwardSensorLimit,
int  timeoutMs = 0 
)
virtual

Configures the forward soft limit threhold.

Parameters
forwardSensorLimitForward Sensor Position Limit (in raw sensor units).
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::IMotorController.

◆ ConfigGetCustomParam()

virtual int ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigGetCustomParam ( int  paramIndex,
int  timeoutMs = 0 
)
virtual

Gets the value of a custom parameter.

Parameters
paramIndexIndex of custom parameter [0,1].
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
Value of the custom param.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ ConfigGetParameter() [1/2]

virtual double ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigGetParameter ( ctre::phoenix::ParamEnum  param,
int  ordinal,
int  timeoutMs = 0 
)
virtual

Gets a parameter.

Parameters
paramParameter enumeration.
ordinalOrdinal of parameter.
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
Value of parameter.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ ConfigGetParameter() [2/2]

virtual ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigGetParameter ( ParamEnum  param,
int32_t  valueToSend,
int32_t &  valueReceived,
uint8_t &  subValue,
int32_t  ordinal,
int32_t  timeoutMs 
)
virtual

Gets a parameter by passing an int by reference.

Parameters
paramParameter enumeration
valueToSendValue to send to parameter
valueReceivedReference to integer to receive
subValueSubValue of parameter
ordinalOrdinal of parameter
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.

◆ ConfigLimitSwitchDisableNeutralOnLOS()

virtual ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigLimitSwitchDisableNeutralOnLOS ( bool  limitSwitchDisableNeutralOnLOS,
int  timeoutMs = 0 
)
virtual

Disables limit switches triggering (if enabled) when the sensor is no longer detected.

Parameters
limitSwitchDisableNeutralOnLOSdisable triggering
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::IMotorController.

◆ ConfigMaxIntegralAccumulator()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigMaxIntegralAccumulator ( int  slotIdx,
double  iaccum,
int  timeoutMs = 0 
)
virtual

Sets the maximum integral accumulator in the given parameter slot.

Parameters
slotIdxParameter slot for the constant.
iaccumValue of the maximum integral accumulator (closed loop error units X 1ms).
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::IMotorController.

◆ ConfigMotionAcceleration()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigMotionAcceleration ( double  sensorUnitsPer100msPerSec,
int  timeoutMs = 0 
)
virtual

Sets the Motion Magic Acceleration.

This is the target acceleration that the motion magic curve generator can use.

Parameters
sensorUnitsPer100msPerSecMotion Magic Acceleration (in raw sensor units per 100 ms per second).
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::IMotorController.

◆ ConfigMotionCruiseVelocity()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigMotionCruiseVelocity ( double  sensorUnitsPer100ms,
int  timeoutMs = 0 
)
virtual

Sets the Motion Magic Cruise Velocity.

This is the peak target velocity that the motion magic curve generator can use.

Parameters
sensorUnitsPer100msMotion Magic Cruise Velocity (in raw sensor units per 100 ms).
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::IMotorController.

◆ ConfigMotionProfileTrajectoryInterpolationEnable()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigMotionProfileTrajectoryInterpolationEnable ( bool  enable,
int  timeoutMs = 0 
)
virtual

When trajectory points are processed in the buffer, the motor controller can linearly interpolate additional trajectory points between the buffered points.

The time delta between these interpolated points is 1 ms.

By default this feature is enabled.

Parameters
enableWhether to enable the trajectory point interpolation feature.
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.

◆ ConfigMotionProfileTrajectoryPeriod()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigMotionProfileTrajectoryPeriod ( int  baseTrajDurationMs,
int  timeoutMs = 0 
)
virtual

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

This allows general selection of the execution rate of the points with 1ms resolution, while allowing some degree of change from point to point.

Parameters
baseTrajDurationMsThe base duration time of every trajectory point. This is summed with the trajectory points unique timeDur.
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::IMotorController.

◆ ConfigMotionSCurveStrength()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigMotionSCurveStrength ( int  curveStrength,
int  timeoutMs = 0 
)
virtual

Sets the Motion Magic S Curve Strength.

Call this before using Motion Magic. Modifying this during a Motion Magic action should be avoided.

Parameters
curveStrength0 to use Trapezoidal Motion Profile. [1,8] for S-Curve (greater value yields greater smoothing).
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::IMotorController.

◆ ConfigNeutralDeadband()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigNeutralDeadband ( double  percentDeadband,
int  timeoutMs = 0 
)
virtual

Configures the output deadband percentage.

Parameters
percentDeadbandDesired deadband percentage. Minimum is 0.1%, Maximum is 25%. Pass 0.04 for 4% (factory default).
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::IMotorController.

◆ ConfigNominalOutputForward()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigNominalOutputForward ( double  percentOut,
int  timeoutMs = 0 
)
virtual

Configures the forward nominal output percentage.

Parameters
percentOutNominal (minimum) percent output. [0,+1]
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::IMotorController.

◆ ConfigNominalOutputReverse()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigNominalOutputReverse ( double  percentOut,
int  timeoutMs = 0 
)
virtual

Configures the reverse nominal output percentage.

Parameters
percentOutNominal (minimum) percent output. [-1,0]
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::IMotorController.

◆ ConfigOpenloopRamp()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigOpenloopRamp ( double  secondsFromNeutralToFull,
int  timeoutMs = 0 
)
virtual

Configures the open-loop ramp rate of throttle output.

Parameters
secondsFromNeutralToFullMinimum desired time to go from neutral to full throttle. A value of '0' will disable the ramp.
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::IMotorController.

◆ ConfigPeakOutputForward()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigPeakOutputForward ( double  percentOut,
int  timeoutMs = 0 
)
virtual

Configures the forward peak output percentage.

Parameters
percentOutDesired peak output percentage. [0,1]
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::IMotorController.

◆ ConfigPeakOutputReverse()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigPeakOutputReverse ( double  percentOut,
int  timeoutMs = 0 
)
virtual

Configures the reverse peak output percentage.

Parameters
percentOutDesired peak output percentage.
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::IMotorController.

◆ ConfigPulseWidthPeriod_EdgesPerRot()

virtual ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigPulseWidthPeriod_EdgesPerRot ( int  pulseWidthPeriod_EdgesPerRot,
int  timeoutMs = 0 
)
virtual

Sets the edges per rotation of a pulse width sensor.

(This should be set for tachometer use).

Parameters
pulseWidthPeriod_EdgesPerRotedges per rotation
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::IMotorController.

◆ ConfigPulseWidthPeriod_FilterWindowSz()

virtual ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigPulseWidthPeriod_FilterWindowSz ( int  pulseWidthPeriod_FilterWindowSz,
int  timeoutMs = 0 
)
virtual

Sets the number of samples to use in smoothing a pulse width sensor with a rolling average.

Default is 1 (no smoothing).

Parameters
pulseWidthPeriod_FilterWindowSzsamples for rolling avg
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::IMotorController.

◆ ConfigRemoteFeedbackFilter() [1/3]

virtual ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigRemoteFeedbackFilter ( ctre::phoenix::motorcontrol::can::BaseTalon talonRef,
int  remoteOrdinal,
int  timeoutMs = 0 
)
virtual

Select what remote device and signal to assign to Remote Sensor 0 or Remote Sensor 1.

After binding a remote device and signal to Remote Sensor X, you may select Remote Sensor X as a PID source for closed-loop features.

Parameters
talonRefTalon device reference to use.
remoteOrdinal0 for configuring Remote Sensor 0, 1 for configuring Remote Sensor 1
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::IMotorController.

◆ ConfigRemoteFeedbackFilter() [2/3]

virtual ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigRemoteFeedbackFilter ( ctre::phoenix::sensors::CANCoder canCoderRef,
int  remoteOrdinal,
int  timeoutMs = 0 
)
virtual

Select what remote device and signal to assign to Remote Sensor 0 or Remote Sensor 1.

After binding a remote device and signal to Remote Sensor X, you may select Remote Sensor X as a PID source for closed-loop features.

Parameters
canCoderRefCANCoder device reference to use.
remoteOrdinal0 for configuring Remote Sensor 0, 1 for configuring Remote Sensor 1
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::IMotorController.

◆ ConfigRemoteFeedbackFilter() [3/3]

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigRemoteFeedbackFilter ( int  deviceID,
RemoteSensorSource  remoteSensorSource,
int  remoteOrdinal,
int  timeoutMs = 0 
)
virtual

Select what remote device and signal to assign to Remote Sensor 0 or Remote Sensor 1.

After binding a remote device and signal to Remote Sensor X, you may select Remote Sensor X as a PID source for closed-loop features.

Parameters
deviceIDThe device ID of the remote sensor device.
remoteSensorSourceThe remote sensor device and signal type to bind.
remoteOrdinal0 for configuring Remote Sensor 0, 1 for configuring Remote Sensor 1
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::IMotorController.

◆ ConfigRemoteSensorClosedLoopDisableNeutralOnLOS()

virtual ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigRemoteSensorClosedLoopDisableNeutralOnLOS ( bool  remoteSensorClosedLoopDisableNeutralOnLOS,
int  timeoutMs = 0 
)
virtual

Disables going to neutral (brake/coast) when a remote sensor is no longer detected.

Parameters
remoteSensorClosedLoopDisableNeutralOnLOSdisable going to neutral
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::IMotorController.

◆ ConfigReverseLimitSwitchSource() [1/2]

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigReverseLimitSwitchSource ( LimitSwitchSource  type,
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
typeLimit 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 in ctre::phoenix::motorcontrol::can::BaseTalon.

◆ ConfigReverseLimitSwitchSource() [2/2]

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

Configures the reverse limit switch for a remote source.

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

Parameters
typeRemote limit switch source. User can choose between a 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.

Implements ctre::phoenix::motorcontrol::IMotorController.

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

◆ ConfigReverseSoftLimitEnable()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigReverseSoftLimitEnable ( bool  enable,
int  timeoutMs = 0 
)
virtual

Configures the reverse soft limit enable.

Parameters
enableReverse Sensor Position Limit Enable.
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::IMotorController.

◆ ConfigReverseSoftLimitThreshold()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigReverseSoftLimitThreshold ( double  reverseSensorLimit,
int  timeoutMs = 0 
)
virtual

Configures the reverse soft limit threshold.

Parameters
reverseSensorLimitReverse Sensor Position Limit (in raw sensor units).
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::IMotorController.

◆ ConfigSelectedFeedbackCoefficient()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigSelectedFeedbackCoefficient ( double  coefficient,
int  pidIdx = 0,
int  timeoutMs = 0 
)
virtual

The Feedback Coefficient is a scalar applied to the value of the feedback sensor.

Useful when you need to scale your sensor values within the closed-loop calculations. Default value is 1.

Selected Feedback Sensor register in firmware is the decoded sensor value multiplied by the Feedback Coefficient.

Parameters
coefficientFeedback Coefficient value. Maximum value of 1. Resolution is 1/(2^16). Cannot be 0.
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.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ ConfigSelectedFeedbackSensor() [1/2]

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

Select the feedback device for the motor controller.

Parameters
feedbackDeviceFeedback 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 in ctre::phoenix::motorcontrol::can::TalonSRX, ctre::phoenix::motorcontrol::can::BaseTalon, ctre::phoenix::motorcontrol::can::TalonFX, ctre::phoenix::motorcontrol::can::WPI_TalonFX, and ctre::phoenix::motorcontrol::can::WPI_TalonSRX.

◆ ConfigSelectedFeedbackSensor() [2/2]

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

Implements ctre::phoenix::motorcontrol::IMotorController.

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

◆ ConfigSensorTerm() [1/2]

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigSensorTerm ( SensorTerm  sensorTerm,
FeedbackDevice  feedbackDevice,
int  timeoutMs = 0 
)
virtual

Select what sensor term should be bound to switch feedback device.

Sensor Sum = Sensor Sum Term 0 - Sensor Sum Term 1 Sensor Difference = Sensor Diff Term 0 - Sensor Diff Term 1 The four terms are specified with this routine. Then Sensor Sum/Difference can be selected for closed-looping.

Parameters
sensorTermWhich sensor term to bind to a feedback source.
feedbackDeviceThe sensor signal to attach to sensorTerm.
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::IMotorController.

◆ ConfigSensorTerm() [2/2]

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigSensorTerm ( SensorTerm  sensorTerm,
RemoteFeedbackDevice  feedbackDevice,
int  timeoutMs = 0 
)
virtual

Select what sensor term should be bound to switch feedback device.

Sensor Sum = Sensor Sum Term 0 - Sensor Sum Term 1 Sensor Difference = Sensor Diff Term 0 - Sensor Diff Term 1 The four terms are specified with this routine. Then Sensor Sum/Difference can be selected for closed-looping.

Parameters
sensorTermWhich sensor term to bind to a feedback source.
feedbackDeviceThe sensor signal to attach to sensorTerm.
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.

◆ ConfigSetCustomParam()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigSetCustomParam ( int  newValue,
int  paramIndex,
int  timeoutMs = 0 
)
virtual

Sets the value of a custom parameter.

This is for arbitrary use.

Sometimes it is necessary to save calibration/limit/target information in the device. Particularly if the device is part of a subsystem that can be replaced.

Parameters
newValueValue for custom parameter.
paramIndexIndex of custom parameter [0,1]
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::IMotorController.

◆ ConfigSetParameter()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigSetParameter ( ctre::phoenix::ParamEnum  param,
double  value,
uint8_t  subValue,
int  ordinal,
int  timeoutMs = 0 
)
virtual

Sets a parameter.

Generally this is not used. This can be utilized in - Using new features without updating API installation. - Errata workarounds to circumvent API implementation. - Allows for rapid testing / unit testing of firmware.

Parameters
paramParameter enumeration.
valueValue of parameter.
subValueSubvalue for parameter. Maximum value of 255.
ordinalOrdinal of parameter.
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::IMotorController.

◆ ConfigSoftLimitDisableNeutralOnLOS()

virtual ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigSoftLimitDisableNeutralOnLOS ( bool  softLimitDisableNeutralOnLOS,
int  timeoutMs = 0 
)
virtual

Disables soft limits triggering (if enabled) when the sensor is no longer detected.

Parameters
softLimitDisableNeutralOnLOSdisable triggering
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::IMotorController.

◆ ConfigureSlot()

ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigureSlot ( const SlotConfiguration slot,
int  slotIdx,
int  timeoutMs 
)

Configures all slot persistant settings.

Parameters
slotObject with all of the slot persistant settings
slotIdxIndex of slot to configure
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.

◆ ConfigVelocityMeasurementPeriod() [1/2]

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigVelocityMeasurementPeriod ( ctre::phoenix::sensors::SensorVelocityMeasPeriod  period,
int  timeoutMs = 0 
)
virtual

Sets the period over which velocity measurements are taken.

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 in ctre::phoenix::motorcontrol::can::BaseTalon.

◆ ConfigVelocityMeasurementPeriod() [2/2]

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

◆ ConfigVelocityMeasurementWindow()

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

◆ ConfigVoltageCompSaturation()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigVoltageCompSaturation ( double  voltage,
int  timeoutMs = 0 
)
virtual

Configures the Voltage Compensation saturation voltage.

Parameters
voltageThis is the max voltage to apply to the hbridge when voltage compensation is enabled. For example, if 10 (volts) is specified and a TalonSRX is commanded to 0.5 (PercentOutput, closed-loop, etc) then the TalonSRX will attempt to apply a duty-cycle to produce 5V.
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::IMotorController.

◆ ConfigVoltageMeasurementFilter()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::ConfigVoltageMeasurementFilter ( int  filterWindowSamples,
int  timeoutMs = 0 
)
virtual

Configures the voltage measurement filter.

Parameters
filterWindowSamplesNumber of samples in the rolling average of voltage measurement.
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::IMotorController.

◆ DestroyAllMotControllers()

static void ctre::phoenix::motorcontrol::can::BaseMotorController::DestroyAllMotControllers ( )
static

Destructs all motor controller objects.

◆ EnableVoltageCompensation()

virtual void ctre::phoenix::motorcontrol::can::BaseMotorController::EnableVoltageCompensation ( bool  enable)
virtual

Enables voltage compensation.

If enabled, voltage compensation works in all control modes.

Be sure to configure the saturation voltage before enabling this.

Parameters
enableEnable state of voltage compensation.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ Follow() [1/2]

virtual void ctre::phoenix::motorcontrol::can::BaseMotorController::Follow ( IMotorController masterToFollow)
virtual

Set the control mode and output value so that this motor controller will follow another motor controller.

Currently supports following Victor SPX, Talon SRX, and Talon FX.

Implements ctre::phoenix::motorcontrol::IFollower.

◆ Follow() [2/2]

void ctre::phoenix::motorcontrol::can::BaseMotorController::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.

Currently supports following Victor SPX, Talon SRX, and Talon FX.

Parameters
masterToFollowMotor Controller object to follow.
followerTypeType of following control. Use AuxOutput1 to follow the master device's auxiliary output 1. Use PercentOutput for standard follower mode.

◆ GetActiveTrajectoryArbFeedFwd()

virtual double ctre::phoenix::motorcontrol::can::BaseMotorController::GetActiveTrajectoryArbFeedFwd ( int  pidIdx = 0)
virtual

Gets the active trajectory arbitrary feedforward using MotionMagic/MotionProfile control modes.

Parameters
pidIdx0 for Primary closed-loop. 1 for auxiliary closed-loop.
Returns
The Active Trajectory ArbFeedFwd in units of percent output (where 0.01 is 1%).

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ GetActiveTrajectoryPosition()

virtual double ctre::phoenix::motorcontrol::can::BaseMotorController::GetActiveTrajectoryPosition ( int  pidIdx = 0)
virtual

Gets the active trajectory target position using MotionMagic/MotionProfile control modes.

Returns
The Active Trajectory Position in sensor units.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ GetActiveTrajectoryVelocity()

virtual double ctre::phoenix::motorcontrol::can::BaseMotorController::GetActiveTrajectoryVelocity ( int  pidIdx = 0)
virtual

Gets the active trajectory target velocity using MotionMagic/MotionProfile control modes.

Returns
The Active Trajectory Velocity in sensor units per 100ms.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ GetBaseID()

virtual int ctre::phoenix::motorcontrol::can::BaseMotorController::GetBaseID ( )
virtual
Returns
BaseID of device

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ GetBusVoltage()

virtual double ctre::phoenix::motorcontrol::can::BaseMotorController::GetBusVoltage ( )
virtual

Gets the bus voltage seen by the device.

Returns
The bus voltage value (in volts).

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ GetClosedLoopError()

virtual double ctre::phoenix::motorcontrol::can::BaseMotorController::GetClosedLoopError ( int  pidIdx = 0)
virtual

Gets the closed-loop error.

The units depend on which control mode is in use.

If closed-loop is seeking a target sensor position, closed-loop error is the difference between target and current sensor value (in sensor units. Example 4096 units per rotation for CTRE Mag Encoder).

If closed-loop is seeking a target sensor velocity, closed-loop error is the difference between target and current sensor value (in sensor units per 100ms).

If using motion profiling or Motion Magic, closed loop error is calculated against the current target, and not the "final" target at the end of the profile/movement.

See Phoenix-Documentation information on units.

Parameters
pidIdx0 for Primary closed-loop. 1 for auxiliary closed-loop.
Returns
Closed-loop error value.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ GetClosedLoopTarget()

virtual double ctre::phoenix::motorcontrol::can::BaseMotorController::GetClosedLoopTarget ( int  pidIdx = 0)
virtual

Gets the current target of a given closed loop.

Parameters
pidIdx0 for Primary closed-loop. 1 for auxiliary closed-loop.
Returns
The closed loop target.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ GetControlMode()

virtual ControlMode ctre::phoenix::motorcontrol::can::BaseMotorController::GetControlMode ( )
virtual
Returns
control mode motor controller is in

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ GetDeviceID()

virtual int ctre::phoenix::motorcontrol::can::BaseMotorController::GetDeviceID ( )
virtual

Returns the Device ID.

Returns
Device number.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ GetErrorDerivative()

virtual double ctre::phoenix::motorcontrol::can::BaseMotorController::GetErrorDerivative ( int  pidIdx = 0)
virtual

Gets the derivative of the closed-loop error.

Parameters
pidIdx0 for Primary closed-loop. 1 for auxiliary closed-loop.
Returns
The error derivative value.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ GetFaults()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::GetFaults ( Faults toFill)
virtual

Polls the various fault flags.

Parameters
toFillCaller's object to fill with latest fault flags.
Returns
Last Error Code generated by a function.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ GetFilterConfigs()

void ctre::phoenix::motorcontrol::can::BaseMotorController::GetFilterConfigs ( FilterConfiguration Filter,
int  ordinal = 0,
int  timeoutMs = 50 
)

Gets all filter persistant settings.

Parameters
FilterObject with all of the filter persistant settings
ordinal0 for remote sensor 0 and 1 for remote sensor 1.
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.

◆ GetFirmwareVersion()

virtual int ctre::phoenix::motorcontrol::can::BaseMotorController::GetFirmwareVersion ( )
virtual

Gets the firmware version of the device.

Returns
Firmware version of device. For example: version 1-dot-2 is 0x0102.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ GetHandle()

void * ctre::phoenix::motorcontrol::can::BaseMotorController::GetHandle ( )
Returns
CCI handle for child classes.

◆ GetIntegralAccumulator()

virtual double ctre::phoenix::motorcontrol::can::BaseMotorController::GetIntegralAccumulator ( int  pidIdx = 0)
virtual

Gets the iaccum value.

Parameters
pidIdx0 for Primary closed-loop. 1 for auxiliary closed-loop.
Returns
Integral accumulator value (Closed-loop error X 1ms).

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ GetInverted()

virtual bool ctre::phoenix::motorcontrol::can::BaseMotorController::GetInverted ( ) const
virtual
Returns
invert setting of motor output.

Implements ctre::phoenix::motorcontrol::IMotorController.

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

◆ GetLastError()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::GetLastError ( )
virtual

Gets the last error generated by this object.

Not all functions return an error code but can potentially report errors. This function can be used to retrieve those error codes.

Returns
Last Error Code generated by a function.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ GetMotionProfileStatus()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::GetMotionProfileStatus ( ctre::phoenix::motion::MotionProfileStatus statusToFill)
virtual

Retrieve all status information.

For best performance, Caller can snapshot all status information regarding the motion profile executer.

Parameters
statusToFillCaller supplied object to fill.

The members are filled, as follows...

topBufferRem: The available empty slots in the trajectory buffer. The robot API holds a "top buffer" of trajectory points, so your applicaion can dump several points at once. The API will then stream them into the low-level buffer, allowing the motor controller to act on them.

topBufferRem: The number of points in the top trajectory buffer.

btmBufferCnt: The number of points in the low level controller buffer.

hasUnderrun: Set if isUnderrun ever gets set. Can be manually cleared by ClearMotionProfileHasUnderrun() or automatically cleared by StartMotionProfile().

isUnderrun: This is set if controller needs to shift a point from its buffer into the active trajectory point however the buffer is empty. This gets cleared automatically when is resolved.

activePointValid: True if the active trajectory point is not empty, false otherwise. The members in activePoint are only valid if this signal is set.

isLast: is set/cleared based on the MP executer's current trajectory point's IsLast value. This assumes IsLast was set when PushMotionProfileTrajectory was used to insert the currently processed trajectory point.

profileSlotSelect: The currently processed trajectory point's selected slot. This can differ in the currently selected slot used for Position and Velocity servo modes

outputEnable: The current output mode of the motion profile executer (disabled, enabled, or hold). When changing the set() value in MP mode, it's important to check this signal to confirm the change takes effect before interacting with the top buffer.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ GetMotionProfileTopLevelBufferCount()

virtual int ctre::phoenix::motorcontrol::can::BaseMotorController::GetMotionProfileTopLevelBufferCount ( )
virtual

Retrieve just the buffer count for the api-level (top) buffer.

This routine performs no CAN or data structure lookups, so its fast and ideal if caller needs to quickly poll the progress of trajectory points being emptied into controller's RAM. Otherwise just use GetMotionProfileStatus.

Returns
number of trajectory points in the top buffer.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ GetMotorOutputPercent()

virtual double ctre::phoenix::motorcontrol::can::BaseMotorController::GetMotorOutputPercent ( )
virtual

Gets the output percentage of the motor controller.

Returns
Output of the motor controller (in percent).

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ GetMotorOutputVoltage()

virtual double ctre::phoenix::motorcontrol::can::BaseMotorController::GetMotorOutputVoltage ( )
virtual
Returns
applied voltage to motor in volts.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ GetOutputCurrent()

virtual double ctre::phoenix::motorcontrol::can::BaseMotorController::GetOutputCurrent ( )
protectedvirtual

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 in ctre::phoenix::motorcontrol::can::BaseTalon.

◆ GetSelectedSensorPosition()

virtual double ctre::phoenix::motorcontrol::can::BaseMotorController::GetSelectedSensorPosition ( int  pidIdx = 0)
virtual

Get the selected sensor position (in raw sensor units).

Parameters
pidIdx0 for Primary closed-loop. 1 for auxiliary closed-loop. See Phoenix-Documentation for how to interpret.
Returns
Position of selected sensor (in raw sensor units).

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ GetSelectedSensorVelocity()

virtual double ctre::phoenix::motorcontrol::can::BaseMotorController::GetSelectedSensorVelocity ( int  pidIdx = 0)
virtual

Get the selected sensor velocity.

Parameters
pidIdx0 for Primary closed-loop. 1 for auxiliary closed-loop.
Returns
selected sensor (in raw sensor units) per 100ms. See Phoenix-Documentation for how to interpret.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ GetSlotConfigs()

void ctre::phoenix::motorcontrol::can::BaseMotorController::GetSlotConfigs ( SlotConfiguration slot,
int  slotIdx = 0,
int  timeoutMs = 50 
)

Gets all slot persistant settings.

Parameters
slotObject with all of the slot persistant settings
slotIdxParameter slot for the constant.
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.

◆ GetStatusFramePeriod() [1/2]

virtual int ctre::phoenix::motorcontrol::can::BaseMotorController::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.

Implements ctre::phoenix::motorcontrol::IMotorController.

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

◆ GetStatusFramePeriod() [2/2]

virtual int ctre::phoenix::motorcontrol::can::BaseMotorController::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 in ctre::phoenix::motorcontrol::can::BaseTalon.

◆ GetStickyFaults()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::GetStickyFaults ( StickyFaults toFill)
virtual

Polls the various sticky fault flags.

Parameters
toFillCaller's object to fill with latest sticky fault flags.
Returns
Last Error Code generated by a function.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ GetTemperature()

virtual double ctre::phoenix::motorcontrol::can::BaseMotorController::GetTemperature ( )
virtual

Gets the temperature of the motor controller.

Returns
Temperature of the motor controller (in 'C)

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ GetVictorSPXSimCollection()

ctre::phoenix::motorcontrol::VictorSPXSimCollection & ctre::phoenix::motorcontrol::can::BaseMotorController::GetVictorSPXSimCollection ( )
inlineprotected

◆ HasResetOccurred()

virtual bool ctre::phoenix::motorcontrol::can::BaseMotorController::HasResetOccurred ( )
virtual

Returns true if the device has reset since last call.

Returns
Has a Device Reset Occurred?

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ IsMotionProfileFinished()

virtual bool ctre::phoenix::motorcontrol::can::BaseMotorController::IsMotionProfileFinished ( )
virtual

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

If calling application uses the legacy API (more-complex buffering API) from previous years, than this API will not return true.

Returns
true if MP was started using StartMotionProfile, and it has completed execution (MPE is now in "hold").

◆ IsMotionProfileTopLevelBufferFull()

virtual bool ctre::phoenix::motorcontrol::can::BaseMotorController::IsMotionProfileTopLevelBufferFull ( )
virtual

Retrieve just the buffer full for the api-level (top) buffer.

This routine performs no CAN or data structure lookups, so its fast and ideal if caller needs to quickly poll. Otherwise just use GetMotionProfileStatus.

Returns
number of trajectory points in the top buffer.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ IsVoltageCompensationEnabled()

virtual bool ctre::phoenix::motorcontrol::can::BaseMotorController::IsVoltageCompensationEnabled ( )
virtual

Returns the enable state of Voltage Compensation that the caller has set.

Returns
TRUE if voltage compensation is enabled.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ NeutralOutput()

virtual void ctre::phoenix::motorcontrol::can::BaseMotorController::NeutralOutput ( )
virtual

Neutral the motor output by setting control mode to disabled.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ operator=()

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

◆ OverrideLimitSwitchesEnable()

void ctre::phoenix::motorcontrol::can::BaseMotorController::OverrideLimitSwitchesEnable ( bool  enable)
virtual

Sets the enable state for limit switches.

Parameters
enableEnable state for limit switches.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ OverrideSoftLimitsEnable()

virtual void ctre::phoenix::motorcontrol::can::BaseMotorController::OverrideSoftLimitsEnable ( bool  enable)
virtual

Can be used to override-disable the soft limits.

This function can be used to quickly disable soft limits without having to modify the persistent configuration.

Parameters
enableEnable state for soft limit switches.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ ProcessMotionProfileBuffer()

virtual void ctre::phoenix::motorcontrol::can::BaseMotorController::ProcessMotionProfileBuffer ( )
virtual

This must be called periodically to funnel the trajectory points from the API's top level buffer to the controller's bottom level buffer.

Recommendation is to call this twice as fast as the execution rate of the motion profile. So if MP is running with 20ms trajectory points, try calling this routine every 10ms. All motion profile functions are thread-safe through the use of a mutex, so there is no harm in having the caller utilize threading.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ PushMotionProfileTrajectory()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::PushMotionProfileTrajectory ( const ctre::phoenix::motion::TrajectoryPoint trajPt)
virtual

Push another trajectory point into the top level buffer (which is emptied into the motor controller's bottom buffer as room allows).

Parameters
trajPtto push into buffer. The members should be filled in with these values...
    targPos:  servo position in sensor units.
targVel:  velocity to feed-forward in sensor units
            per 100ms.
    profileSlotSelect0  Which slot to get PIDF gains. PID is used for position servo. F is used
                   as the Kv constant for velocity feed-forward. Typically this is hardcoded
                   to the a particular slot, but you are free gain schedule if need be.
                   Choose from [0,3]
profileSlotSelect1 Which slot to get PIDF gains for auxiliary PId.
                   This only has impact during MotionProfileArc Control mode.
                   Choose from [0,1].
   isLastPoint  set to nonzero to signal motor controller to keep processing this
                trajectory point, instead of jumping to the next one
                when timeDurMs expires.  Otherwise MP executer will
                eventually see an empty buffer after the last point
                expires, causing it to assert the IsUnderRun flag.
                However this may be desired if calling application
                never wants to terminate the MP.
zeroPos  set to nonzero to signal motor controller to "zero" the selected
            position sensor before executing this trajectory point.
            Typically the first point should have this set only thus
            allowing the remainder of the MP positions to be relative to
            zero.
timeDur Duration to apply this trajectory pt.
            This time unit is ADDED to the exising base time set by
            configMotionProfileTrajectoryPeriod().
Returns
CTR_OKAY if trajectory point push ok. ErrorCode if buffer is full due to kMotionProfileTopBufferCapacity.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ SelectProfileSlot()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::SelectProfileSlot ( int  slotIdx,
int  pidIdx 
)
virtual

Selects which profile slot to use for closed-loop control.

Parameters
slotIdxProfile slot to select.
pidIdx0 for Primary closed-loop. 1 for auxiliary closed-loop.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ Set() [1/2]

virtual void ctre::phoenix::motorcontrol::can::BaseMotorController::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);

Implements ctre::phoenix::motorcontrol::IMotorController.

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

◆ Set() [2/2]

virtual void ctre::phoenix::motorcontrol::can::BaseMotorController::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);

Implements ctre::phoenix::motorcontrol::IMotorController.

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

◆ SetControlFramePeriod()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::SetControlFramePeriod ( ControlFrame  frame,
int  periodMs 
)
virtual

Sets the period of the given control frame.

Parameters
frameFrame whose period is to be changed.
periodMsPeriod in ms for the given frame.
Returns
Error Code generated by function. 0 indicates no error.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ SetIntegralAccumulator()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::SetIntegralAccumulator ( double  iaccum,
int  pidIdx = 0,
int  timeoutMs = 0 
)
virtual

Sets the integral accumulator.

Typically this is used to clear/zero the integral accumulator, however some use cases may require seeding the accumulator for a faster response.

Parameters
iaccumValue to set for the integral accumulator (closed loop error units X 1ms).
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.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ SetInverted() [1/2]

virtual void ctre::phoenix::motorcontrol::can::BaseMotorController::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.

Implements ctre::phoenix::motorcontrol::IMotorController.

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

◆ SetInverted() [2/2]

virtual void ctre::phoenix::motorcontrol::can::BaseMotorController::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.

Implements ctre::phoenix::motorcontrol::IMotorController.

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

◆ SetNeutralMode()

virtual void ctre::phoenix::motorcontrol::can::BaseMotorController::SetNeutralMode ( NeutralMode  neutralMode)
virtual

Sets the mode of operation during neutral throttle output.

Parameters
neutralModeThe desired mode of operation when the Controller output throttle is neutral (ie brake/coast)

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ SetSelectedSensorPosition()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::SetSelectedSensorPosition ( double  sensorPos,
int  pidIdx = 0,
int  timeoutMs = 50 
)
virtual

Sets the sensor position to the given value.

Parameters
sensorPosPosition to set for the selected sensor (in raw sensor units).
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.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ SetSensorPhase()

virtual void ctre::phoenix::motorcontrol::can::BaseMotorController::SetSensorPhase ( bool  PhaseSensor)
virtual

Sets the phase of the sensor.

Use when controller forward/reverse output doesn't correlate to appropriate forward/reverse reading of sensor. Pick a value so that positive PercentOutput yields a positive change in sensor. After setting this, user can freely call SetInverted() with any value.

Parameters
PhaseSensorIndicates whether to invert the phase of the sensor.

Implements ctre::phoenix::motorcontrol::IMotorController.

◆ SetStatusFramePeriod() [1/2]

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

Implements ctre::phoenix::motorcontrol::IMotorController.

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

◆ SetStatusFramePeriod() [2/2]

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

◆ StartMotionProfile()

virtual ctre::phoenix::ErrorCode ctre::phoenix::motorcontrol::can::BaseMotorController::StartMotionProfile ( ctre::phoenix::motion::BufferedTrajectoryPointStream stream,
uint32_t  minBufferedPts,
ControlMode  motionProfControlMode 
)
virtual

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.

Once called, the motor controller software will automatically ... [1] Clear the firmware buffer of trajectory points. [2] Clear the underrun flags [3] Reset an index within the Buffered Trajectory Point Stream (so that the same profile can be run again and again). [4] Start a background thread to manage MP streaming (if not already running). [5a] If current control mode already matches motionProfControlMode, set MPE Output to "Hold". [5b] If current control mode does not matches motionProfControlMode, apply motionProfControlMode and set MPE Output to "Disable". [6] Stream the trajectory points into the device's firmware buffer. [7] Once motor controller has at least minBufferedPts worth in the firmware buffer, MP will automatically start (MPE Output set to "Enable"). [8] Wait until MP finishes, then transitions the Motion Profile Executor's output to "Hold". [9] IsMotionProfileFinished() will now return true.

Calling application can use IsMotionProfileFinished() to determine when internal state machine reaches [7]. Calling application can cancel MP by calling set(). Otherwise do not call set() until MP has completed.

The legacy API from previous years requires the calling application to pass points via the ProcessMotionProfileBuffer and PushMotionProfileTrajectory. This is no longer required if using this StartMotionProfile/IsMotionProfileFinished API.

Parameters
streamA buffer that will be used to stream the trajectory points. Caller can fill this container with the entire trajectory point, regardless of size.
minBufferedPtsMinimum number of firmware buffered points before starting MP. Do not exceed device's firmware buffer capacity or MP will never fire (120 for Motion Profile, or 60 for Motion Profile Arc). Recommendation value for this would be five to ten samples depending on timeDur of the trajectory point.
motionProfControlModePass MotionProfile or MotionProfileArc.
Returns
nonzero error code if operation fails.

◆ ValueUpdated()

virtual void ctre::phoenix::motorcontrol::can::BaseMotorController::ValueUpdated ( )
virtual

When master makes a device, this routine is called to signal the update.

Implements ctre::phoenix::motorcontrol::IFollower.


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