PWMMotorController

class wpilib.PWMMotorController(name: str, channel: int)

Bases: MotorController, MotorSafety, Sendable

Common base class for all PWM Motor Controllers.

Constructor for a PWM Motor %Controller connected via PWM.

Parameters:
  • name – Name to use for SendableRegistry

  • channel – The PWM channel that the controller is attached to. 0-9 are on-board, 10-19 are on the MXP port

disable() None
enableDeadbandElimination(eliminateDeadband: bool) None

Optionally eliminate the deadband from a motor controller.

Parameters:

eliminateDeadband – If true, set the motor curve on the motor controller to eliminate the deadband in the middle of the range. Otherwise, keep the full range without modifying any values.

get() float

Get the recently set value of the PWM. This value is affected by the inversion property. If you want the value that is sent directly to the MotorController, use PWM::GetSpeed() instead.

Returns:

The most recently set value for the PWM between -1.0 and 1.0.

getChannel() int
getDescription() str
getInverted() bool
set(value: float) None

Set the PWM value.

The PWM value is set using a range of -1.0 to 1.0, appropriately scaling the value for the FPGA.

Parameters:

value – The speed value between -1.0 and 1.0 to set.

setInverted(isInverted: bool) None
stopMotor() None