CarUltrasound.__init__(self) CarInfrared.__init__(self) CarCamera.__init__(self) CarDetect.__init__(self) def AllStop(self): CarMove.MotorStop(self) CarCamera.CameraCleanup(self) GPIO.cleanup() if __name__ == '__main__': try: car = Car() pid = PID(kp=1, ki=0.0, kd=0.1) pid.SetExpectedOutput(15) dist_list = [] min_speed = 30 FORWARD = True while True: ##### perception ###### # ultrasonic sensing dist_mov_ave = car.DistMeasureMovingAverage() motor_speed = -pid.UpdateOutput(dist_mov_ave) if motor_speed >= 0: FORWARD = True