Fixed lots and lots of errors. Added and tweaked some helper functions. Main loop is now partially working.
This commit is contained in:
parent
c1f68b84e3
commit
f30868635b
6 changed files with 109 additions and 39 deletions
24
src/main.py
24
src/main.py
|
@ -4,6 +4,7 @@ import paho.mqtt.client as mqtt
|
|||
from planet import Direction, Planet
|
||||
from communication import Mode, Communication
|
||||
from move import Move
|
||||
from time import sleep
|
||||
|
||||
# DO NOT EDIT
|
||||
client = None
|
||||
|
@ -23,6 +24,17 @@ def run():
|
|||
while(communication.planetname is None):
|
||||
communication.process_messages()
|
||||
|
||||
# run first time not in loop because odometry data is not relevant
|
||||
communication.update(None, move.getstationedges()) # TODO: Register in map
|
||||
move.turnto(communication.navto[0][1]) # TODO: add control mechanism to communication class
|
||||
sleep(4)
|
||||
communication.planet.setcurdir(communication.navto[0][1])
|
||||
move.setcurdir(communication.getdir())
|
||||
move.reset()
|
||||
print("current dir:", move._odometry.angle_get())
|
||||
print("Navigation Data:", communication.navto)
|
||||
move.traversetonextstation(False)
|
||||
|
||||
while(communication.status() is not Mode.COMPLETE):
|
||||
while(communication.status() is Mode.GOTOSTATION or communication.status() is Mode.TARGET): # should be triggered if current station has no unexplored edges
|
||||
for instructions in communication.navto:
|
||||
|
@ -31,11 +43,15 @@ def run():
|
|||
move.turnto(instructions[1])
|
||||
move.traversetonextstation(True)
|
||||
|
||||
communication.update(move._odometry.coordinates_get(), move.getstationedges()) # TODO: Register in map
|
||||
move.updatevars()
|
||||
communication.update(move.getstats(), move.getstationedges()) # TODO: Register in map
|
||||
move.turnto(communication.navto[0][1]) # TODO: add control mechanism to communication class
|
||||
if(communication.check(move.traversetonextstation(False)) is False):
|
||||
move.setcurdir(communication.getdir())
|
||||
sleep(4)
|
||||
communication.planet.setcurdir(communication.navto[0][1])
|
||||
move.setcurdir(communication.getdir())
|
||||
move.reset()
|
||||
print("current dir:", move._odometry.angle_get())
|
||||
print("Navigation Data:", communication.navto)
|
||||
move.traversetonextstation(False)
|
||||
|
||||
|
||||
# DO NOT EDIT
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue