本文整理汇总了Python中driver.Driver.queue_elevator_run方法的典型用法代码示例。如果您正苦于以下问题:Python Driver.queue_elevator_run方法的具体用法?Python Driver.queue_elevator_run怎么用?Python Driver.queue_elevator_run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类driver.Driver
的用法示例。
在下文中一共展示了Driver.queue_elevator_run方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from driver import Driver [as 别名]
# 或者: from driver.Driver import queue_elevator_run [as 别名]
def main():
message_handler = MessageHandler()
driver = Driver()
#my_id = get IP address on this computer
my_id = 3
acknowledge = 4
run_floor = 0
run_button = 0
old_f = None
old_but = None
floor_up = [0]*4
floor_down = [0]*4
while True:
position = driver.read_position()
master_message = message_handler.receive_from_master()
for i in range (0,4):
if (master_message['master_floor_up'][i] == 0):
floor_up[i] = 0
if (master_message['master_floor_down'][i] == 0):
floor_down[i] = 0
time.sleep(0.1)
(floor,button) = driver.pop_floor_panel_queue()
if floor is not None:
if button == 0:
floor_up[floor] = 1
elif button == 1:
floor_down[floor] = 1
message_handler.send_to_master(floor_up,floor_down,my_id,position[0],position[1],position[2],master_message['queue_id'])
print floor_up
print floor_down
(run_floor,run_button) = message_handler.get_my_master_order()
print run_floor
print run_button
if run_floor is not None:
driver.queue_elevator_run(run_floor,run_button)
print ['floor_up:'] + master_message['master_floor_up'] + ['floor_down:'] + master_message['master_floor_down']
#print master_message['queue_id']
time.sleep(0.5)
'''