def basicMotorStart(self, way): util.traceCall() if util.getDebug() > 0: return if way == self._way[1] or way == 1: self.basicMotorBackward() else: self.basicMotorForward()
def motorStop(self): util.traceCall() if util.getDebug() > 0: return util.trace("_pwmMotorForward.ChangeDutyCycle to stop") util.trace("_pwmMotorBackward.ChangeDutyCycle to stop") self._pwmMotorForward.ChangeDutyCycle(self._stopCycle) self._pwmMotorBackward.ChangeDutyCycle(self._stopCycle)
def leftMotorSpeed(speed_f, speed_b): util.trace("lib_motors_evol.leftMotorSpeed with speed_f=" + str(speed_f) + " and speed_b=" + str(speed_b)) if util.getDebug() > 0: return if 1 <= speed_f <= speed_max: pwmMotorLeftForwards.ChangeDutyCycle(DutyCycleLeft * speed_f) else: pwmMotorLeftForwards.ChangeDutyCycle(Stop) if 1 <= speed_b <= speed_max: pwmMotorLeftBackwards.ChangeDutyCycle(DutyCycleLeft * speed_b) else: pwmMotorLeftBackwards.ChangeDutyCycle(Stop)
def motorUpdate(self): util.traceCall() if util.getDebug() > 0: return if self._curWay == 0: # forward util.trace("_pwmMotorForward.ChangeDutyCycle to " + str(self._dutyCycle * self._curSpeed)) util.trace("_pwmMotorBackward.ChangeDutyCycle to stop") self._pwmMotorForward.ChangeDutyCycle(self._dutyCycle * self._curSpeed) self._pwmMotorBackward.ChangeDutyCycle(self._stopCycle) else: # backward util.trace("_pwmMotorForward.ChangeDutyCycle to stop") util.trace("_pwmMotorBackward.ChangeDutyCycle to " + str(self._dutyCycle * self._curSpeed)) self._pwmMotorForward.ChangeDutyCycle(self._stopCycle) self._pwmMotorBackward.ChangeDutyCycle(self._dutyCycle * self._curSpeed)
def basicMotorBackward(self): util.traceCall() if util.getDebug() > 0: return GPIO.output(self._pinForward, 0) GPIO.output(self._pinBackward, 1)
def stopRightMotor(): util.trace("lib_motors_evol.stopRightMotor") if util.getDebug() > 0: return pwmMotorRightForwards.ChangeDutyCycle(Stop) pwmMotorRightBackwards.ChangeDutyCycle(Stop)