Mercurial Hosting > traffic-intelligence
diff python/prediction.py @ 881:8ba82b371eea
work on storing PET
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Tue, 14 Mar 2017 17:48:40 -0400 |
parents | 07c5eab11eba |
children | 40994bb43148 |
line wrap: on
line diff
--- a/python/prediction.py Tue Mar 14 17:10:35 2017 -0400 +++ b/python/prediction.py Tue Mar 14 17:48:40 2017 -0400 @@ -558,9 +558,9 @@ PredictionParameters.__init__(self, 'constant velocity (direct exact computation)', None) def computeCrossingsCollisionsAtInstant(self, currentInstant, obj1, obj2, collisionDistanceThreshold, timeHorizon, computeCZ = False, debug = False, *kwargs): - 'TODO add collision point coordinates, compute pPET' - #collisionPoints = [] - #crossingZones = [] + 'TODO compute pPET' + collisionPoints = [] + crossingZones = [] p1 = obj1.getPositionAtInstant(currentInstant) p2 = obj2.getPositionAtInstant(currentInstant) @@ -570,10 +570,12 @@ if intersection is not None: ttc = moving.Point.timeToCollision(p1, p2, v1, v2, collisionDistanceThreshold) - if ttc: - return currentInstant, [SafetyPoint(intersection, 1., ttc)], [] # (p1+v1.multiply(ttc)+p2+v2.multiply(ttc)).multiply(0.5) + if ttc is not None: + collisionPoints = SafetyPoint(intersection, 1., ttc) else: - return currentInstant, [],[] + pass # compute pPET + + return currentInstant, collisionPoints, crossingZones #### # Other Methods