Mercurial Hosting > traffic-intelligence
diff python/events.py @ 881:8ba82b371eea
work on storing PET
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Tue, 14 Mar 2017 17:48:40 -0400 |
parents | 0e875a7f5759 |
children | 4749b71aa7fb |
line wrap: on
line diff
--- a/python/events.py Tue Mar 14 17:10:35 2017 -0400 +++ b/python/events.py Tue Mar 14 17:48:40 2017 -0400 @@ -63,7 +63,8 @@ 'Collision Probability', 'Time to Collision', # 7 'Probability of Successful Evasive Action', - 'predicted Post Encroachment Time'] + 'predicted Post Encroachment Time', + 'Post Encroachment Time'] indicatorNameToIndices = utils.inverseEnumeration(indicatorNames) @@ -76,7 +77,8 @@ 'PoC', 'TTC', 'P(SEA)', - 'pPET'] + 'pPET', + 'PET'] indicatorUnits = ['', 'rad', @@ -87,7 +89,8 @@ '', 's', '', - ''] + 's', + 's'] timeIndicators = ['Time to Collision', 'predicted Post Encroachment Time'] @@ -235,7 +238,9 @@ def computePET(self, collisionDistanceThreshold): # TODO add crossing zone - self.pet = moving.MovingObject.computePET(self.roadUser1, self.roadUser2, collisionDistanceThreshold) + pet = moving.MovingObject.computePET(self.roadUser1, self.roadUser2, collisionDistanceThreshold) + if pet is not None: # TODO get crossing zone and time + self.addIndicator(indicators.SeverityIndicator(Interaction.indicatorNames[10], {0: pet}, mostSevereIsMax = False def setCollision(self, collision): '''indicates if it is a collision: argument should be boolean'''