Class MotControllerJNI
java.lang.Object
com.ctre.phoenix.CTREJNIWrapper
com.ctre.phoenix.motorcontrol.can.MotControllerJNI
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intChangeMotionControlFramePeriod(long handle, int periodMs) static intClearMotionProfileHasUnderrun(long handle, int timeoutMs) static intClearMotionProfileTrajectories(long handle) static intClearStickyFaults(long handle, int timeoutMs) static intConfig_IntegralZone(long handle, int slotIdx, double izone, int timeoutMs) Sets the Integral Zone constant in the given parameter slot.static intConfig_kD(long handle, int slotIdx, double value, int timeoutMs) Sets the 'D' constant in the given parameter slot.static intConfig_kF(long handle, int slotIdx, double value, int timeoutMs) Sets the 'F' constant in the given parameter slot.static intConfig_kI(long handle, int slotIdx, double value, int timeoutMs) Sets the 'I' constant in the given parameter slot.static intConfig_kP(long handle, int slotIdx, double value, int timeoutMs) Sets the 'P' constant in the given parameter slot.static intConfigAllowableClosedloopError(long handle, int slotIdx, int allowableClosedLoopError, int timeoutMs) Sets the allowable closed-loop error in the given parameter slot.static intConfigBrakeCurrentLimitEnable(long handle, boolean enable, int timeoutMs) static intConfigClearPositionOnLimitF(long handle, boolean clearPositionOnLimitF, int timeoutMs) static intConfigClearPositionOnLimitR(long handle, boolean clearPositionOnLimitR, int timeoutMs) static intConfigClearPositionOnQuadIdx(long handle, boolean clearPositionOnQuadIdx, int timeoutMs) static intConfigClosedLoopPeakOutput(long handle, int slotIdx, double percentOut, int timeoutMs) static intConfigClosedLoopPeriod(long handle, int slotIdx, int loopTimeMs, int timeoutMs) static intConfigClosedLoopRamp(long handle, double secondsFromNeutralToFull, int timeoutMs) Configures the closed-loop ramp rate of throttle output.static intConfigContinuousCurrentLimit(long handle, int amps, int timeoutMs) Configures the continuous current limit.static intConfigFactoryDefault(long handle, int timeoutMs) Revert all configurations to factory default values.static intConfigFeedbackNotContinuous(long handle, boolean feedbackNotContinuous, int timeoutMs) static intConfigForwardLimitSwitchSource(long handle, int type, int normalOpenOrClose, int deviceID, int timeoutMs) Configures the forward limit switch for a remote source.static intConfigForwardSoftLimitEnable(long handle, boolean enable, int timeoutMs) static intConfigForwardSoftLimitThreshold(long handle, int forwardSensorLimit, int timeoutMs) Configures the forward soft limit.static intConfigGetCustomParam(long handle, int paramIndex, int timoutMs) Gets the value of a custom parameter.static intConfigGetMotorCommutation(long handle, int timeoutMs) static doubleConfigGetParameter(long handle, int param, int ordinal, int timeoutMs) Gets a parameter.static intConfigGetStatorCurrentLimit(long handle, double[] toFill, int timeoutMs) static intConfigGetSupplyCurrentLimit(long handle, double[] toFill, int timeoutMs) static intConfigIntegratedSensorAbsoluteRange(long handle, int absoluteSensorRange, int timeoutMs) static intConfigIntegratedSensorInitializationStrategy(long handle, int initStrategy, int timeoutMs) static intConfigIntegratedSensorOffset(long handle, double offsetDegrees, int timeoutMs) static intConfigLimitSwitchDisableNeutralOnLOS(long handle, boolean limitSwitchDisableNeutralOnLOS, int timeoutMs) static intConfigMaxIntegralAccumulator(long handle, int slotIdx, double iaccum, int timeoutMs) Sets the maximum integral accumulator in the given parameter slot.static intConfigMotionAcceleration(long handle, int sensorUnitsPer100msPerSec, int timeoutMs) Sets the Motion Magic Acceleration.static intConfigMotionCruiseVelocity(long handle, int sensorUnitsPer100ms, int timeoutMs) Sets the Motion Magic Cruise Velocity.static intConfigMotionProfileTrajectoryInterpolationEnable(long handle, boolean enable, int timeoutMs) static intConfigMotionProfileTrajectoryPeriod(long handle, int periodMs, int timeoutMs) static intConfigMotionSCurveStrength(long m_handle, int curveStrength, int timeoutMs) static intConfigMotorCommutation(long handle, int motorCommutation, int timeoutMs) static intConfigNeutralDeadband(long handle, double percentDeadband, int timeoutMs) Configures the output deadband percentage.static intConfigNominalOutputForward(long handle, double percentOut, int timeoutMs) Configures the forward nominal output percentage.static intConfigNominalOutputReverse(long handle, double percentOut, int timeoutMs) Configures the reverse nominal output percentage.static intConfigOpenLoopRamp(long handle, double secondsFromNeutralToFull, int timeoutMs) Configures the open-loop ramp rate of throttle output.static intConfigPeakCurrentDuration(long handle, int milliseconds, int timeoutMs) Configures the maximum time allowed at peak current limit of the motor controller.static intConfigPeakCurrentLimit(long handle, int amps, int timeoutMs) Configures the peak current limit of the motor controller.static intConfigPeakOutputForward(long handle, double percentOut, int timeoutMs) Configures the forward peak output percentage.static intConfigPeakOutputReverse(long handle, double percentOut, int timeoutMs) Configures the reverse peak output percentage.static intConfigPulseWidthPeriod_EdgesPerRot(long handle, int pulseWidthPeriod_EdgesPerRot, int timeoutMs) static intConfigPulseWidthPeriod_FilterWindowSz(long handle, int pulseWidthPeriod_FilterWindowSz, int timeoutMs) static intConfigRemoteFeedbackFilter(long handle, int deviceID, int remoteSensorSource, int remoteOrdinal, int timeoutMs) Configures the remote feedback filter.static intConfigRemoteSensorClosedLoopDisableNeutralOnLOS(long handle, boolean remoteSensorClosedLoopDisableNeutralOnLOS, int timeoutMs) static intConfigReverseLimitSwitchSource(long handle, int type, int normalOpenOrClose, int deviceID, int timeoutMs) Configures the reverse limit switch for a remote source.static intConfigReverseSoftLimitEnable(long handle, boolean enable, int timeoutMs) static intConfigReverseSoftLimitThreshold(long handle, int reverseSensorLimit, int timeoutMs) Configures the reverse soft limit.static intConfigSelectedFeedbackCoefficient(long handle, double coefficient, int pidIdx, int timeoutMs) static intConfigSelectedFeedbackSensor(long handle, int feedbackDevice, int pidIdx, int timeoutMs) Select the feedback device for the motor controller.static intConfigSensorTerm(long handle, int sensorTerm, int feedbackDevice, int timeoutMs) static intConfigSetCustomParam(long handle, int newValue, int paramIndex, int timeoutMs) Sets the value of a custom parameter.static intConfigSetParameter(long handle, int param, double value, int subValue, int ordinal, int timeoutMs) Sets a parameter.static intConfigSoftLimitDisableNeutralOnLOS(long handle, boolean softLimitDisableNeutralOnLOS, int timeoutMs) static intConfigStatorCurrentLimit(long handle, double[] params, int timeoutMs) static intConfigStatorCurrentLimitEnable(long handle, boolean enable, int timeoutMs) static intConfigSupplyCurrentLimit(long handle, double[] params, int timeoutMs) static intConfigSupplyCurrentLimitEnable(long handle, boolean enable, int timeoutMs) static intConfigVelocityMeasurementPeriod(long handle, int period, int timeoutMs) Sets the period over which velocity measurements are taken.static intConfigVelocityMeasurementWindow(long handle, int windowSize, int timeoutMs) Sets the number of velocity samples used in the rolling average velocity measurement.static intConfigVoltageCompSaturation(long handle, double voltage, int timeoutMs) Configures the Voltage Compensation saturation voltage.static intConfigVoltageMeasurementFilter(long handle, int filterWindowSamples, int timeoutMs) Configures the voltage measurement filter.static longCreate(int baseArbId) static longstatic intEnableCurrentLimit(long handle, boolean enable) Enables the current limit feature.static intEnableHeadingHold(long handle, int enable) static voidEnableVoltageCompensation(long handle, boolean enable) Enables voltage compensation.static doubleGetActiveTrajectoryArbFeedFwd3(long handle, int pidIdx) static doubleGetActiveTrajectoryHeading(long handle) static intGetActiveTrajectoryPosition(long handle) static intGetActiveTrajectoryPosition3(long handle, int pidIdx) static intGetActiveTrajectoryVelocity(long handle) static intGetActiveTrajectoryVelocity3(long handle, int pidIdx) static intGetAnalogIn(long handle) static intGetAnalogInRaw(long handle) static intGetAnalogInVel(long handle) static intGetBaseID(long handle) static doubleGetBusVoltage(long handle) Gets the bus voltage seen by the motor controller.static intGetClosedLoopError(long handle, int pidIdx) Gets the closed-loop error.static intGetClosedLoopTarget(long handle, int pidIdx) static intGetDeviceNumber(long handle) Returns the Device IDstatic doubleGetErrorDerivative(long handle, int pidIdx) Gets the derivative of the closed-loop error.static intGetFaults(long handle) static intGetFirmwareVersion(long handle) Gets the firmware version of the device.static doubleGetIntegralAccumulator(long handle, int pidIdx) Gets the iaccum value.static doubleGetIntegratedSensorAbsolutePosition(long handle) static doubleGetIntegratedSensorPosition(long handle) static doubleGetIntegratedSensorVelocity(long handle) static booleanGetInverted(long handle) Gets the invert state of the motor controller.static intGetLastError(long handle) Gets the last error generated by this object.static intGetMotionProfileStatus(long handle, int[] toFill_9) static intGetMotionProfileStatus2(long handle, int[] toFill_11) static intGetMotionProfileTopLevelBufferCount(long handle) static doubleGetMotorOutputPercent(long handle) Gets the output percentage of the motor controller.static doubleGetOutputCurrent(long handle) Deprecated.Use getStatorCurrent/getSupplyCurrent instead.static intGetPinStateQuadA(long handle) static intGetPinStateQuadB(long handle) static intGetPinStateQuadIdx(long handle) static intGetPulseWidthPosition(long handle) static intGetPulseWidthRiseToFallUs(long handle) static intGetPulseWidthRiseToRiseUs(long handle) static intGetPulseWidthVelocity(long handle) static intGetQuadraturePosition(long handle) static intGetQuadratureVelocity(long handle) static intGetSelectedSensorPosition(long handle, int pidIdx) Get the selected sensor position.static intGetSelectedSensorVelocity(long handle, int pidIdx) Get the selected sensor velocity.static doubleGetStatorCurrent(long handle) Gets the stator/output current of the motor controller.static intGetStatusFramePeriod(long handle, int frame, int timeoutMs) Gets the period of the given status frame.static intGetStickyFaults(long handle) static doubleGetSupplyCurrent(long handle) Gets the stator/output current of the motor controller.static doubleGetTemperature(long handle) Gets the temperature of the motor controller.static booleanHasResetOccurred(long handle) Returns true if the device has reset.static intIsFwdLimitSwitchClosed(long handle) static booleanIsMotionProfileFinished(long handle) static booleanIsMotionProfileTopLevelBufferFull(long handle) static intIsRevLimitSwitchClosed(long handle) static intJNI_destroy_MotController(long handle) static voidOverrideLimitSwitchesEnable(long handle, boolean enable) Sets the enable state for limit switches.static voidOverrideSoftLimitsEnable(long handle, boolean enable) Sets the enable state for soft limit switches.static intProcessMotionProfileBuffer(long handle) static intPushMotionProfileTrajectory(long handle, double position, double velocity, double headingDeg, int profileSlotSelect, boolean isLastPoint, boolean zeroPos) static intPushMotionProfileTrajectory2(long handle, double position, double velocity, double headingDeg, int profileSlotSelect0, int profileSlotSelect1, boolean isLastPoint, boolean zeroPos, int durationMs) static intPushMotionProfileTrajectory3(long handle, double position, double velocity, double arbFeedFwd, double auxiliaryPos, double auxiliaryVel, double auxiliaryArbFeedFwd, int profileSlotSelect0, int profileSlotSelect1, boolean isLastPoint, boolean zeroPos0, int timeDur, boolean useAuxPID) static intSelectDemandType(long handle, int enable) static voidSelectProfileSlot(long handle, int slotIdx, int pidIdx) Selects which profile slot to use for closed-loop control.static voidSet_4(long handle, int mode, double demand0, double demand1, int demand1Type) Sets the demand (output) of the motor controller.static intSetAnalogPosition(long handle, int newPosition, int timeoutMs) static intSetControlFramePeriod(long handle, int frame, int periodMs) Sets the period of the given control frame.static voidSetDemand(long handle, int mode, int demand0, int demand1) Sets the demand (output) of the motor controller.static intSetIntegralAccumulator(long handle, double iaccum, int pidIdx, int timeoutMs) Sets the integral accumulator.static intSetIntegratedSensorPosition(long handle, double newPos, int timeoutMs) static intSetIntegratedSensorPositionToAbsolute(long handle, int timeoutMs) static voidSetInverted(long handle, boolean invert) Inverts the output of the motor controller.static voidSetInverted_2(long handle, int invert) Inverts the output of the motor controller.static intSetMPEOutput(long handle, int mpeOutput) static voidSetNeutralMode(long handle, int neutralMode) Sets the mode of operation during neutral throttle output.static intSetPulseWidthPosition(long handle, int newPosition, int timeoutMs) static intSetQuadraturePosition(long handle, int newPosition, int timeoutMs) static intSetSelectedSensorPosition(long handle, int sensorPos, int pidIdx, int timeoutMs) Sets the sensor position to the given value.static voidSetSensorPhase(long handle, boolean PhaseSensor) Sets the phase of the sensor.static intSetStatusFramePeriod(long handle, int frame, int periodMs, int timeoutMs) Sets the period of the given status frame.static intStartMotionProfile(long handle, long streamHandle, int minBufferedPts, int controlMode)
-
Constructor Details
-
MotControllerJNI
public MotControllerJNI()
-
-
Method Details
-
Create
-
Create2
-
JNI_destroy_MotController
-
GetDeviceNumber
Returns the Device ID- Parameters:
handle- handle of device.- Returns:
- Device number.
-
GetBaseID
-
SetDemand
Sets the demand (output) of the motor controller.- Parameters:
handle- handle of device.mode- Control Mode of the Motor Controllerdemand0- Primary Demand valuedemand1- Secondary Demand value
-
Set_4
Sets the demand (output) of the motor controller. -
SetNeutralMode
Sets the mode of operation during neutral throttle output.- Parameters:
handle- handle of device.neutralMode- The desired mode of operation when the Controller output throttle is neutral (ie brake/coast)
-
SetSensorPhase
Sets the phase of the sensor. Use when controller forward/reverse output doesn't correlate to appropriate forward/reverse reading of sensor.- Parameters:
handle- handle of device.PhaseSensor- Indicates whether to invert the phase of the sensor.
-
SetInverted
Inverts the output of the motor controller. LEDs, sensor phase, and limit switches will also be inverted to match the new forward/reverse directions.- Parameters:
handle- handle of device.invert- Invert state to set.
-
SetInverted_2
Inverts the output of the motor controller. LEDs, sensor phase, and limit switches will also be inverted to match the new forward/reverse directions.- Parameters:
handle- handle of device.invert- Invert state to set.
-
ConfigFactoryDefault
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:
handle- handle of device.timeoutMs- Timeout value in ms. Function will generate error if config is not successful within timeout.- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigOpenLoopRamp
Configures the open-loop ramp rate of throttle output.- Parameters:
handle- handle of device.secondsFromNeutralToFull- Minimum desired time to go from neutral to full throttle. A value of '0' will disable the ramp.timeoutMs- Timeout value in ms. Function will generate error if config is not successful within timeout.- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigClosedLoopRamp
Configures the closed-loop ramp rate of throttle output.- Parameters:
handle- handle of device.secondsFromNeutralToFull- Minimum desired time to go from neutral to full throttle. A value of '0' will disable the ramp.timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigPeakOutputForward
Configures the forward peak output percentage.- Parameters:
handle- handle of device.percentOut- Desired peak output percentage.timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigPeakOutputReverse
Configures the reverse peak output percentage.- Parameters:
handle- handle of device.percentOut- Desired peak output percentage.timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigNominalOutputForward
Configures the forward nominal output percentage.- Parameters:
handle- handle of device.percentOut- Nominal (minimum) percent output.timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigNominalOutputReverse
Configures the reverse nominal output percentage.- Parameters:
handle- handle of device.percentOut- Nominal (minimum) percent output.timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigNeutralDeadband
Configures the output deadband percentage.- Parameters:
handle- handle of device.percentDeadband- Desired deadband percentage. Minimum is 0.1%, Maximum is 25%.timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigVoltageCompSaturation
Configures the Voltage Compensation saturation voltage.- Parameters:
handle- handle of device.voltage- TO-DO: Comment me!timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigVoltageMeasurementFilter
public static int ConfigVoltageMeasurementFilter(long handle, int filterWindowSamples, int timeoutMs) Configures the voltage measurement filter.- Parameters:
handle- handle of device.filterWindowSamples- Number of samples in the rolling average of voltage measurement.timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
EnableVoltageCompensation
Enables voltage compensation. If enabled, voltage compensation works in all control modes. Be sure to configure the saturation voltage before enabling this.- Parameters:
handle- handle of device.enable- Enable state of voltage compensation.
-
GetInverted
Gets the invert state of the motor controller.- Parameters:
handle- handle of device.- Returns:
- The invert state.
-
GetBusVoltage
Gets the bus voltage seen by the motor controller.- Parameters:
handle- handle of device.- Returns:
- The bus voltage value (in volts).
-
GetMotorOutputPercent
Gets the output percentage of the motor controller.- Parameters:
handle- handle of device.- Returns:
- Output of the motor controller (in percent).
-
GetOutputCurrent
Deprecated.Use getStatorCurrent/getSupplyCurrent instead.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.- Parameters:
handle- handle of device- Returns:
- The output current (in amps).
-
GetSupplyCurrent
Gets the stator/output current of the motor controller.- Parameters:
handle- handle of device- Returns:
- The stator/output current (in amps).
-
GetStatorCurrent
Gets the stator/output current of the motor controller.- Parameters:
handle- handle of device- Returns:
- The stator/output current (in amps).
-
GetTemperature
Gets the temperature of the motor controller.- Parameters:
handle- handle of device.- Returns:
- The temperature of the motor controller (in 'C)
-
ConfigRemoteFeedbackFilter
public static int ConfigRemoteFeedbackFilter(long handle, int deviceID, int remoteSensorSource, int remoteOrdinal, int timeoutMs) Configures the remote feedback filter.- Parameters:
handle- handle of device.deviceID- ID of remote device.remoteSensorSource- Type of remote sensor.remoteOrdinal- Ordinal of remote source [0-1].timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigSelectedFeedbackSensor
public static int ConfigSelectedFeedbackSensor(long handle, int feedbackDevice, int pidIdx, int timeoutMs) Select the feedback device for the motor controller.- Parameters:
handle- handle of device.feedbackDevice- Feedback Device to select.pidIdx- Which closed loop to manipulate. 0 for primary, 1 for auxiliarytimeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigSensorTerm
-
GetSelectedSensorPosition
Get the selected sensor position.- Parameters:
handle- handle of device.pidIdx- Which closed loop to manipulate. 0 for primary, 1 for auxiliary- Returns:
- Position of selected sensor (in Raw Sensor Units).
-
GetSelectedSensorVelocity
Get the selected sensor velocity.- Parameters:
handle- handle of device.pidIdx- Which closed loop to manipulate. 0 for primary, 1 for auxiliary- Returns:
- Velocity of selected sensor (in Raw Sensor Units per 100 ms).
-
SetSelectedSensorPosition
Sets the sensor position to the given value.- Parameters:
handle- handle of device.sensorPos- Position to set for the selected sensor (in Raw Sensor Units).pidIdx- Which closed loop to manipulate. 0 for primary, 1 for auxiliarytimeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
SetControlFramePeriod
Sets the period of the given control frame.- Parameters:
handle- handle of device.frame- Frame whose period is to be changed.periodMs- Period in ms for the given frame.- Returns:
- Error Code generated by function. 0 indicates no error.
-
SetStatusFramePeriod
Sets the period of the given status frame.- Parameters:
handle- handle of device.frame- Frame whose period is to be changed.periodMs- Period in ms for the given frame.timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
GetStatusFramePeriod
Gets the period of the given status frame.- Parameters:
handle- handle of device.frame- Frame to get the period of.timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- The period of the given status frame.
-
ConfigVelocityMeasurementPeriod
Sets the period over which velocity measurements are taken.- Parameters:
handle- handle of device.period- Desired period for the velocity measurement. @see com.ctre.phoenix.sensors.SensorVelocityMeasPeriodtimeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigVelocityMeasurementWindow
Sets the number of velocity samples used in the rolling average velocity measurement.- Parameters:
handle- handle of device.windowSize- Number of samples in the rolling average of velocity measurement.timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigForwardLimitSwitchSource
public static int ConfigForwardLimitSwitchSource(long handle, int type, int normalOpenOrClose, int deviceID, int timeoutMs) Configures the forward limit switch for a remote source.- Parameters:
handle- handle of device.type- Remote limit switch source. @see com.ctre.phoenix.motorcontrol.LimitSwitchSourcenormalOpenOrClose- Setting for normally open or normally closed.deviceID- Device ID of remote source.timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigReverseLimitSwitchSource
public static int ConfigReverseLimitSwitchSource(long handle, int type, int normalOpenOrClose, int deviceID, int timeoutMs) Configures the reverse limit switch for a remote source.- Parameters:
handle- handle of device.type- Remote limit switch source. @see com.ctre.phoenix.motorcontrol.LimitSwitchSourcenormalOpenOrClose- Setting for normally open or normally closed.deviceID- Device ID of remote source.timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
OverrideLimitSwitchesEnable
Sets the enable state for limit switches.- Parameters:
handle- handle of device.enable- Enable state for limit switches.
-
ConfigForwardSoftLimitThreshold
public static int ConfigForwardSoftLimitThreshold(long handle, int forwardSensorLimit, int timeoutMs) Configures the forward soft limit.- Parameters:
handle- handle of device.forwardSensorLimit- Forward Sensor Position Limit (in Raw Sensor Units).timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigReverseSoftLimitThreshold
public static int ConfigReverseSoftLimitThreshold(long handle, int reverseSensorLimit, int timeoutMs) Configures the reverse soft limit.- Parameters:
handle- handle of device.reverseSensorLimit- Reverse Sensor Position Limit (in Raw Sensor Units).timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigForwardSoftLimitEnable
-
ConfigReverseSoftLimitEnable
-
OverrideSoftLimitsEnable
Sets the enable state for soft limit switches.- Parameters:
handle- handle of device.enable- Enable state for soft limit switches.
-
Config_kP
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:
handle- handle of device.slotIdx- Parameter slot for the constant.value- Value of the P constant.timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
Config_kI
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:
handle- handle of device.slotIdx- Parameter slot for the constant.value- Value of the I constant.timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
Config_kD
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:
handle- handle of device.slotIdx- Parameter slot for the constant.value- Value of the D constant.timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
Config_kF
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:
handle- handle of device.slotIdx- Parameter slot for the constant.value- Value of the F constant.timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
Config_IntegralZone
Sets the Integral Zone constant in the given parameter slot.- Parameters:
handle- handle of device.slotIdx- Parameter slot for the constant.izone- Value of the Integral Zone constant.timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigAllowableClosedloopError
public static int ConfigAllowableClosedloopError(long handle, int slotIdx, int allowableClosedLoopError, int timeoutMs) Sets the allowable closed-loop error in the given parameter slot.- Parameters:
handle- handle of device.slotIdx- Parameter slot for the constant.allowableClosedLoopError- Value of the allowable closed-loop error in sensor units (or sensor units per 100ms for velocity).timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigMaxIntegralAccumulator
public static int ConfigMaxIntegralAccumulator(long handle, int slotIdx, double iaccum, int timeoutMs) Sets the maximum integral accumulator in the given parameter slot.- Parameters:
handle- handle of device.slotIdx- Parameter slot for the constant.iaccum- Value of the maximum integral accumulator.timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
SetIntegralAccumulator
Sets the integral accumulator.- Parameters:
handle- handle of device.iaccum- Value to set for the integral accumulator.timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamppidIdx- Which closed loop to manipulate. 0 for primary, 1 for auxiliary secondary loop.- Returns:
- Error Code generated by function. 0 indicates no error.
-
GetClosedLoopError
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:
handle- handle of device.pidIdx- Which closed loop to manipulate. 0 for primary, 1 for auxiliary secondary loop.- Returns:
- Closed-loop error value.
-
GetIntegralAccumulator
Gets the iaccum value.- Parameters:
handle- handle of device.pidIdx- Which closed loop to manipulate. 0 for primary, 1 for auxiliary secondary loop.- Returns:
- Integral accumulator value.
-
GetErrorDerivative
Gets the derivative of the closed-loop error.- Parameters:
handle- handle of device.pidIdx- Which closed loop to manipulate. 0 for primary, 1 for auxiliary secondary loop.- Returns:
- Error derivative value.
-
SelectProfileSlot
Selects which profile slot to use for closed-loop control.- Parameters:
handle- handle of device.slotIdx- Profile slot to select.pidIdx- Which closed loop to manipulate. 0 for primary, 1 for auxiliary secondary loop.
-
GetActiveTrajectoryPosition
-
GetActiveTrajectoryVelocity
-
GetActiveTrajectoryHeading
-
GetActiveTrajectoryPosition3
-
GetActiveTrajectoryVelocity3
-
GetActiveTrajectoryArbFeedFwd3
-
ConfigMotionCruiseVelocity
Sets the Motion Magic Cruise Velocity.- Parameters:
handle- handle of device.sensorUnitsPer100ms- Motion Magic Cruise Velocity (in Raw Sensor Units per 100 ms).timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigMotionAcceleration
public static int ConfigMotionAcceleration(long handle, int sensorUnitsPer100msPerSec, int timeoutMs) Sets the Motion Magic Acceleration.- Parameters:
handle- handle of device.sensorUnitsPer100msPerSec- Motion Magic Acceleration (in Raw Sensor Units per 100 ms per second).timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigMotionSCurveStrength
-
ClearMotionProfileTrajectories
-
GetMotionProfileTopLevelBufferCount
-
PushMotionProfileTrajectory
public static int PushMotionProfileTrajectory(long handle, double position, double velocity, double headingDeg, int profileSlotSelect, boolean isLastPoint, boolean zeroPos) -
PushMotionProfileTrajectory2
public static int PushMotionProfileTrajectory2(long handle, double position, double velocity, double headingDeg, int profileSlotSelect0, int profileSlotSelect1, boolean isLastPoint, boolean zeroPos, int durationMs) -
PushMotionProfileTrajectory3
public static int PushMotionProfileTrajectory3(long handle, double position, double velocity, double arbFeedFwd, double auxiliaryPos, double auxiliaryVel, double auxiliaryArbFeedFwd, int profileSlotSelect0, int profileSlotSelect1, boolean isLastPoint, boolean zeroPos0, int timeDur, boolean useAuxPID) -
StartMotionProfile
public static int StartMotionProfile(long handle, long streamHandle, int minBufferedPts, int controlMode) -
IsMotionProfileTopLevelBufferFull
-
IsMotionProfileFinished
-
ProcessMotionProfileBuffer
-
GetMotionProfileStatus
-
GetMotionProfileStatus2
-
ClearMotionProfileHasUnderrun
-
ChangeMotionControlFramePeriod
-
ConfigMotionProfileTrajectoryPeriod
-
ConfigMotionProfileTrajectoryInterpolationEnable
public static int ConfigMotionProfileTrajectoryInterpolationEnable(long handle, boolean enable, int timeoutMs) -
ConfigFeedbackNotContinuous
public static int ConfigFeedbackNotContinuous(long handle, boolean feedbackNotContinuous, int timeoutMs) -
ConfigRemoteSensorClosedLoopDisableNeutralOnLOS
public static int ConfigRemoteSensorClosedLoopDisableNeutralOnLOS(long handle, boolean remoteSensorClosedLoopDisableNeutralOnLOS, int timeoutMs) -
ConfigClearPositionOnLimitF
public static int ConfigClearPositionOnLimitF(long handle, boolean clearPositionOnLimitF, int timeoutMs) -
ConfigClearPositionOnLimitR
public static int ConfigClearPositionOnLimitR(long handle, boolean clearPositionOnLimitR, int timeoutMs) -
ConfigClearPositionOnQuadIdx
public static int ConfigClearPositionOnQuadIdx(long handle, boolean clearPositionOnQuadIdx, int timeoutMs) -
ConfigLimitSwitchDisableNeutralOnLOS
public static int ConfigLimitSwitchDisableNeutralOnLOS(long handle, boolean limitSwitchDisableNeutralOnLOS, int timeoutMs) -
ConfigSoftLimitDisableNeutralOnLOS
public static int ConfigSoftLimitDisableNeutralOnLOS(long handle, boolean softLimitDisableNeutralOnLOS, int timeoutMs) -
ConfigPulseWidthPeriod_EdgesPerRot
public static int ConfigPulseWidthPeriod_EdgesPerRot(long handle, int pulseWidthPeriod_EdgesPerRot, int timeoutMs) -
ConfigPulseWidthPeriod_FilterWindowSz
public static int ConfigPulseWidthPeriod_FilterWindowSz(long handle, int pulseWidthPeriod_FilterWindowSz, int timeoutMs) -
GetLastError
Gets the last error generated by this object.- Parameters:
handle- handle of device.- Returns:
- Last Error Code generated by a function.
-
GetFirmwareVersion
Gets the firmware version of the device.- Parameters:
handle- handle of device.- Returns:
- Firmware version of device.
-
HasResetOccurred
Returns true if the device has reset.- Parameters:
handle- handle of device.- Returns:
- Has a Device Reset Occurred?
-
ConfigSetCustomParam
Sets the value of a custom parameter.- Parameters:
handle- handle of device.newValue- Value for custom parameter.paramIndex- Index of custom parameter.timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigGetCustomParam
Gets the value of a custom parameter.- Parameters:
handle- handle of device.paramIndex- Index of custom parameter.timoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Value of the custom param.
-
ConfigSetParameter
public static int ConfigSetParameter(long handle, int param, double value, int subValue, int ordinal, int timeoutMs) Sets a parameter.- Parameters:
handle- handle of device.param- Parameter enumeration.value- Value of parameter.subValue- Subvalue for parameter. Maximum value of 255.ordinal- Ordinal of parameter.timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigGetParameter
Gets a parameter.- Parameters:
handle- handle of device.param- Parameter enumeration.ordinal- Ordinal of parameter.timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Value of parameter.
-
ConfigPeakCurrentLimit
Configures the peak current limit of the motor controller.- Parameters:
handle- handle of device.amps- Peak current limit (in amps).timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigPeakCurrentDuration
Configures the maximum time allowed at peak current limit of the motor controller.- Parameters:
handle- handle of device.milliseconds- Maximum time allowed at peak current limit (in milliseconds).timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
ConfigContinuousCurrentLimit
Configures the continuous current limit.- Parameters:
handle- handle of device.amps- Continuous Current Limit.timeoutMs- Timeout value in ms. @see #ConfigOpenLoopRamp- Returns:
- Error Code generated by function. 0 indicates no error.
-
EnableCurrentLimit
Enables the current limit feature.- Parameters:
handle- handle of device.enable- Enable state of current limit.
-
GetAnalogIn
-
SetAnalogPosition
-
GetAnalogInRaw
-
GetAnalogInVel
-
GetQuadraturePosition
-
SetQuadraturePosition
-
GetQuadratureVelocity
-
GetPulseWidthPosition
-
SetPulseWidthPosition
-
GetPulseWidthVelocity
-
GetPulseWidthRiseToFallUs
-
GetPulseWidthRiseToRiseUs
-
GetPinStateQuadA
-
GetPinStateQuadB
-
GetPinStateQuadIdx
-
IsFwdLimitSwitchClosed
-
IsRevLimitSwitchClosed
-
GetFaults
-
GetStickyFaults
-
ClearStickyFaults
-
SelectDemandType
-
SetMPEOutput
-
EnableHeadingHold
-
GetClosedLoopTarget
-
ConfigSelectedFeedbackCoefficient
public static int ConfigSelectedFeedbackCoefficient(long handle, double coefficient, int pidIdx, int timeoutMs) -
ConfigClosedLoopPeakOutput
public static int ConfigClosedLoopPeakOutput(long handle, int slotIdx, double percentOut, int timeoutMs) -
ConfigClosedLoopPeriod
-
ConfigMotorCommutation
-
ConfigGetMotorCommutation
-
ConfigSupplyCurrentLimit
-
ConfigStatorCurrentLimit
-
ConfigSupplyCurrentLimitEnable
-
ConfigStatorCurrentLimitEnable
-
ConfigBrakeCurrentLimitEnable
-
ConfigGetSupplyCurrentLimit
-
ConfigGetStatorCurrentLimit
-
SetIntegratedSensorPosition
-
SetIntegratedSensorPositionToAbsolute
-
GetIntegratedSensorPosition
-
GetIntegratedSensorAbsolutePosition
-
GetIntegratedSensorVelocity
-
ConfigIntegratedSensorAbsoluteRange
public static int ConfigIntegratedSensorAbsoluteRange(long handle, int absoluteSensorRange, int timeoutMs) -
ConfigIntegratedSensorOffset
-
ConfigIntegratedSensorInitializationStrategy
public static int ConfigIntegratedSensorInitializationStrategy(long handle, int initStrategy, int timeoutMs)
-