Changeset 4b9f5e3


Ignore:
Timestamp:
07/11/11 00:58:30 (3 years ago)
Author:
xkolman2 <xkolman2@…>
Branches:
master
Children:
c0ca0ae
Parents:
e7d9a1c
git-author:
xkolman2 <xkolman2@…> (07/11/11 00:58:30)
git-committer:
xkolman2 <xkolman2@…> (07/11/11 00:58:30)
Message:

check if current per seccond speed (mps) is not larger thant the point reached distance (prd) and if it is make prd = 2*mps
add an intemediate turn announcement at 20 s if the warning time is longer than 20 s

git-svn-id: https://nlp.fi.muni.cz/svn/gps_navigace/trunk@442 0858a4d0-ffff-46e5-938e-62b5ecb34222

Location:
modules
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • modules/mod_turnByTurn.py

    re7d9a1c r4b9f5e3  
    4444    self.currentStepIndex = 0 
    4545    self.currentStepIndicator = None 
     46    self.espeakFirstAndHalfTrigger = False 
    4647    self.espeakFirstTrigger = False 
    4748    self.espeakSecondTrigger = False 
     
    133134    metersPerSecSpeed = self.get('metersPerSecSpeed', None) 
    134135    pointReachedDistance = int(self.get('pointReachedDistance', 30)) 
     136 
    135137    if metersPerSecSpeed: 
     138      # check if we can miss the point by going too fast -> mps speed > point reached distance 
     139      if metersPerSecSpeed > pointReachedDistance*0.75: 
     140        pointReachedDistance = metersPerSecSpeed*2 
     141        print "tbt: enlarging point reached distance to: %1.2f m due to large speed (%1.2f m/s)" % (pointReachedDistance, metersPerSecSpeed) 
     142 
     143      # speed & time based triggering 
    136144      lowSpeed = float(self.get('minAnnounceSpeed', 13.89)) 
    137145      highSpeed = float(self.get('maxAnnounceSpeed', 27.78)) 
     
    154162        print "current speed: %1.2f m/s (%1.2f km/h)" % (metersPerSecSpeed, metersPerSecSpeed*3.6) 
    155163        print "point reached distance: %f m" % pointReachedDistance 
    156         print "1. announcement triggered: %r, 2. announcement triggered: %r" % (self.espeakFirstTrigger, self.espeakSecondTrigger) 
    157  
    158  
    159     if currentDistance <= pointReachedDistance: 
    160       """this means we reached the point""" 
    161       if self.espeakSecondTrigger == False: 
    162         print "triggering espeak nr. 2" 
    163         # say the message without distance 
    164         plaintextMessage = currentStep['descriptionEspeak'] 
    165         # consider turn said even if it was skipped (ignore errors) 
    166         self.sayTurn(plaintextMessage, 0) 
    167         self.markCurrentStepAsVisited() # mark this point as visited 
    168         self.espeakFirstTrigger = True # everything has been said, again :D 
    169         self.espeakSecondTrigger = True # everything has been said, again :D 
    170       self.switchToNextStep() # switch to next step 
    171     elif currentDistance <= distance: 
    172       """this means we reached an optimal distance for saying the message""" 
    173       if self.espeakFirstTrigger == False: 
    174         print "triggering espeak nr. 1" 
    175         plaintextMessage = currentStep['descriptionEspeak'] 
    176         if self.sayTurn(plaintextMessage, currentDistance): 
    177           self.espeakFirstTrigger = True # everything has been said :D 
     164        print "1. triggered=%r, 1.5. triggered=%r, 2. triggered=%r" % (self.espeakFirstTrigger, self.espeakFirstAndHalfTrigger, self.espeakSecondTrigger) 
     165        if warnTime > 20: 
     166          print "optional (20 s) trigger distance: %1.2f" % (20.0*metersPerSecSpeed) 
     167 
     168      if currentDistance <= pointReachedDistance: 
     169        """this means we reached the point""" 
     170        if self.espeakSecondTrigger == False: 
     171          print "triggering espeak nr. 2" 
     172          # say the message without distance 
     173          plaintextMessage = currentStep['descriptionEspeak'] 
     174          # consider turn said even if it was skipped (ignore errors) 
     175          self.sayTurn(plaintextMessage, 0) 
     176          self.markCurrentStepAsVisited() # mark this point as visited 
     177          self.espeakFirstTrigger = True # everything has been said, again :D 
     178          self.espeakSecondTrigger = True # everything has been said, again :D 
     179        self.switchToNextStep() # switch to next step 
     180      else: 
     181        if currentDistance <= distance: 
     182          """this means we reached an optimal distance for saying the message""" 
     183          if self.espeakFirstTrigger == False: 
     184            print "triggering espeak nr. 1" 
     185            plaintextMessage = currentStep['descriptionEspeak'] 
     186            if self.sayTurn(plaintextMessage, currentDistance): 
     187              self.espeakFirstTrigger = True # first message done 
     188        if self.espeakFirstAndHalfTrigger == False and warnTime > 20: 
     189          if currentDistance <= (20.0*metersPerSecSpeed): 
     190            """in case that the warning time gets too big, add an intemediate warning at 20 secconds 
     191            NOTE: this means it is said after the first trigger 
     192            """ 
     193            plaintextMessage = currentStep['descriptionEspeak'] 
     194            if self.sayTurn(plaintextMessage, currentDistance): 
     195              self.espeakFirstAndHalfTrigger = True # intermediate message done 
    178196 
    179197 
     
    455473    if nextIndex <= maxIndex: 
    456474      self.currentStepIndex = nextIndex 
     475      self.espeakFirstAndHalfTrigger = False 
    457476      self.espeakFirstTrigger = False 
    458477      self.espeakSecondTrigger = False 
Note: See TracChangeset for help on using the changeset viewer.