Class MotControllerJNI
java.lang.Object
com.ctre.phoenix.CTREJNIWrapper
com.ctre.phoenix.motorcontrol.can.MotControllerJNI
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
ChangeMotionControlFramePeriod
(long handle, int periodMs) static int
ClearMotionProfileHasUnderrun
(long handle, int timeoutMs) static int
ClearMotionProfileTrajectories
(long handle) static int
ClearStickyFaults
(long handle, int timeoutMs) static int
Config_IntegralZone
(long handle, int slotIdx, double izone, int timeoutMs) Sets the Integral Zone constant in the given parameter slot.static int
Config_kD
(long handle, int slotIdx, double value, int timeoutMs) Sets the 'D' constant in the given parameter slot.static int
Config_kF
(long handle, int slotIdx, double value, int timeoutMs) Sets the 'F' constant in the given parameter slot.static int
Config_kI
(long handle, int slotIdx, double value, int timeoutMs) Sets the 'I' constant in the given parameter slot.static int
Config_kP
(long handle, int slotIdx, double value, int timeoutMs) Sets the 'P' constant in the given parameter slot.static int
ConfigAllowableClosedloopError
(long handle, int slotIdx, int allowableClosedLoopError, int timeoutMs) Sets the allowable closed-loop error in the given parameter slot.static int
ConfigBrakeCurrentLimitEnable
(long handle, boolean enable, int timeoutMs) static int
ConfigClearPositionOnLimitF
(long handle, boolean clearPositionOnLimitF, int timeoutMs) static int
ConfigClearPositionOnLimitR
(long handle, boolean clearPositionOnLimitR, int timeoutMs) static int
ConfigClearPositionOnQuadIdx
(long handle, boolean clearPositionOnQuadIdx, int timeoutMs) static int
ConfigClosedLoopPeakOutput
(long handle, int slotIdx, double percentOut, int timeoutMs) static int
ConfigClosedLoopPeriod
(long handle, int slotIdx, int loopTimeMs, int timeoutMs) static int
ConfigClosedLoopRamp
(long handle, double secondsFromNeutralToFull, int timeoutMs) Configures the closed-loop ramp rate of throttle output.static int
ConfigContinuousCurrentLimit
(long handle, int amps, int timeoutMs) Configures the continuous current limit.static int
ConfigFactoryDefault
(long handle, int timeoutMs) Revert all configurations to factory default values.static int
ConfigFeedbackNotContinuous
(long handle, boolean feedbackNotContinuous, int timeoutMs) static int
ConfigForwardLimitSwitchSource
(long handle, int type, int normalOpenOrClose, int deviceID, int timeoutMs) Configures the forward limit switch for a remote source.static int
ConfigForwardSoftLimitEnable
(long handle, boolean enable, int timeoutMs) static int
ConfigForwardSoftLimitThreshold
(long handle, int forwardSensorLimit, int timeoutMs) Configures the forward soft limit.static int
ConfigGetCustomParam
(long handle, int paramIndex, int timoutMs) Gets the value of a custom parameter.static int
ConfigGetMotorCommutation
(long handle, int timeoutMs) static double
ConfigGetParameter
(long handle, int param, int ordinal, int timeoutMs) Gets a parameter.static int
ConfigGetStatorCurrentLimit
(long handle, double[] toFill, int timeoutMs) static int
ConfigGetSupplyCurrentLimit
(long handle, double[] toFill, int timeoutMs) static int
ConfigIntegratedSensorAbsoluteRange
(long handle, int absoluteSensorRange, int timeoutMs) static int
ConfigIntegratedSensorInitializationStrategy
(long handle, int initStrategy, int timeoutMs) static int
ConfigIntegratedSensorOffset
(long handle, double offsetDegrees, int timeoutMs) static int
ConfigLimitSwitchDisableNeutralOnLOS
(long handle, boolean limitSwitchDisableNeutralOnLOS, int timeoutMs) static int
ConfigMaxIntegralAccumulator
(long handle, int slotIdx, double iaccum, int timeoutMs) Sets the maximum integral accumulator in the given parameter slot.static int
ConfigMotionAcceleration
(long handle, int sensorUnitsPer100msPerSec, int timeoutMs) Sets the Motion Magic Acceleration.static int
ConfigMotionCruiseVelocity
(long handle, int sensorUnitsPer100ms, int timeoutMs) Sets the Motion Magic Cruise Velocity.static int
ConfigMotionProfileTrajectoryInterpolationEnable
(long handle, boolean enable, int timeoutMs) static int
ConfigMotionProfileTrajectoryPeriod
(long handle, int periodMs, int timeoutMs) static int
ConfigMotionSCurveStrength
(long m_handle, int curveStrength, int timeoutMs) static int
ConfigMotorCommutation
(long handle, int motorCommutation, int timeoutMs) static int
ConfigNeutralDeadband
(long handle, double percentDeadband, int timeoutMs) Configures the output deadband percentage.static int
ConfigNominalOutputForward
(long handle, double percentOut, int timeoutMs) Configures the forward nominal output percentage.static int
ConfigNominalOutputReverse
(long handle, double percentOut, int timeoutMs) Configures the reverse nominal output percentage.static int
ConfigOpenLoopRamp
(long handle, double secondsFromNeutralToFull, int timeoutMs) Configures the open-loop ramp rate of throttle output.static int
ConfigPeakCurrentDuration
(long handle, int milliseconds, int timeoutMs) Configures the maximum time allowed at peak current limit of the motor controller.static int
ConfigPeakCurrentLimit
(long handle, int amps, int timeoutMs) Configures the peak current limit of the motor controller.static int
ConfigPeakOutputForward
(long handle, double percentOut, int timeoutMs) Configures the forward peak output percentage.static int
ConfigPeakOutputReverse
(long handle, double percentOut, int timeoutMs) Configures the reverse peak output percentage.static int
ConfigPulseWidthPeriod_EdgesPerRot
(long handle, int pulseWidthPeriod_EdgesPerRot, int timeoutMs) static int
ConfigPulseWidthPeriod_FilterWindowSz
(long handle, int pulseWidthPeriod_FilterWindowSz, int timeoutMs) static int
ConfigRemoteFeedbackFilter
(long handle, int deviceID, int remoteSensorSource, int remoteOrdinal, int timeoutMs) Configures the remote feedback filter.static int
ConfigRemoteSensorClosedLoopDisableNeutralOnLOS
(long handle, boolean remoteSensorClosedLoopDisableNeutralOnLOS, int timeoutMs) static int
ConfigReverseLimitSwitchSource
(long handle, int type, int normalOpenOrClose, int deviceID, int timeoutMs) Configures the reverse limit switch for a remote source.static int
ConfigReverseSoftLimitEnable
(long handle, boolean enable, int timeoutMs) static int
ConfigReverseSoftLimitThreshold
(long handle, int reverseSensorLimit, int timeoutMs) Configures the reverse soft limit.static int
ConfigSelectedFeedbackCoefficient
(long handle, double coefficient, int pidIdx, int timeoutMs) static int
ConfigSelectedFeedbackSensor
(long handle, int feedbackDevice, int pidIdx, int timeoutMs) Select the feedback device for the motor controller.static int
ConfigSensorTerm
(long handle, int sensorTerm, int feedbackDevice, int timeoutMs) static int
ConfigSetCustomParam
(long handle, int newValue, int paramIndex, int timeoutMs) Sets the value of a custom parameter.static int
ConfigSetParameter
(long handle, int param, double value, int subValue, int ordinal, int timeoutMs) Sets a parameter.static int
ConfigSoftLimitDisableNeutralOnLOS
(long handle, boolean softLimitDisableNeutralOnLOS, int timeoutMs) static int
ConfigStatorCurrentLimit
(long handle, double[] params, int timeoutMs) static int
ConfigStatorCurrentLimitEnable
(long handle, boolean enable, int timeoutMs) static int
ConfigSupplyCurrentLimit
(long handle, double[] params, int timeoutMs) static int
ConfigSupplyCurrentLimitEnable
(long handle, boolean enable, int timeoutMs) static int
ConfigVelocityMeasurementPeriod
(long handle, int period, int timeoutMs) Sets the period over which velocity measurements are taken.static int
ConfigVelocityMeasurementWindow
(long handle, int windowSize, int timeoutMs) Sets the number of velocity samples used in the rolling average velocity measurement.static int
ConfigVoltageCompSaturation
(long handle, double voltage, int timeoutMs) Configures the Voltage Compensation saturation voltage.static int
ConfigVoltageMeasurementFilter
(long handle, int filterWindowSamples, int timeoutMs) Configures the voltage measurement filter.static long
Create
(int baseArbId) static long
static int
EnableCurrentLimit
(long handle, boolean enable) Enables the current limit feature.static int
EnableHeadingHold
(long handle, int enable) static void
EnableVoltageCompensation
(long handle, boolean enable) Enables voltage compensation.static double
GetActiveTrajectoryArbFeedFwd3
(long handle, int pidIdx) static double
GetActiveTrajectoryHeading
(long handle) static int
GetActiveTrajectoryPosition
(long handle) static int
GetActiveTrajectoryPosition3
(long handle, int pidIdx) static int
GetActiveTrajectoryVelocity
(long handle) static int
GetActiveTrajectoryVelocity3
(long handle, int pidIdx) static int
GetAnalogIn
(long handle) static int
GetAnalogInRaw
(long handle) static int
GetAnalogInVel
(long handle) static int
GetBaseID
(long handle) static double
GetBusVoltage
(long handle) Gets the bus voltage seen by the motor controller.static int
GetClosedLoopError
(long handle, int pidIdx) Gets the closed-loop error.static int
GetClosedLoopTarget
(long handle, int pidIdx) static int
GetDeviceNumber
(long handle) Returns the Device IDstatic double
GetErrorDerivative
(long handle, int pidIdx) Gets the derivative of the closed-loop error.static int
GetFaults
(long handle) static int
GetFirmwareVersion
(long handle) Gets the firmware version of the device.static double
GetIntegralAccumulator
(long handle, int pidIdx) Gets the iaccum value.static double
GetIntegratedSensorAbsolutePosition
(long handle) static double
GetIntegratedSensorPosition
(long handle) static double
GetIntegratedSensorVelocity
(long handle) static boolean
GetInverted
(long handle) Gets the invert state of the motor controller.static int
GetLastError
(long handle) Gets the last error generated by this object.static int
GetMotionProfileStatus
(long handle, int[] toFill_9) static int
GetMotionProfileStatus2
(long handle, int[] toFill_11) static int
GetMotionProfileTopLevelBufferCount
(long handle) static double
GetMotorOutputPercent
(long handle) Gets the output percentage of the motor controller.static double
GetOutputCurrent
(long handle) Deprecated.Use getStatorCurrent/getSupplyCurrent instead.static int
GetPinStateQuadA
(long handle) static int
GetPinStateQuadB
(long handle) static int
GetPinStateQuadIdx
(long handle) static int
GetPulseWidthPosition
(long handle) static int
GetPulseWidthRiseToFallUs
(long handle) static int
GetPulseWidthRiseToRiseUs
(long handle) static int
GetPulseWidthVelocity
(long handle) static int
GetQuadraturePosition
(long handle) static int
GetQuadratureVelocity
(long handle) static int
GetSelectedSensorPosition
(long handle, int pidIdx) Get the selected sensor position.static int
GetSelectedSensorVelocity
(long handle, int pidIdx) Get the selected sensor velocity.static double
GetStatorCurrent
(long handle) Gets the stator/output current of the motor controller.static int
GetStatusFramePeriod
(long handle, int frame, int timeoutMs) Gets the period of the given status frame.static int
GetStickyFaults
(long handle) static double
GetSupplyCurrent
(long handle) Gets the stator/output current of the motor controller.static double
GetTemperature
(long handle) Gets the temperature of the motor controller.static boolean
HasResetOccurred
(long handle) Returns true if the device has reset.static int
IsFwdLimitSwitchClosed
(long handle) static boolean
IsMotionProfileFinished
(long handle) static boolean
IsMotionProfileTopLevelBufferFull
(long handle) static int
IsRevLimitSwitchClosed
(long handle) static int
JNI_destroy_MotController
(long handle) static void
OverrideLimitSwitchesEnable
(long handle, boolean enable) Sets the enable state for limit switches.static void
OverrideSoftLimitsEnable
(long handle, boolean enable) Sets the enable state for soft limit switches.static int
ProcessMotionProfileBuffer
(long handle) static int
PushMotionProfileTrajectory
(long handle, double position, double velocity, double headingDeg, int profileSlotSelect, boolean isLastPoint, boolean zeroPos) static int
PushMotionProfileTrajectory2
(long handle, double position, double velocity, double headingDeg, int profileSlotSelect0, int profileSlotSelect1, boolean isLastPoint, boolean zeroPos, int durationMs) 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) static int
SelectDemandType
(long handle, int enable) static void
SelectProfileSlot
(long handle, int slotIdx, int pidIdx) Selects which profile slot to use for closed-loop control.static void
Set_4
(long handle, int mode, double demand0, double demand1, int demand1Type) Sets the demand (output) of the motor controller.static int
SetAnalogPosition
(long handle, int newPosition, int timeoutMs) static int
SetControlFramePeriod
(long handle, int frame, int periodMs) Sets the period of the given control frame.static void
SetDemand
(long handle, int mode, int demand0, int demand1) Sets the demand (output) of the motor controller.static int
SetIntegralAccumulator
(long handle, double iaccum, int pidIdx, int timeoutMs) Sets the integral accumulator.static int
SetIntegratedSensorPosition
(long handle, double newPos, int timeoutMs) static int
SetIntegratedSensorPositionToAbsolute
(long handle, int timeoutMs) static void
SetInverted
(long handle, boolean invert) Inverts the output of the motor controller.static void
SetInverted_2
(long handle, int invert) Inverts the output of the motor controller.static int
SetMPEOutput
(long handle, int mpeOutput) static void
SetNeutralMode
(long handle, int neutralMode) Sets the mode of operation during neutral throttle output.static int
SetPulseWidthPosition
(long handle, int newPosition, int timeoutMs) static int
SetQuadraturePosition
(long handle, int newPosition, int timeoutMs) static int
SetSelectedSensorPosition
(long handle, int sensorPos, int pidIdx, int timeoutMs) Sets the sensor position to the given value.static void
SetSensorPhase
(long handle, boolean PhaseSensor) Sets the phase of the sensor.static int
SetStatusFramePeriod
(long handle, int frame, int periodMs, int timeoutMs) Sets the period of the given status frame.static int
StartMotionProfile
(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)
-