MotorController
- class wpilib.MotorController
Bases:
pybind11_objectInterface for motor controlling devices.
- disable() None
Disables the motor controller.
- getInverted() bool
Gets the inversion state of the motor controller.
- Returns:
The inversion state.
- getThrottle() float
Gets the throttle of the motor controller.
- Returns:
The throttle where -1 represents full reverse and 1 represents full forward.
- setInverted(isInverted: bool) None
Sets the inversion state of the motor controller.
- Parameters:
isInverted – The inversion state.
- setThrottle(throttle: SupportsFloat | SupportsIndex) None
Sets the throttle of the motor controller.
- Parameters:
throttle – The throttle where -1 indicates full reverse and 1 indicates full forward.
- setVoltage(voltage: wpimath.units.volts) None
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.