CTRE_Phoenix 5.20.2
com.ctre.phoenix.motorcontrol.IMotorController Interface Reference

Inherits com.ctre.phoenix.signals.IOutputSignal, com.ctre.phoenix.signals.IInvertable, and com.ctre.phoenix.motorcontrol.IFollower.

Inherited by com.ctre.phoenix.motorcontrol.IMotorControllerEnhanced, com.ctre.phoenix.motorcontrol.can.BaseMotorController, and com.ctre.phoenix.motorcontrol.can.VictorSPX.

Public Member Functions

void set (ControlMode Mode, double demand)
 
void set (ControlMode Mode, double demand0, DemandType demand1Type, double demand1)
 
void neutralOutput ()
 
void setNeutralMode (NeutralMode neutralMode)
 
void setSensorPhase (boolean PhaseSensor)
 
void setInverted (boolean invert)
 
void setInverted (InvertType invertType)
 
boolean getInverted ()
 
ErrorCode configOpenloopRamp (double secondsFromNeutralToFull, int timeoutMs)
 
ErrorCode configClosedloopRamp (double secondsFromNeutralToFull, int timeoutMs)
 
ErrorCode configPeakOutputForward (double percentOut, int timeoutMs)
 
ErrorCode configPeakOutputReverse (double percentOut, int timeoutMs)
 
ErrorCode configNominalOutputForward (double percentOut, int timeoutMs)
 
ErrorCode configNominalOutputReverse (double percentOut, int timeoutMs)
 
ErrorCode configNeutralDeadband (double percentDeadband, int timeoutMs)
 
ErrorCode configVoltageCompSaturation (double voltage, int timeoutMs)
 
ErrorCode configVoltageMeasurementFilter (int filterWindowSamples, int timeoutMs)
 
void enableVoltageCompensation (boolean enable)
 
double getBusVoltage ()
 
double getMotorOutputPercent ()
 
double getMotorOutputVoltage ()
 
double getTemperature ()
 
ErrorCode configSelectedFeedbackSensor (RemoteFeedbackDevice feedbackDevice, int pidIdx, int timeoutMs)
 
ErrorCode configSelectedFeedbackCoefficient (double coefficient, int pidIdx, int timeoutMs)
 
ErrorCode configRemoteFeedbackFilter (int deviceID, RemoteSensorSource remoteSensorSource, int remoteOrdinal, int timeoutMs)
 
ErrorCode configRemoteFeedbackFilter (CANCoder canCoderRef, int remoteOrdinal, int timeoutMs)
 
ErrorCode configRemoteFeedbackFilter (BaseTalon talonRef, int remoteOrdinal, int timeoutMs)
 
ErrorCode configSensorTerm (SensorTerm sensorTerm, FeedbackDevice feedbackDevice, int timeoutMs)
 
double getSelectedSensorPosition (int pidIdx)
 
double getSelectedSensorVelocity (int pidIdx)
 
ErrorCode setSelectedSensorPosition (double sensorPos, int pidIdx, int timeoutMs)
 
ErrorCode setControlFramePeriod (ControlFrame frame, int periodMs)
 
ErrorCode setStatusFramePeriod (StatusFrame frame, int periodMs, int timeoutMs)
 
int getStatusFramePeriod (StatusFrame frame, int timeoutMs)
 
ErrorCode configForwardLimitSwitchSource (RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose, int deviceID, int timeoutMs)
 
ErrorCode configReverseLimitSwitchSource (RemoteLimitSwitchSource type, LimitSwitchNormal normalOpenOrClose, int deviceID, int timeoutMs)
 
void overrideLimitSwitchesEnable (boolean enable)
 
ErrorCode configForwardSoftLimitThreshold (double forwardSensorLimit, int timeoutMs)
 
ErrorCode configReverseSoftLimitThreshold (double reverseSensorLimit, int timeoutMs)
 
ErrorCode configForwardSoftLimitEnable (boolean enable, int timeoutMs)
 
ErrorCode configReverseSoftLimitEnable (boolean enable, int timeoutMs)
 
void overrideSoftLimitsEnable (boolean enable)
 
ErrorCode config_kP (int slotIdx, double value, int timeoutMs)
 
ErrorCode config_kI (int slotIdx, double value, int timeoutMs)
 
ErrorCode config_kD (int slotIdx, double value, int timeoutMs)
 
ErrorCode config_kF (int slotIdx, double value, int timeoutMs)
 
ErrorCode config_IntegralZone (int slotIdx, double izone, int timeoutMs)
 
ErrorCode configAllowableClosedloopError (int slotIdx, double allowableCloseLoopError, int timeoutMs)
 
ErrorCode configMaxIntegralAccumulator (int slotIdx, double iaccum, int timeoutMs)
 
ErrorCode configClosedLoopPeakOutput (int slotIdx, double percentOut, int timeoutMs)
 
ErrorCode configClosedLoopPeriod (int slotIdx, int loopTimeMs, int timeoutMs)
 
ErrorCode configAuxPIDPolarity (boolean invert, int timeoutMs)
 
ErrorCode setIntegralAccumulator (double iaccum, int pidIdx, int timeoutMs)
 
double getClosedLoopError (int pidIdx)
 
double getIntegralAccumulator (int pidIdx)
 
double getErrorDerivative (int pidIdx)
 
void selectProfileSlot (int slotIdx, int pidIdx)
 
double getClosedLoopTarget (int pidIdx)
 
double getActiveTrajectoryPosition ()
 
double getActiveTrajectoryVelocity ()
 
ErrorCode configMotionCruiseVelocity (double sensorUnitsPer100ms, int timeoutMs)
 
ErrorCode configMotionAcceleration (double sensorUnitsPer100msPerSec, int timeoutMs)
 
ErrorCode configMotionSCurveStrength (int curveStrength, int timeoutMs)
 
ErrorCode configMotionProfileTrajectoryPeriod (int baseTrajDurationMs, int timeoutMs)
 
ErrorCode clearMotionProfileTrajectories ()
 
int getMotionProfileTopLevelBufferCount ()
 
ErrorCode pushMotionProfileTrajectory (TrajectoryPoint trajPt)
 
boolean isMotionProfileTopLevelBufferFull ()
 
void processMotionProfileBuffer ()
 
ErrorCode getMotionProfileStatus (MotionProfileStatus statusToFill)
 
ErrorCode clearMotionProfileHasUnderrun (int timeoutMs)
 
ErrorCode changeMotionControlFramePeriod (int periodMs)
 
ErrorCode getLastError ()
 
ErrorCode getFaults (Faults toFill)
 
ErrorCode getStickyFaults (StickyFaults toFill)
 
ErrorCode clearStickyFaults (int timeoutMs)
 
int getFirmwareVersion ()
 
boolean hasResetOccurred ()
 
ErrorCode configSetCustomParam (int newValue, int paramIndex, int timeoutMs)
 
int configGetCustomParam (int paramIndex, int timeoutMs)
 
ErrorCode configSetParameter (ParamEnum param, double value, int subValue, int ordinal, int timeoutMs)
 
ErrorCode configSetParameter (int param, double value, int subValue, int ordinal, int timeoutMs)
 
double configGetParameter (ParamEnum paramEnum, int ordinal, int timeoutMs)
 
double configGetParameter (int paramEnum, int ordinal, int timeoutMs)
 
int getBaseID ()
 
int getDeviceID ()
 
ControlMode getControlMode ()
 
void setInverted (boolean invert)
 
boolean getInverted ()
 
- Public Member Functions inherited from com.ctre.phoenix.motorcontrol.IFollower
void follow (IMotorController masterToFollow)
 
void valueUpdated ()
 

Detailed Description

Interface for motor controllers

Member Function Documentation

◆ changeMotionControlFramePeriod()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.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. 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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ clearMotionProfileHasUnderrun()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.clearMotionProfileHasUnderrun ( int  timeoutMs)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ clearMotionProfileTrajectories()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.clearMotionProfileTrajectories ( )

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

Returns
Error Code generated by function. 0 indicates no error

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ clearStickyFaults()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.clearStickyFaults ( int  timeoutMs)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ config_IntegralZone()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.config_IntegralZone ( int  slotIdx,
double  izone,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ config_kD()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.config_kD ( int  slotIdx,
double  value,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ config_kF()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.config_kF ( int  slotIdx,
double  value,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ config_kI()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.config_kI ( int  slotIdx,
double  value,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ config_kP()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.config_kP ( int  slotIdx,
double  value,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configAllowableClosedloopError()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configAllowableClosedloopError ( int  slotIdx,
double  allowableCloseLoopError,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configAuxPIDPolarity()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configAuxPIDPolarity ( boolean  invert,
int  timeoutMs 
)

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

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configClosedLoopPeakOutput()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configClosedLoopPeakOutput ( int  slotIdx,
double  percentOut,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configClosedLoopPeriod()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configClosedLoopPeriod ( int  slotIdx,
int  loopTimeMs,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configClosedloopRamp()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configClosedloopRamp ( double  secondsFromNeutralToFull,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configForwardLimitSwitchSource()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configForwardLimitSwitchSource ( RemoteLimitSwitchSource  type,
LimitSwitchNormal  normalOpenOrClose,
int  deviceID,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configForwardSoftLimitEnable()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configForwardSoftLimitEnable ( boolean  enable,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configForwardSoftLimitThreshold()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configForwardSoftLimitThreshold ( double  forwardSensorLimit,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configGetCustomParam()

int com.ctre.phoenix.motorcontrol.IMotorController.configGetCustomParam ( int  paramIndex,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configGetParameter() [1/2]

double com.ctre.phoenix.motorcontrol.IMotorController.configGetParameter ( int  paramEnum,
int  ordinal,
int  timeoutMs 
)

Gets a parameter.

Parameters
paramEnumParameter 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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configGetParameter() [2/2]

double com.ctre.phoenix.motorcontrol.IMotorController.configGetParameter ( ParamEnum  paramEnum,
int  ordinal,
int  timeoutMs 
)

Gets a parameter.

Parameters
paramEnumParameter 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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configMaxIntegralAccumulator()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configMaxIntegralAccumulator ( int  slotIdx,
double  iaccum,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configMotionAcceleration()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configMotionAcceleration ( double  sensorUnitsPer100msPerSec,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configMotionCruiseVelocity()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configMotionCruiseVelocity ( double  sensorUnitsPer100ms,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configMotionProfileTrajectoryPeriod()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configMotionProfileTrajectoryPeriod ( int  baseTrajDurationMs,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configMotionSCurveStrength()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configMotionSCurveStrength ( int  curveStrength,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configNeutralDeadband()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configNeutralDeadband ( double  percentDeadband,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configNominalOutputForward()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configNominalOutputForward ( double  percentOut,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configNominalOutputReverse()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configNominalOutputReverse ( double  percentOut,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configOpenloopRamp()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configOpenloopRamp ( double  secondsFromNeutralToFull,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configPeakOutputForward()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configPeakOutputForward ( double  percentOut,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configPeakOutputReverse()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configPeakOutputReverse ( double  percentOut,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configRemoteFeedbackFilter() [1/3]

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configRemoteFeedbackFilter ( BaseTalon  talonRef,
int  remoteOrdinal,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configRemoteFeedbackFilter() [2/3]

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configRemoteFeedbackFilter ( CANCoder  canCoderRef,
int  remoteOrdinal,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configRemoteFeedbackFilter() [3/3]

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configRemoteFeedbackFilter ( int  deviceID,
RemoteSensorSource  remoteSensorSource,
int  remoteOrdinal,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configReverseLimitSwitchSource()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configReverseLimitSwitchSource ( RemoteLimitSwitchSource  type,
LimitSwitchNormal  normalOpenOrClose,
int  deviceID,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configReverseSoftLimitEnable()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configReverseSoftLimitEnable ( boolean  enable,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configReverseSoftLimitThreshold()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configReverseSoftLimitThreshold ( double  reverseSensorLimit,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configSelectedFeedbackCoefficient()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configSelectedFeedbackCoefficient ( double  coefficient,
int  pidIdx,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configSelectedFeedbackSensor()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configSelectedFeedbackSensor ( RemoteFeedbackDevice  feedbackDevice,
int  pidIdx,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configSensorTerm()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configSensorTerm ( SensorTerm  sensorTerm,
FeedbackDevice  feedbackDevice,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configSetCustomParam()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configSetCustomParam ( int  newValue,
int  paramIndex,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configSetParameter() [1/2]

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configSetParameter ( int  param,
double  value,
int  subValue,
int  ordinal,
int  timeoutMs 
)

Sets a parameter.

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configSetParameter() [2/2]

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configSetParameter ( ParamEnum  param,
double  value,
int  subValue,
int  ordinal,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configVoltageCompSaturation()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configVoltageCompSaturation ( double  voltage,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ configVoltageMeasurementFilter()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.configVoltageMeasurementFilter ( int  filterWindowSamples,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ enableVoltageCompensation()

void com.ctre.phoenix.motorcontrol.IMotorController.enableVoltageCompensation ( boolean  enable)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ getActiveTrajectoryPosition()

double com.ctre.phoenix.motorcontrol.IMotorController.getActiveTrajectoryPosition ( )

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

Returns
The Active Trajectory Position in sensor units.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ getActiveTrajectoryVelocity()

double com.ctre.phoenix.motorcontrol.IMotorController.getActiveTrajectoryVelocity ( )

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

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

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ getBaseID()

int com.ctre.phoenix.motorcontrol.IMotorController.getBaseID ( )
Returns
BaseID of device

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ getBusVoltage()

double com.ctre.phoenix.motorcontrol.IMotorController.getBusVoltage ( )

Gets the bus voltage seen by the device.

Returns
The bus voltage value (in volts).

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ getClosedLoopError()

double com.ctre.phoenix.motorcontrol.IMotorController.getClosedLoopError ( int  pidIdx)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ getClosedLoopTarget()

double com.ctre.phoenix.motorcontrol.IMotorController.getClosedLoopTarget ( int  pidIdx)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ getControlMode()

ControlMode com.ctre.phoenix.motorcontrol.IMotorController.getControlMode ( )
Returns
control mode motor controller is in

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ getDeviceID()

int com.ctre.phoenix.motorcontrol.IMotorController.getDeviceID ( )

Returns the Device ID

Returns
Device number.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ getErrorDerivative()

double com.ctre.phoenix.motorcontrol.IMotorController.getErrorDerivative ( int  pidIdx)

Gets the derivative of the closed-loop error.

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

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ getFaults()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.getFaults ( Faults  toFill)

Polls the various fault flags.

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

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ getFirmwareVersion()

int com.ctre.phoenix.motorcontrol.IMotorController.getFirmwareVersion ( )

Gets the firmware version of the device.

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

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ getIntegralAccumulator()

double com.ctre.phoenix.motorcontrol.IMotorController.getIntegralAccumulator ( int  pidIdx)

Gets the iaccum value.

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

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ getInverted()

◆ getLastError()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.getLastError ( )

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ getMotionProfileStatus()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.getMotionProfileStatus ( MotionProfileStatus  statusToFill)

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.

Returns
Error Code generated by function. 0 indicates no error.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ getMotionProfileTopLevelBufferCount()

int com.ctre.phoenix.motorcontrol.IMotorController.getMotionProfileTopLevelBufferCount ( )

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ getMotorOutputPercent()

double com.ctre.phoenix.motorcontrol.IMotorController.getMotorOutputPercent ( )

Gets the output percentage of the motor controller.

Returns
Output of the motor controller (in percent).

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ getMotorOutputVoltage()

double com.ctre.phoenix.motorcontrol.IMotorController.getMotorOutputVoltage ( )
Returns
applied voltage to motor in volts.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ getSelectedSensorPosition()

double com.ctre.phoenix.motorcontrol.IMotorController.getSelectedSensorPosition ( int  pidIdx)

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

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ getSelectedSensorVelocity()

double com.ctre.phoenix.motorcontrol.IMotorController.getSelectedSensorVelocity ( int  pidIdx)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ getStatusFramePeriod()

int com.ctre.phoenix.motorcontrol.IMotorController.getStatusFramePeriod ( StatusFrame  frame,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ getStickyFaults()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.getStickyFaults ( StickyFaults  toFill)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ getTemperature()

double com.ctre.phoenix.motorcontrol.IMotorController.getTemperature ( )

Gets the temperature of the motor controller.

Returns
Temperature of the motor controller (in 'C)

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ hasResetOccurred()

boolean com.ctre.phoenix.motorcontrol.IMotorController.hasResetOccurred ( )

Returns true if the device has reset since last call.

Returns
Has a Device Reset Occurred?

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ isMotionProfileTopLevelBufferFull()

boolean com.ctre.phoenix.motorcontrol.IMotorController.isMotionProfileTopLevelBufferFull ( )

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ neutralOutput()

void com.ctre.phoenix.motorcontrol.IMotorController.neutralOutput ( )

Neutral the motor output by setting control mode to disabled.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ overrideLimitSwitchesEnable()

void com.ctre.phoenix.motorcontrol.IMotorController.overrideLimitSwitchesEnable ( boolean  enable)

Sets the enable state for limit switches.

Parameters
enableEnable state for limit switches.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ overrideSoftLimitsEnable()

void com.ctre.phoenix.motorcontrol.IMotorController.overrideSoftLimitsEnable ( boolean  enable)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ processMotionProfileBuffer()

void com.ctre.phoenix.motorcontrol.IMotorController.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. 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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ pushMotionProfileTrajectory()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.pushMotionProfileTrajectory ( TrajectoryPoint  trajPt)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ selectProfileSlot()

void com.ctre.phoenix.motorcontrol.IMotorController.selectProfileSlot ( int  slotIdx,
int  pidIdx 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ set() [1/2]

void com.ctre.phoenix.motorcontrol.IMotorController.set ( ControlMode  Mode,
double  demand 
)

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.
demandThe setpoint value, as described above.

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

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController, com.ctre.phoenix.motorcontrol.can.WPI_TalonFX, com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX, and com.ctre.phoenix.motorcontrol.can.WPI_VictorSPX.

◆ set() [2/2]

void com.ctre.phoenix.motorcontrol.IMotorController.set ( ControlMode  Mode,
double  demand0,
DemandType  demand1Type,
double  demand1 
)
Parameters
ModeSets the appropriate output on the talon, depending on the mode.
demand0The output value to apply. such as advanced feed forward and/or auxiliary close-looping in firmware. In PercentOutput, the output is between -1.0 and 1.0, with 0.0 as stopped. In Current mode, output value is in amperes. In Velocity mode, output value is in position change / 100ms. In Position mode, output value is in encoder ticks or an analog value, depending on the sensor. See In Follower mode, the output value is the integer device ID of the talon to duplicate.
demand1TypeThe demand type for demand1. Neutral: Ignore demand1 and apply no change to the demand0 output. AuxPID: Use demand1 to set the target for the auxiliary PID 1. 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. Units match the set mode.

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

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController, com.ctre.phoenix.motorcontrol.can.WPI_TalonFX, com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX, and com.ctre.phoenix.motorcontrol.can.WPI_VictorSPX.

◆ setControlFramePeriod()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.setControlFramePeriod ( ControlFrame  frame,
int  periodMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ setIntegralAccumulator()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.setIntegralAccumulator ( double  iaccum,
int  pidIdx,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ setInverted() [1/2]

void com.ctre.phoenix.motorcontrol.IMotorController.setInverted ( boolean  invert)

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 com.ctre.phoenix.signals.IInvertable.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController, com.ctre.phoenix.motorcontrol.can.WPI_TalonFX, com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX, and com.ctre.phoenix.motorcontrol.can.WPI_VictorSPX.

◆ setInverted() [2/2]

void com.ctre.phoenix.motorcontrol.IMotorController.setInverted ( InvertType  invertType)

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

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

This will allow you to either:

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

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ setNeutralMode()

void com.ctre.phoenix.motorcontrol.IMotorController.setNeutralMode ( NeutralMode  neutralMode)

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)

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ setSelectedSensorPosition()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.setSelectedSensorPosition ( double  sensorPos,
int  pidIdx,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ setSensorPhase()

void com.ctre.phoenix.motorcontrol.IMotorController.setSensorPhase ( boolean  PhaseSensor)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.

◆ setStatusFramePeriod()

ErrorCode com.ctre.phoenix.motorcontrol.IMotorController.setStatusFramePeriod ( StatusFrame  frame,
int  periodMs,
int  timeoutMs 
)

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.

Implemented in com.ctre.phoenix.motorcontrol.can.BaseMotorController.


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