def __init__(self, channel: int) -> None: """Allocate a PWM given a channel. :param channel: The PWM channel number. 0-9 are on-board, 10-19 are on the MXP port """ super().__init__() SendableBase.__init__(self) SensorUtil.checkPWMChannel(channel) self.channel = channel self._handle = hal.initializePWMPort(hal.getPort(channel)) self.__finalizer = weakref.finalize(self, _freePWM, self._handle) self.setDisabled() hal.setPWMEliminateDeadband(self.handle, False) hal.report(hal.UsageReporting.kResourceType_PWM, channel) self.setName("PWM", channel) self.setSafetyEnabled(False) # Python-specific: Need this to free on unit test wpilib reset Resource._add_global_resource(self)
def __init__(self, channel: int) -> None: """Allocate a PWM given a channel. :param channel: The PWM channel number. 0-9 are on-board, 10-19 are on the MXP port """ super().__init__() SendableBase.__init__(self) SensorUtil.checkPWMChannel(channel) self.channel = channel self.handle = hal.initializePWMPort(hal.getPort(channel)) self.__finalizer = weakref.finalize(self, _freePWM, self.handle) self.setDisabled() hal.setPWMEliminateDeadband(self.handle, False) hal.report(hal.UsageReporting.kResourceType_PWM, channel) self.setName("PWM", channel) self.setSafetyEnabled(False) # Python-specific: Need this to free on unit test wpilib reset Resource._add_global_resource(self)
def enableDeadbandElimination(self, eliminateDeadband: bool) -> None: """Optionally eliminate the deadband from a speed controller. :param eliminateDeadband: If True, set the motor curve on the Jaguar to eliminate the deadband in the middle of the range. Otherwise, keep the full range without modifying any values. """ hal.setPWMEliminateDeadband(self.handle, eliminateDeadband)
def enableDeadbandElimination(self, eliminateDeadband: bool) -> None: """Optionally eliminate the deadband from a speed controller. :param eliminateDeadband: If True, set the motor curve on the Jaguar to eliminate the deadband in the middle of the range. Otherwise, keep the full range without modifying any values. """ hal.setPWMEliminateDeadband(self.handle, eliminateDeadband)