From 29849c2dd14a367a7b42b8fd63cbfae8114e3f1c Mon Sep 17 00:00:00 2001 From: d3rped Date: Sat, 24 Mar 2018 06:32:25 +0100 Subject: [PATCH] Rearranged and simplified main loop. --- src/main.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main.py b/src/main.py index dae34e7..d951198 100644 --- a/src/main.py +++ b/src/main.py @@ -26,21 +26,23 @@ def run(): print("received Planet Name") while(communication.status() is not Mode.COMPLETE): - move.getstationedges() # TODO: Register in map - move.turnto(90) # TODO: add control mechanism to communication class - move.traversetonextstation(False) # TODO: let same control mechanism decide if station is known, also traversetonextstation needs a return value - while(communication.status() is Mode.GOTOSTATION): # should be triggered if current station has no unexplored edges for instructions in communication.navto: - move.follow(instructions) - communication.update() + for instructions in communication.navto: + move.turnto(instructions[1]) + move.traversetonextstation(True) + communication.update() while(communication.status() is Mode.TARGET): # should be triggered when communication gets TARGET signal from server for instructions in communication.navto: - move.follow(instructions) - communication.update() # TODO: implement update function that communicates with server and waits/checks for new instructions - if(communication.status() == Mode.TARGET2): # TODO: implement Target change - break + for instructions in communication.navto: + move.turnto(instructions[1]) + move.traversetonextstation(True) + communication.update() + + communication(move.getstationedges()) # TODO: Register in map + move.turnto(communication.navto[0][1]) # TODO: add control mechanism to communication class + move.traversetonextstation(False) # TODO: let same control mechanism decide if station is known, also traversetonextstation needs a return value communication.update()