Class WPI_VictorSPX
java.lang.Object
com.ctre.phoenix.motorcontrol.can.BaseMotorController
com.ctre.phoenix.motorcontrol.can.VictorSPX
com.ctre.phoenix.motorcontrol.can.WPI_VictorSPX
- All Implemented Interfaces:
IFollower,IMotorController,IInvertable,IOutputSignal,edu.wpi.first.util.sendable.Sendable,edu.wpi.first.wpilibj.motorcontrol.MotorController,edu.wpi.first.wpilibj.SpeedController,AutoCloseable
public class WPI_VictorSPX
extends VictorSPX
implements edu.wpi.first.wpilibj.motorcontrol.MotorController, edu.wpi.first.util.sendable.Sendable, AutoCloseable
VEX Victor SPX Motor Controller when used on CAN Bus.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleThe default motor safety timeout IF calling application enables the feature.Fields inherited from class com.ctre.phoenix.motorcontrol.can.BaseMotorController
m_handle -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voiddisable()Common interface for disabling a motor.voidfeed()Feed the motor safety object.doubleget()Common interface for getting the current set speed of a speed controller.doubleRetrieve the timeout value for the corresponding motor safety object.booleanCommon interface for returning the inversion state of a speed controller.voidinitSendable(edu.wpi.first.util.sendable.SendableBuilder builder) Initialize sendablebooleanisAlive()Determine of the motor is still operating or has timed out.booleanReturn the state of the motor safety enabled flag.voidset(double speed) Common interface for setting the speed of a simple speed controller.voidset(ControlMode mode, double value) Sets the appropriate output on the talon, depending on the mode.voidset(ControlMode mode, double demand0, DemandType demand1Type, double demand1) voidsetExpiration(double expirationTime) Set the expiration time for the corresponding motor safety object.voidsetInverted(boolean isInverted) Common interface for inverting direction of a speed controller.voidsetSafetyEnabled(boolean enabled) Enable/disable motor safety for this device.voidsetVoltage(double outputVolts) Sets the voltage output of the MotorController.voidCommon interface to stop the motor until Set is called again.Methods inherited from class com.ctre.phoenix.motorcontrol.can.VictorSPX
configAllSettings, configAllSettings, getAllConfigs, getAllConfigs, getPIDConfigs, getPIDConfigs, getSimCollection, set, setMethods inherited from class com.ctre.phoenix.motorcontrol.can.BaseMotorController
baseConfigAllSettings, baseConfigurePID, baseGetAllConfigs, baseGetPIDConfigs, changeMotionControlFramePeriod, clearMotionProfileHasUnderrun, clearMotionProfileHasUnderrun, clearMotionProfileTrajectories, clearStickyFaults, clearStickyFaults, config_IntegralZone, config_IntegralZone, config_kD, config_kD, config_kF, config_kF, config_kI, config_kI, config_kP, config_kP, configAllowableClosedloopError, configAllowableClosedloopError, configAuxPIDPolarity, configAuxPIDPolarity, configClearPositionOnLimitF, configClearPositionOnLimitR, configClearPositionOnQuadIdx, configClosedLoopPeakOutput, configClosedLoopPeakOutput, configClosedLoopPeriod, configClosedLoopPeriod, configClosedloopRamp, configClosedloopRamp, configFactoryDefault, configFactoryDefault, configFeedbackNotContinuous, configForwardLimitSwitchSource, configForwardLimitSwitchSource, configForwardLimitSwitchSource, configForwardLimitSwitchSource, configForwardLimitSwitchSource, configForwardSoftLimitEnable, configForwardSoftLimitEnable, configForwardSoftLimitThreshold, configForwardSoftLimitThreshold, configGetCustomParam, configGetCustomParam, configGetParameter, configGetParameter, configGetParameter, configGetParameter, configLimitSwitchDisableNeutralOnLOS, configMaxIntegralAccumulator, configMaxIntegralAccumulator, configMotionAcceleration, configMotionAcceleration, configMotionCruiseVelocity, configMotionCruiseVelocity, configMotionProfileTrajectoryInterpolationEnable, configMotionProfileTrajectoryInterpolationEnable, configMotionProfileTrajectoryPeriod, configMotionProfileTrajectoryPeriod, configMotionSCurveStrength, configMotionSCurveStrength, configNeutralDeadband, configNeutralDeadband, configNominalOutputForward, configNominalOutputForward, configNominalOutputReverse, configNominalOutputReverse, configOpenloopRamp, configOpenloopRamp, configPeakOutputForward, configPeakOutputForward, configPeakOutputReverse, configPeakOutputReverse, configPulseWidthPeriod_EdgesPerRot, configPulseWidthPeriod_FilterWindowSz, configRemoteFeedbackFilter, configRemoteFeedbackFilter, configRemoteFeedbackFilter, configRemoteFeedbackFilter, configRemoteFeedbackFilter, configRemoteFeedbackFilter, configRemoteSensorClosedLoopDisableNeutralOnLOS, configReverseLimitSwitchSource, configReverseLimitSwitchSource, configReverseLimitSwitchSource, configReverseSoftLimitEnable, configReverseSoftLimitEnable, configReverseSoftLimitThreshold, configReverseSoftLimitThreshold, configSelectedFeedbackCoefficient, configSelectedFeedbackCoefficient, configSelectedFeedbackSensor, configSelectedFeedbackSensor, configSelectedFeedbackSensor, configSelectedFeedbackSensor, configSensorTerm, configSensorTerm, configSensorTerm, configSensorTerm, configSetCustomParam, configSetCustomParam, configSetParameter, configSetParameter, configSetParameter, configSetParameter, configSoftLimitDisableNeutralOnLOS, configureFilter, configureFilter, configureFilter, configureSlot, configureSlot, configVelocityMeasurementPeriod, configVelocityMeasurementPeriod, configVelocityMeasurementPeriod, configVelocityMeasurementPeriod, configVelocityMeasurementWindow, configVelocityMeasurementWindow, configVoltageCompSaturation, configVoltageCompSaturation, configVoltageMeasurementFilter, configVoltageMeasurementFilter, DestroyObject, enableVoltageCompensation, follow, follow, getActiveTrajectoryArbFeedFwd, getActiveTrajectoryArbFeedFwd, getActiveTrajectoryPosition, getActiveTrajectoryPosition, getActiveTrajectoryVelocity, getActiveTrajectoryVelocity, getBaseID, getBusVoltage, getClosedLoopError, getClosedLoopError, getClosedLoopTarget, getClosedLoopTarget, getControlMode, getDeviceID, getErrorDerivative, getErrorDerivative, getFaults, getFilterConfigs, getFilterConfigs, getFirmwareVersion, getHandle, getIntegralAccumulator, getIntegralAccumulator, getLastError, getMotionProfileStatus, getMotionProfileTopLevelBufferCount, getMotorOutputPercent, getMotorOutputVoltage, getOutputCurrent, getSelectedSensorPosition, getSelectedSensorPosition, getSelectedSensorVelocity, getSelectedSensorVelocity, getSlotConfigs, getSlotConfigs, getStatusFramePeriod, getStatusFramePeriod, getStatusFramePeriod, getStatusFramePeriod, getStatusFramePeriod, getStatusFramePeriod, getStickyFaults, getTemperature, getVictorSPXSimCollection, hasResetOccurred, isMotionProfileFinished, isMotionProfileTopLevelBufferFull, isVoltageCompensationEnabled, neutralOutput, overrideLimitSwitchesEnable, overrideSoftLimitsEnable, processMotionProfileBuffer, pushMotionProfileTrajectory, selectProfileSlot, setControlFramePeriod, setControlFramePeriod, setIntegralAccumulator, setIntegralAccumulator, setInverted, setNeutralMode, setSelectedSensorPosition, setSelectedSensorPosition, setSensorPhase, setStatusFramePeriod, setStatusFramePeriod, setStatusFramePeriod, setStatusFramePeriod, startMotionProfile, valueUpdatedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.ctre.phoenix.motorcontrol.IFollower
follow, valueUpdatedMethods inherited from interface com.ctre.phoenix.motorcontrol.IMotorController
changeMotionControlFramePeriod, clearMotionProfileHasUnderrun, clearMotionProfileTrajectories, clearStickyFaults, config_IntegralZone, config_kD, config_kF, config_kI, config_kP, configAllowableClosedloopError, configAuxPIDPolarity, configClosedLoopPeakOutput, configClosedLoopPeriod, configClosedloopRamp, configForwardLimitSwitchSource, configForwardSoftLimitEnable, configForwardSoftLimitThreshold, configGetCustomParam, configGetParameter, configGetParameter, configMaxIntegralAccumulator, configMotionAcceleration, configMotionCruiseVelocity, configMotionProfileTrajectoryPeriod, configMotionSCurveStrength, configNeutralDeadband, configNominalOutputForward, configNominalOutputReverse, configOpenloopRamp, configPeakOutputForward, configPeakOutputReverse, configRemoteFeedbackFilter, configRemoteFeedbackFilter, configRemoteFeedbackFilter, configReverseLimitSwitchSource, configReverseSoftLimitEnable, configReverseSoftLimitThreshold, configSelectedFeedbackCoefficient, configSelectedFeedbackSensor, configSensorTerm, configSetCustomParam, configSetParameter, configSetParameter, configVoltageCompSaturation, configVoltageMeasurementFilter, enableVoltageCompensation, getActiveTrajectoryPosition, getActiveTrajectoryVelocity, getBaseID, getBusVoltage, getClosedLoopError, getClosedLoopTarget, getControlMode, getDeviceID, getErrorDerivative, getFaults, getFirmwareVersion, getIntegralAccumulator, getLastError, getMotionProfileStatus, getMotionProfileTopLevelBufferCount, getMotorOutputPercent, getMotorOutputVoltage, getSelectedSensorPosition, getSelectedSensorVelocity, getStatusFramePeriod, getStickyFaults, getTemperature, hasResetOccurred, isMotionProfileTopLevelBufferFull, neutralOutput, overrideLimitSwitchesEnable, overrideSoftLimitsEnable, processMotionProfileBuffer, pushMotionProfileTrajectory, selectProfileSlot, setControlFramePeriod, setIntegralAccumulator, setInverted, setNeutralMode, setSelectedSensorPosition, setSensorPhase, setStatusFramePeriod
-
Field Details
-
kDefaultSafetyExpiration
The default motor safety timeout IF calling application enables the feature.- See Also:
-
-
Constructor Details
-
WPI_VictorSPX
Constructor for motor controller- Parameters:
deviceNumber- device ID of motor controller
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable
-
set
Common interface for setting the speed of a simple speed controller.- Specified by:
setin interfaceedu.wpi.first.wpilibj.motorcontrol.MotorController- Specified by:
setin interfaceedu.wpi.first.wpilibj.SpeedController- Parameters:
speed- The speed to set. Value should be between -1.0 and 1.0. Value is also saved for Get().
-
get
Common interface for getting the current set speed of a speed controller.- Specified by:
getin interfaceedu.wpi.first.wpilibj.motorcontrol.MotorController- Specified by:
getin interfaceedu.wpi.first.wpilibj.SpeedController- Returns:
- The current set speed. Value is between -1.0 and 1.0.
-
set
Sets the appropriate output on the talon, depending on the mode.- Specified by:
setin interfaceIMotorController- Overrides:
setin classBaseMotorController- Parameters:
mode- The 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.value- The setpoint value, as described above. Standard Driving Example: _talonLeft.set(ControlMode.PercentOutput, leftJoy); _talonRght.set(ControlMode.PercentOutput, rghtJoy);
-
set
- Specified by:
setin interfaceIMotorController- Overrides:
setin classBaseMotorController- Parameters:
mode- Sets the appropriate output on the talon, depending on the mode.demand0- The 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.demand1Type- The 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.demand1- Supplmental 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);
-
setVoltage
Sets the voltage output of the MotorController. Compensates for the current bus voltage to ensure that the desired voltage is output even if the battery voltage is below 12V - highly useful when the voltage outputs are "meaningful" (e.g. they come from a feedforward calculation).NOTE: This function *must* be called regularly in order for voltage compensation to work properly - unlike the ordinary set function, it is not "set it and forget it."
- Specified by:
setVoltagein interfaceedu.wpi.first.wpilibj.motorcontrol.MotorController- Specified by:
setVoltagein interfaceedu.wpi.first.wpilibj.SpeedController- Parameters:
outputVolts- The voltage to output.
-
setInverted
Common interface for inverting direction of a speed controller.- Specified by:
setInvertedin interfaceIInvertable- Specified by:
setInvertedin interfaceIMotorController- Specified by:
setInvertedin interfaceedu.wpi.first.wpilibj.motorcontrol.MotorController- Specified by:
setInvertedin interfaceedu.wpi.first.wpilibj.SpeedController- Overrides:
setInvertedin classBaseMotorController- Parameters:
isInverted- The state of inversion, true is inverted.
-
getInverted
Common interface for returning the inversion state of a speed controller.- Specified by:
getInvertedin interfaceIInvertable- Specified by:
getInvertedin interfaceIMotorController- Specified by:
getInvertedin interfaceedu.wpi.first.wpilibj.motorcontrol.MotorController- Specified by:
getInvertedin interfaceedu.wpi.first.wpilibj.SpeedController- Overrides:
getInvertedin classBaseMotorController- Returns:
- The state of inversion, true is inverted.
-
disable
Common interface for disabling a motor.- Specified by:
disablein interfaceedu.wpi.first.wpilibj.motorcontrol.MotorController- Specified by:
disablein interfaceedu.wpi.first.wpilibj.SpeedController
-
stopMotor
Common interface to stop the motor until Set is called again.- Specified by:
stopMotorin interfaceedu.wpi.first.wpilibj.motorcontrol.MotorController- Specified by:
stopMotorin interfaceedu.wpi.first.wpilibj.SpeedController
-
initSendable
Initialize sendable- Specified by:
initSendablein interfaceedu.wpi.first.util.sendable.Sendable- Parameters:
builder- Base sendable to build on
-
getDescription
- Returns:
- description of controller
-
feed
Feed the motor safety object.Resets the timer on this object that is used to do the timeouts.
-
setExpiration
Set the expiration time for the corresponding motor safety object.- Parameters:
expirationTime- The timeout value in seconds.
-
getExpiration
Retrieve the timeout value for the corresponding motor safety object.- Returns:
- the timeout value in seconds.
-
isAlive
Determine of the motor is still operating or has timed out.- Returns:
- a true value if the motor is still operating normally and hasn't timed out.
-
setSafetyEnabled
Enable/disable motor safety for this device.Turn on and off the motor safety option for this PWM object.
- Parameters:
enabled- True if motor safety is enforced for this object
-
isSafetyEnabled
Return the state of the motor safety enabled flag.Return if the motor safety is currently enabled for this device.
- Returns:
- True if motor safety is enforced for this device
-