Mercurial > hg > nsaunier > traffic-intelligence
comparison python/prediction.py @ 484:6464e4f0cc26
integrated Sohail direct computation of TTC (need to add pPET)
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Wed, 02 Apr 2014 17:45:18 -0400 |
| parents | a84b9ba9631f |
| children | 000bddf84ad0 |
comparison
equal
deleted
inserted
replaced
| 483:30b3455978d9 | 484:6464e4f0cc26 |
|---|---|
| 398 | 398 |
| 399 p1 = obj1.getPositionAtInstant(currentInstant) | 399 p1 = obj1.getPositionAtInstant(currentInstant) |
| 400 p2 = obj2.getPositionAtInstant(currentInstant) | 400 p2 = obj2.getPositionAtInstant(currentInstant) |
| 401 v1 = obj1.getVelocityAtInstant(currentInstant) | 401 v1 = obj1.getVelocityAtInstant(currentInstant) |
| 402 v2 = obj2.getVelocityAtInstant(currentInstant) | 402 v2 = obj2.getVelocityAtInstant(currentInstant) |
| 403 | 403 intersection = moving.intersection(p1, p2, v1, v2) |
| 404 ttc = moving.Point.timeToCollision(p1, p2, v1, v2, collisionDistanceThreshold) | 404 |
| 405 if ttc: | 405 if intersection != None: |
| 406 return [SafetyPoint(moving.Point(), 1., ttc)], [] | 406 ttc = moving.Point.timeToCollision(p1, p2, v1, v2, collisionDistanceThreshold) |
| 407 else: | 407 if ttc: |
| 408 return [],[] | 408 return [SafetyPoint(intersection, 1., ttc)], [] # (p1+v1.multiply(ttc)+p2+v2.multiply(ttc)).multiply(0.5) |
| 409 else: | |
| 410 return [],[] | |
| 409 | 411 |
| 410 #### | 412 #### |
| 411 # Other Methods | 413 # Other Methods |
| 412 #### | 414 #### |
| 413 | 415 |
