Mercurial Hosting > traffic-intelligence
diff python/prediction.py @ 464:dcc821b98efc
integrated and reorganized Sohail s work on exact ttc computation
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Sun, 23 Feb 2014 23:18:08 -0500 |
parents | 55b424d98b68 |
children | e891a41c6c75 |
line wrap: on
line diff
--- a/python/prediction.py Sun Feb 23 22:56:54 2014 -0500 +++ b/python/prediction.py Sun Feb 23 23:18:08 2014 -0500 @@ -356,8 +356,28 @@ return collisionPoints, crossingZones +class CVExactPredictionParameters(PredictionParameters): + '''Prediction parameters of prediction at constant velocity + using direct computation of the intersecting point (solving for the equation''' + + def __init__(self): + PredictionParameters.__init__(self, 'constant velocity (direct exact computation)', None) + def computeCrossingsCollisionsAtInstant(self, currentInstant, obj1, obj2, collisionDistanceThreshold, timeHorizon, computeCZ = False, debug = False): + 'TODO add collision point coordinates, compute pPET' + #collisionPoints = [] + #crossingZones = [] + p1 = obj1.getPositionAtInstant(currentInstant) + p2 = obj2.getPositionAtInstant(currentInstant) + v1 = obj1.getVelocityAtInstant(currentInstant) + v2 = obj2.getVelocityAtInstant(currentInstant) + + ttc = moving.Point.timeToCollision(p1, p2, v1, v2, collisionDistanceThreshold) + if ttc: + return [SafetyPoint(moving.Point(), 1., ttc)], [] + else: + return [],[] #### # Other Methods