def provideDirections(self, nextCheckPoint, currentCheckPoint, pos_x, pos_y, speaker):
                #threading.Timer(1.0, provideDirections(nextCheckPoint, currentCheckPoint, pos_x, pos_y)).start()
                print "start of function"
                sayNextCheckPoint = 'your next checkpoint is %s\n' %(mapinfo['map'][nextCheckPoint - 1]['nodeName'])
		#speaker.threadedFeedback(sayNextCheckPoint)
                speaking_proc = Process(target=speaker.threadedFeedback, args=(sayNextCheckPoint,))
		speaking_proc.start()
		speaking_proc.join()
		detourCheckPoint = False
                reachCheckPoint = False
                start_time = time.time()
                time_to_speak = time.time()
		dist = None
		change_direction = None
		direction = '%s %lf degrees, %lf'
		speak_direction = '%s %d degrees, and walk %d point %d meters\n'
		isFirstTimeGivingDirections = False
		isFirstTimeProcDirections = True
		oneSecondHasPassed = False

                while True:
                        if (time.time() - start_time > 1) or isFirstTimeProcDirections:
                                start_time = time.time()
                                #distance, heading = input()
                                dataParser = DataParser()
                                step = dataParser.get_step_read()
                                print "NUMBER OF STEPS %d\n", step
                                compass_read = dataParser.get_compass_read()
                                print "compass_read", compass_read
                                del dataParser
				
				if not isFirstTimeProcDirections:
                                	if step == 0:
						print 'going into calcDisplacement\n\n\n'
                                	        reachCheckPoint, pos_x, pos_y, detourCheckPoint, speak_direction = self.calcDisplacement(0, compass_read, 5, pos_x, pos_y, nextCheckPoint, currentCheckPoint)
					else:
                                		for i in range(step):
							print 'step #', i
                                        		reachCheckPoint, pos_x, pos_y, detourCheckPoint, speak_direction = self.calcDisplacement(1, compass_read, i, pos_x, pos_y, nextCheckPoint, currentCheckPoint)
				if oneSecondHasPassed:
					isFirstTimeGivingDirections = True
					oneSecondHasPassed = False

				if isFirstTimeProcDirections:
					oneSecondHasPassed = True
					isFirstTimeProcDirections = False

                        if (time.time() - time_to_speak > 4) or isFirstTimeGivingDirections:
				isFirstTimeGivingDirections = False
                                time_to_speak = time.time()
                                speaking_proc = Process(target=speaker.threadedFeedback, args=(speak_direction,))
                                speaking_proc.start()

                        if reachCheckPoint:
                                speak_direction = 'checkpoint reached'
                                speaking_proc = Process(target=speaker.threadedFeedback, args=(speak_direction,))
                                speaking_proc.start()
                                break

                        if detourCheckPoint:
                                break
                                

                return reachCheckPoint, pos_x, pos_y, detourCheckPoint
    def provideDirections(self, nextCheckPoint, currentCheckPoint, pos_x,
                          pos_y, speaker):
        #threading.Timer(1.0, provideDirections(nextCheckPoint, currentCheckPoint, pos_x, pos_y)).start()
        print "start of function"
        sayNextCheckPoint = 'your next checkpoint is %s\n' % (
            mapinfo['map'][nextCheckPoint - 1]['nodeName'])
        #speaker.threadedFeedback(sayNextCheckPoint)
        speaking_proc = Process(target=speaker.threadedFeedback,
                                args=(sayNextCheckPoint, ))
        speaking_proc.start()
        speaking_proc.join()
        detourCheckPoint = False
        reachCheckPoint = False
        start_time = time.time()
        time_to_speak = time.time()
        dist = None
        change_direction = None
        direction = '%s %lf degrees, %lf'
        speak_direction = '%s %d degrees, and walk %d point %d meters\n'
        isFirstTimeGivingDirections = False
        isFirstTimeProcDirections = True
        oneSecondHasPassed = False

        while True:
            if (time.time() - start_time > 1) or isFirstTimeProcDirections:
                start_time = time.time()
                #distance, heading = input()
                dataParser = DataParser()
                step = dataParser.get_step_read()
                print "NUMBER OF STEPS %d\n", step
                compass_read = dataParser.get_compass_read()
                print "compass_read", compass_read
                del dataParser

                if not isFirstTimeProcDirections:
                    if step == 0:
                        print 'going into calcDisplacement\n\n\n'
                        reachCheckPoint, pos_x, pos_y, detourCheckPoint, speak_direction = self.calcDisplacement(
                            0, compass_read, 5, pos_x, pos_y, nextCheckPoint,
                            currentCheckPoint)
                    else:
                        for i in range(step):
                            print 'step #', i
                            reachCheckPoint, pos_x, pos_y, detourCheckPoint, speak_direction = self.calcDisplacement(
                                1, compass_read, i, pos_x, pos_y,
                                nextCheckPoint, currentCheckPoint)
                if oneSecondHasPassed:
                    isFirstTimeGivingDirections = True
                    oneSecondHasPassed = False

                if isFirstTimeProcDirections:
                    oneSecondHasPassed = True
                    isFirstTimeProcDirections = False

            if (time.time() - time_to_speak >
                    4) or isFirstTimeGivingDirections:
                isFirstTimeGivingDirections = False
                time_to_speak = time.time()
                speaking_proc = Process(target=speaker.threadedFeedback,
                                        args=(speak_direction, ))
                speaking_proc.start()

            if reachCheckPoint:
                speak_direction = 'checkpoint reached'
                speaking_proc = Process(target=speaker.threadedFeedback,
                                        args=(speak_direction, ))
                speaking_proc.start()
                break

            if detourCheckPoint:
                break

        return reachCheckPoint, pos_x, pos_y, detourCheckPoint