25namespace motorcontrol {
182 int timeoutMs = 0) = 0;
196 int timeoutMs = 0) = 0;
209 int timeoutMs = 0) = 0;
222 int timeoutMs = 0) = 0;
235 int timeoutMs = 0) = 0;
248 int timeoutMs = 0) = 0;
262 int timeoutMs = 0) = 0;
280 int timeoutMs = 0) = 0;
294 int timeoutMs = 0) = 0;
352 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
353 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
354 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
377 double coefficient,
int pidIdx = 0,
int timeoutMs = 0) = 0;
396 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
397 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
398 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
401 int timeoutMs = 0)= 0;
418 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
419 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
420 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
438 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
439 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
440 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
457 [[deprecated(
"This device's Phoenix 5 API is deprecated for removal in the 2025 season."
458 "Users should update to Phoenix 6 firmware and migrate to the Phoenix 6 API."
459 "A migration guide is available at https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html")]]
496 int timeoutMs = 50) = 0;
530 int timeoutMs = 0) = 0;
569 int deviceID,
int timeoutMs = 0) = 0;
591 int deviceID,
int timeoutMs = 0) = 0;
616 int timeoutMs = 0) = 0;
629 int timeoutMs = 0) = 0;
642 int timeoutMs = 0) = 0;
655 int timeoutMs = 0) = 0;
759 int timeoutMs = 0) = 0;
774 double allowableCloseLoopError,
int timeoutMs = 0) = 0;
790 int timeoutMs = 0) = 0;
864 int timeoutMs = 0) = 0;
964 int timeoutMs = 0) = 0;
979 int timeoutMs = 0) = 0;
1342 int timeoutMs = 0) = 0;
1378 uint8_t subValue,
int ordinal,
int timeoutMs = 0) = 0;
1393 int timeoutMs = 0) = 0;
Interface for followers.
Definition: IFollower.h:14
Interface for motor controllers.
Definition: IMotorController.h:35
virtual void NeutralOutput()=0
Neutral the motor output by setting control mode to disabled.
virtual ErrorCode SetStatusFramePeriod(StatusFrame frame, uint8_t periodMs, int timeoutMs=0)=0
Sets the period of the given status frame.
virtual ControlMode GetControlMode()=0
virtual ErrorCode SetControlFramePeriod(ControlFrame frame, int periodMs)=0
Sets the period of the given control frame.
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 a...
virtual double GetSelectedSensorVelocity(int pidIdx=0)=0
Get the selected sensor velocity.
virtual void Set(ControlMode mode, double demand0, DemandType demand1Type, double demand1)=0
virtual ErrorCode ConfigClosedloopRamp(double secondsFromNeutralToFull, int timeoutMs=0)=0
Configures the closed-loop ramp rate of throttle output.
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.
virtual ErrorCode Config_kD(int slotIdx, double value, int timeoutMs=0)=0
Sets the 'D' constant in the given parameter slot.
virtual ErrorCode ConfigMaxIntegralAccumulator(int slotIdx, double iaccum, int timeoutMs=0)=0
Sets the maximum integral accumulator in the given parameter slot.
virtual ErrorCode GetLastError()=0
Gets the last error generated by this object.
virtual ErrorCode GetStickyFaults(StickyFaults &toFill)=0
Polls the various sticky fault flags.
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.
virtual ErrorCode ConfigSelectedFeedbackSensor(RemoteFeedbackDevice feedbackDevice, int pidIdx=0, int timeoutMs=0)=0
Select the remote feedback device for the motor controller.
virtual void SetNeutralMode(NeutralMode neutralMode)=0
Sets the mode of operation during neutral throttle output.
virtual void OverrideLimitSwitchesEnable(bool enable)=0
Sets the enable state for limit switches.
virtual ErrorCode ConfigFeedbackNotContinuous(bool feedbackNotContinuous, int timeoutMs=0)=0
Disables continuous tracking of the position for analog and pulse-width.
virtual double GetSelectedSensorPosition(int pidIdx=0)=0
Get the selected sensor position (in raw sensor units).
virtual bool IsVoltageCompensationEnabled()=0
Returns the enable state of Voltage Compensation that the caller has set.
virtual ErrorCode SetIntegralAccumulator(double iaccum, int pidIdx=0, int timeoutMs=0)=0
Sets the integral accumulator.
virtual ErrorCode ConfigLimitSwitchDisableNeutralOnLOS(bool limitSwitchDisableNeutralOnLOS, int timeoutMs=0)=0
Disables limit switches triggering (if enabled) when the sensor is no longer detected.
virtual ErrorCode ConfigAuxPIDPolarity(bool invert, int timeoutMs=0)=0
Configures the Polarity of the Auxiliary PID (PID1).
virtual ErrorCode ChangeMotionControlFramePeriod(int periodMs)=0
Calling application can opt to speed up the handshaking between the robot API and the controller to i...
virtual double GetActiveTrajectoryVelocity(int pidIdx=0)=0
Gets the active trajectory target velocity for using MotionMagic/MotionProfile control modes.
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.
virtual ErrorCode ConfigPulseWidthPeriod_EdgesPerRot(int pulseWidthPeriod_EdgesPerRot, int timeoutMs=0)=0
Sets the edges per rotation of a pulse width sensor.
virtual double ConfigGetParameter(ParamEnum paramEnum, int ordinal, int timeoutMs=0)=0
Gets a parameter.
virtual ErrorCode ConfigVoltageMeasurementFilter(int filterWindowSamples, int timeoutMs=0)=0
Configures the voltage measurement filter.
virtual ErrorCode ConfigSoftLimitDisableNeutralOnLOS(bool softLimitDisableNeutralOnLOS, int timeoutMs=0)=0
Disables soft limits triggering (if enabled) when the sensor is no longer detected.
virtual double GetErrorDerivative(int pidIdx=0)=0
Gets the derivative of the closed-loop error.
virtual ErrorCode ConfigForwardLimitSwitchSource(RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose, int deviceID, int timeoutMs=0)=0
Configures the forward limit switch for a remote source.
virtual int GetDeviceID()=0
Returns the Device ID.
virtual double GetClosedLoopTarget(int pidIdx=0)=0
Gets the current target of a given closed loop.
virtual ErrorCode ConfigReverseLimitSwitchSource(RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose, int deviceID, int timeoutMs=0)=0
Configures the reverse limit switch for a remote source.
virtual ErrorCode ConfigNominalOutputForward(double percentOut, int timeoutMs=0)=0
Configures the forward nominal output percentage.
virtual double GetClosedLoopError(int pidIdx=0)=0
Gets the closed-loop error.
virtual ErrorCode ConfigFactoryDefault(int timeout)=0
Revert all configurations to factory default values.
virtual double GetMotorOutputPercent()=0
Gets the output percentage of the motor controller.
virtual ErrorCode ConfigNeutralDeadband(double percentDeadband, int timeoutMs=0)=0
Configures the output deadband percentage.
virtual double GetBusVoltage()=0
Gets the bus voltage seen by the device.
virtual ErrorCode Config_IntegralZone(int slotIdx, double izone, int timeoutMs=0)=0
Sets the Integral Zone constant in the given parameter slot.
virtual ErrorCode ConfigReverseSoftLimitEnable(bool enable, int timeoutMs=0)=0
Configures the reverse soft limit enable.
virtual ErrorCode Config_kF(int slotIdx, double value, int timeoutMs=0)=0
Sets the 'F' constant in the given parameter slot.
virtual bool GetInverted() const =0
virtual int ConfigGetCustomParam(int paramIndex, int timeoutMs=0)=0
Gets the value of a custom parameter.
virtual ErrorCode ClearStickyFaults(int timeoutMs=0)=0
Clears all sticky faults.
virtual ErrorCode ConfigNominalOutputReverse(double percentOut, int timeoutMs=0)=0
Configures the reverse nominal output percentage.
virtual ErrorCode GetFaults(Faults &toFill)=0
Polls the various fault flags.
virtual double GetIntegralAccumulator(int pidIdx=0)=0
Gets the iaccum value.
virtual ErrorCode ConfigAllowableClosedloopError(int slotIdx, double allowableCloseLoopError, int timeoutMs=0)=0
Sets the allowable closed-loop error in the given parameter slot.
virtual ErrorCode SelectProfileSlot(int slotIdx, int pidIdx)=0
Selects which profile slot to use for closed-loop control.
virtual double GetTemperature()=0
Gets the temperature of the motor controller.
virtual ErrorCode ConfigSetCustomParam(int newValue, int paramIndex, int timeoutMs=0)=0
Sets the value of a custom parameter.
virtual ErrorCode ConfigPeakOutputReverse(double percentOut, int timeoutMs=0)=0
Configures the reverse peak output percentage.
virtual ErrorCode SetSelectedSensorPosition(double sensorPos, int pidIdx=0, int timeoutMs=50)=0
Sets the sensor position to the given value.
virtual void Set(ControlMode Mode, double demand)=0
Sets the appropriate output on the talon, depending on the mode.
virtual ErrorCode ConfigSetParameter(ParamEnum param, double value, uint8_t subValue, int ordinal, int timeoutMs=0)=0
Sets a parameter.
virtual int GetMotionProfileTopLevelBufferCount()=0
Retrieve just the buffer count for the api-level (top) buffer.
virtual ErrorCode GetMotionProfileStatus(ctre::phoenix::motion::MotionProfileStatus &statusToFill)=0
Retrieve all status information.
virtual void SetInverted(bool invert)=0
Inverts the hbridge output of the motor controller.
virtual ErrorCode ConfigSensorTerm(SensorTerm sensorTerm, FeedbackDevice feedbackDevice, int timeoutMs=0)=0
Select what sensor term should be bound to switch feedback device.
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.
virtual double GetMotorOutputVoltage()=0
virtual ErrorCode ConfigClosedLoopPeakOutput(int slotIdx, double percentOut, int timeoutMs=0)=0
Sets the peak closed-loop output.
virtual ErrorCode ConfigForwardSoftLimitThreshold(double forwardSensorLimit, int timeoutMs=0)=0
Configures the forward soft limit threhold.
virtual ErrorCode ConfigReverseSoftLimitThreshold(double reverseSensorLimit, int timeoutMs=0)=0
Configures the reverse soft limit threshold.
virtual ErrorCode ClearMotionProfileHasUnderrun(int timeoutMs=0)=0
Clear the "Has Underrun" flag.
virtual ErrorCode ConfigClosedLoopPeriod(int slotIdx, int loopTimeMs, int timeoutMs=0)=0
Sets the loop time (in milliseconds) of the PID closed-loop calculations.
virtual ErrorCode ConfigMotionSCurveStrength(int curveStrength, int timeoutMs)=0
Sets the Motion Magic S Curve Strength.
virtual ErrorCode Config_kP(int slotIdx, double value, int timeoutMs=0)=0
Sets the 'P' constant in the given parameter slot.
virtual void OverrideSoftLimitsEnable(bool enable)=0
Can be used to override-disable the soft limits.
virtual ErrorCode Config_kI(int slotIdx, double value, int timeoutMs=0)=0
Sets the 'I' constant in the given parameter slot.
virtual bool HasResetOccurred()=0
Returns true if the device has reset since last call.
virtual ErrorCode ConfigClearPositionOnQuadIdx(bool clearPositionOnQuadIdx, int timeoutMs=0)=0
Enables clearing the position of the feedback sensor when the quadrature index signal is detected.
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.
virtual ErrorCode ConfigVoltageCompSaturation(double voltage, int timeoutMs=0)=0
Configures the Voltage Compensation saturation voltage.
virtual void EnableVoltageCompensation(bool enable)=0
Enables voltage compensation.
virtual ErrorCode ConfigForwardSoftLimitEnable(bool enable, int timeoutMs=0)=0
Configures the forward soft limit enable.
virtual ErrorCode ConfigOpenloopRamp(double secondsFromNeutralToFull, int timeoutMs=0)=0
Configures the open-loop ramp rate of throttle output.
virtual double GetActiveTrajectoryPosition(int pidIdx=0)=0
Gets the active trajectory target position for using MotionMagic/MotionProfile control modes.
virtual ErrorCode ConfigClearPositionOnLimitR(bool clearPositionOnLimitR, int timeoutMs=0)=0
Enables clearing the position of the feedback sensor when the reverse limit switch is triggered.
virtual int GetBaseID()=0
virtual void ProcessMotionProfileBuffer()=0
This must be called periodically to funnel the trajectory points from the API's top level buffer to t...
virtual ErrorCode ConfigMotionCruiseVelocity(double sensorUnitsPer100ms, int timeoutMs=0)=0
Sets the Motion Magic Cruise Velocity.
virtual void SetInverted(InvertType invertType)=0
Inverts the hbridge output of the motor controller in relation to the master if present.
virtual ~IMotorController()
Definition: IMotorController.h:37
virtual bool IsMotionProfileTopLevelBufferFull()=0
Retrieve just the buffer full for the api-level (top) buffer.
virtual ErrorCode ConfigPeakOutputForward(double percentOut, int timeoutMs=0)=0
Configures the forward peak output percentage.
virtual ErrorCode ConfigClearPositionOnLimitF(bool clearPositionOnLimitF, int timeoutMs=0)=0
Enables clearing the position of the feedback sensor when the forward limit switch is triggered.
virtual ErrorCode ConfigMotionAcceleration(double sensorUnitsPer100msPerSec, int timeoutMs=0)=0
Sets the Motion Magic Acceleration.
virtual ErrorCode ConfigRemoteSensorClosedLoopDisableNeutralOnLOS(bool remoteSensorClosedLoopDisableNeutralOnLOS, int timeoutMs=0)=0
Disables going to neutral (brake/coast) when a remote sensor is no longer detected.
virtual double GetActiveTrajectoryArbFeedFwd(int pidIdx=0)=0
Gets the active trajectory arbitrary feedforward using MotionMagic/MotionProfile control modes.
virtual int GetStatusFramePeriod(StatusFrame frame, int timeoutMs=0)=0
Gets the period of the given status frame.
virtual void SetSensorPhase(bool PhaseSensor)=0
Sets the phase of the sensor.
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...
virtual int GetFirmwareVersion()=0
Gets the firmware version of the device.
virtual ErrorCode ClearMotionProfileTrajectories()=0
Clear the buffered motion profile in both controller's RAM (bottom), and in the API (top).
CTRE Talon SRX Motor Controller when used on CAN Bus.
Definition: BaseTalon.h:267
CTRE CANCoder.
Definition: CANCoder.h:233
ControlMode
Choose the control mode for a motor controller.
Definition: ControlMode.h:11
DemandType
How to interpret a demand value.
Definition: DemandType.h:10
InvertType
Choose the invert type of the motor controller.
Definition: InvertType.h:14
SensorTerm
Choose the sensor term for a motor controller.
Definition: SensorTerm.h:11
LimitSwitchNormal
Choose whether the limit switch is normally open or normally closed.
Definition: LimitSwitchType.h:62
RemoteSensorSource
Choose the remote sensor source for a motor controller.
Definition: RemoteSensorSource.h:13
RemoteFeedbackDevice
Choose the remote feedback device for a motor controller.
Definition: FeedbackDevice.h:179
RemoteLimitSwitchSource
Remote Limit switch source enum.
Definition: LimitSwitchType.h:35
FeedbackDevice
Choose the feedback device for a motor controller.
Definition: FeedbackDevice.h:14
NeutralMode
Choose the neutral mode for a motor controller.
Definition: NeutralMode.h:11
ControlFrame
Control Frames for motor controllers.
Definition: ControlFrame.h:11
StatusFrame
The different status frames available to motor controllers.
Definition: StatusFrame.h:99
ParamEnum
Signal enumeration for generic signal access.
Definition: paramEnum.h:13
ErrorCode
Definition: ErrorCode.h:13
namespace ctre
Definition: paramEnum.h:5
Motion Profile Status This is simply a data transer object.
Definition: MotionProfileStatus.h:15
Motion Profile Trajectory Point This is simply a data transfer object.
Definition: TrajectoryPoint.h:11
All the faults available to motor controllers.
Definition: Faults.h:11
All the sticky faults available to motor controllers.
Definition: StickyFaults.h:11