Interface MotorController
- All Known Implementing Classes:
Koors40, PWMMotorController, PWMSparkFlex, PWMSparkMax, PWMTalonFX, PWMTalonSRX, PWMVenom, PWMVictorSPX, RomiMotor, Spark, SparkMini, Talon, VictorSP, XRPMotor
-
Method Summary
Modifier and TypeMethodDescriptionvoiddisable()Disables the motor controller.doubleGets the duty cycle of the motor controller.booleanGets the inversion state of the motor controller.voidsetDutyCycle(double dutyCycle) Sets the duty cycle of the motor controller.voidsetInverted(boolean isInverted) Sets the inversion state of the motor controller.default voidsetVoltage(double voltage) Sets the voltage output of the motor controller.default voidsetVoltage(Voltage voltage) Sets the voltage output of the motor controller.
-
Method Details
-
setDutyCycle
Sets the duty cycle of the motor controller.- Parameters:
dutyCycle- The duty cycle between -1 and 1 (sign indicates direction).
-
setVoltage
Sets the voltage output of the motor controller.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."
- Parameters:
voltage- The voltage.
-
setVoltage
Sets the voltage output of the motor controller.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."
- Parameters:
voltage- The voltage.
-
getDutyCycle
double getDutyCycle()Gets the duty cycle of the motor controller.- Returns:
- The duty cycle between -1 and 1 (sign indicates direction).
-
setInverted
Sets the inversion state of the motor controller.- Parameters:
isInverted- The inversion state.
-
getInverted
boolean getInverted()Gets the inversion state of the motor controller.- Returns:
- The inversion state.
-
disable
void disable()Disables the motor controller.
-