import arm robot_arm=arm.robotArm() driver=driveUnit.driveUnit() commandQueue=Queue.Queue() sensorList= {"lineSensor" : [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "distance" : [0, 0], "armPosition" : [0, 0, 255, 4, 5, 5], "errorCodes" : ["YngveProgrammedMeWrong"], "motorSpeed" : [70, 70], "latestCalibration" : "0000-00-00-15:00", "autoMotor" : True, "autoArm" : False, "regulator" : [0, 0], "error" : 0} pcThreadObject=pcThread(commandQueue,sensorList) pcThreadObject.daemon=True pcThreadObject.start() while True: if not commandQueue.empty(): command=(commandQueue.get()) if command[0]=="motorSpeed": left=int(command[1][0]) right=int(command[1][1]) driver.setMotorLeft(left) driver.setMotorRight(right) print(left,right) driver.sendAllMotor() if command[0]=="armPosition": robot_arm.setX(command[1][0]) robot_arm.setY(command[1][1])
"latestCalibration" : "0000-00-00-15:00", "autoMotor" : False, "autoArm" : False, "regulator" : [0, 0], "error" : 0, "state" : None, "hasPackage" :False} load_cal_from_file(shared_stuff) sensor_thread = sensorThread.sensorThread(shared_stuff) sensor_thread.daemon=True sensor_thread.start() cmd_queue = Queue.Queue() pc_thread = pcThread.pcThread(cmd_queue, shared_stuff) pc_thread.daemon=True pc_thread.start() regulator = regulator.Regulator(shared_stuff) regulator.daemon=True regulator.start() log.basicConfig(level=log.INFO) gloria = Gloria(shared_stuff, cmd_queue, sensor_thread) try: gloria.run() except: gloria.set_speed(0, 0) sys.exit(1)