comparison 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
comparison
equal deleted inserted replaced
463:cb9683f9efe7 464:dcc821b98efc
354 title('instant {0}'.format(currentInstant)) 354 title('instant {0}'.format(currentInstant))
355 axis('equal') 355 axis('equal')
356 356
357 return collisionPoints, crossingZones 357 return collisionPoints, crossingZones
358 358
359 359 class CVExactPredictionParameters(PredictionParameters):
360 360 '''Prediction parameters of prediction at constant velocity
361 using direct computation of the intersecting point (solving for the equation'''
362
363 def __init__(self):
364 PredictionParameters.__init__(self, 'constant velocity (direct exact computation)', None)
365
366 def computeCrossingsCollisionsAtInstant(self, currentInstant, obj1, obj2, collisionDistanceThreshold, timeHorizon, computeCZ = False, debug = False):
367 'TODO add collision point coordinates, compute pPET'
368 #collisionPoints = []
369 #crossingZones = []
370
371 p1 = obj1.getPositionAtInstant(currentInstant)
372 p2 = obj2.getPositionAtInstant(currentInstant)
373 v1 = obj1.getVelocityAtInstant(currentInstant)
374 v2 = obj2.getVelocityAtInstant(currentInstant)
375
376 ttc = moving.Point.timeToCollision(p1, p2, v1, v2, collisionDistanceThreshold)
377 if ttc:
378 return [SafetyPoint(moving.Point(), 1., ttc)], []
379 else:
380 return [],[]
361 381
362 #### 382 ####
363 # Other Methods 383 # Other Methods
364 #### 384 ####
365 385