Mercurial Hosting > traffic-intelligence
diff python/prediction.py @ 387:91679eb2ff2c
cleaning up safety analysis and the new traditional constant velocity method
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 24 Jul 2013 12:48:12 -0400 |
parents | 619ae9a9a788 |
children | 55b424d98b68 |
line wrap: on
line diff
--- a/python/prediction.py Tue Jul 23 05:05:06 2013 -0400 +++ b/python/prediction.py Wed Jul 24 12:48:12 2013 -0400 @@ -313,8 +313,8 @@ '''Prediction parameters of prediction at constant velocity using direct computation of the intersecting point''' - def __init__(self, maxSpeed): - PredictionParameters.__init__(self, 'constant velocity (direct computation)', maxSpeed) + def __init__(self): + PredictionParameters.__init__(self, 'constant velocity (direct computation)', None) def computeCrossingsCollisionsAtInstant(self, currentInstant, obj1, obj2, collisionDistanceThreshold, timeHorizon, computeCZ = False, debug = False): collisionPoints = [] @@ -341,10 +341,10 @@ timeInterval1 = moving.TimeInterval(max(0,dist1-halfCollisionDistanceThreshold)/s1, (dist1+halfCollisionDistanceThreshold)/s1) timeInterval2 = moving.TimeInterval(max(0,dist2-halfCollisionDistanceThreshold)/s2, (dist2+halfCollisionDistanceThreshold)/s2) collisionTimeInterval = moving.TimeInterval.intersection(timeInterval1, timeInterval2) - if not collisionTimeInterval.empty(): + if computeCZ and collisionTimeInterval.empty(): + crossingZones = [SafetyPoint(intersection, 1., timeInterval1.distance(timeInterval2))] + else: collisionPoints = [SafetyPoint(intersection, 1., collisionTimeInterval.center())] - else: - crossingZones = [SafetyPoint(intersection, 1., timeInterval1.distance(timeInterval2))] if debug and intersection!= None: from matplotlib.pyplot import plot, figure, axis, title