Mercurial Hosting > traffic-intelligence
comparison trafficintelligence/prediction.py @ 1209:2064e52019db
work on TTC for BEV
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Wed, 26 Apr 2023 23:36:32 -0400 |
parents | 2795d0e114c9 |
children | 1bad5f9b60de |
comparison
equal
deleted
inserted
replaced
1208:a07e455baaa6 | 1209:2064e52019db |
---|---|
551 ttc = moving.Point.timeToCollision(p1, p2, v1, v2, collisionDistanceThreshold) | 551 ttc = moving.Point.timeToCollision(p1, p2, v1, v2, collisionDistanceThreshold) |
552 if ttc is not None: | 552 if ttc is not None: |
553 collisionPoints = [SafetyPoint((p1+(v1*ttc)+p2+(v2*ttc))*0.5, 1., ttc)] | 553 collisionPoints = [SafetyPoint((p1+(v1*ttc)+p2+(v2*ttc))*0.5, 1., ttc)] |
554 else: | 554 else: |
555 pass # compute pPET | 555 pass # compute pPET |
556 | |
557 return collisionPoints, crossingZones | 556 return collisionPoints, crossingZones |
557 | |
558 class CVRectPredictionParameters(PredictionParameters): | |
559 '''Prediction parameters of prediction at constant velocity | |
560 for objects represented by boxes (bird eye view boxes) | |
561 Warning: the computed time to collision may be higher than timeHorizon (not used)''' | |
562 | |
563 def __init__(self): | |
564 PredictionParameters.__init__(self, 'constant velocity for rectangles', None) | |
565 | |
566 def computeCrossingsCollisionsAtInstant(self, currentInstant, obj1, obj2, collisionDistanceThreshold, timeHorizon, computeCZ = False, debug = False, *kwargs): | |
567 'TODO compute pPET' | |
568 collisionPoints = [] | |
569 crossingZones = [] | |
570 | |
571 # first test if there is a collision (test if movement is parallel to sides of vehicle) | |
572 # test if vehicle aligned with y axis, otherwise, compute slope | |
573 | |
574 | |
575 # compute approximate time of arrival | |
558 | 576 |
559 class PrototypePredictionParameters(PredictionParameters): | 577 class PrototypePredictionParameters(PredictionParameters): |
560 def __init__(self, prototypes, nPredictedTrajectories, pointSimilarityDistance, minSimilarity, lcssMetric = 'cityblock', minFeatureTime = 10, constantSpeed = False, useFeatures = True): | 578 def __init__(self, prototypes, nPredictedTrajectories, pointSimilarityDistance, minSimilarity, lcssMetric = 'cityblock', minFeatureTime = 10, constantSpeed = False, useFeatures = True): |
561 PredictionParameters.__init__(self, 'prototypes', None) | 579 PredictionParameters.__init__(self, 'prototypes', None) |
562 self.prototypes = prototypes | 580 self.prototypes = prototypes |