from dijkstra import pathFinder pathFinder = pathFinder() pathFinder.setMap(1, 2) print pathFinder.getPath(0, 14) pathFinder.setMap(2, 3) print pathFinder.getPath(0, 9)
def __init__(self, voiceQueue, voiceSema) : self.prev_message_time_turn = 0 self.prev_message_time_str = 0 self.message_delay = 0 self.voiceQueue = voiceQueue self.voiceSema = voiceSema self.ANGLE_TOLERANCE = 0 self.pathFind = pathFinder() self.hasAnotherPath = False self.hasTwoPaths = False self.hasThreePaths = False self.startBuilding = None self.endBuilding = None self.startLevel = 0 self.endLevel = 0 self.midBuilding = None self.midLevel = None self.mapNumber = 0 # index of map in comMap list self.startLocation = 0 self.endLocation = 0 self.curX = 0 # cm self.curY = 0 # cm self.heading = 0 # -180 to 180 degrees # used to feedback steps to user self.walkingCount = 0 self.WALKING_VIBRATE_DURATION = 0.1 # tolerance self.maxTolerance = 200 # list of json parsing maps self.comMap = [] # path lists self.pathList = [] self.pathList2 = [] self.pathList3 = [] # north of cuurent map self.curMapNorth = 0 # if connection between the building has stairs self.hasStairs1 = 0 self.hasStairs2 = 0 # parameters to set when switching to new map self.hasStairs = 0 self.northDifference = 0 self.xFirst = None self.yFirst = None self.pathListIndex = 0 self.northAt = 0 # 0 to 360 degrees self.prevX = 0 # cm self.prevY = 0 # cm self.nexX = 0 # cm self.nexY = 0 # cm self.nodeNavi = navigation(self.voiceQueue, self.voiceSema) self.leftPin = 9 self.rightPin = 10
from dijkstra import pathFinder __author__ = 'Pap' myPF = pathFinder(); myPF.setMap(2,3) print myPF.getPath(0, 16) myPF.setMap(2,3) print myPF.getPath(0,16)