diff 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
line wrap: on
line diff
--- a/trafficintelligence/prediction.py	Wed Apr 26 18:33:46 2023 -0400
+++ b/trafficintelligence/prediction.py	Wed Apr 26 23:36:32 2023 -0400
@@ -553,8 +553,26 @@
                     collisionPoints = [SafetyPoint((p1+(v1*ttc)+p2+(v2*ttc))*0.5, 1., ttc)]
                 else:
                     pass # compute pPET
+        return collisionPoints, crossingZones
 
-        return collisionPoints, crossingZones
+class CVRectPredictionParameters(PredictionParameters):
+    '''Prediction parameters of prediction at constant velocity
+    for objects represented by boxes (bird eye view boxes)
+    Warning: the computed time to collision may be higher than timeHorizon (not used)'''
+    
+    def __init__(self):
+        PredictionParameters.__init__(self, 'constant velocity for rectangles', None)
+
+    def computeCrossingsCollisionsAtInstant(self, currentInstant, obj1, obj2, collisionDistanceThreshold, timeHorizon, computeCZ = False, debug = False, *kwargs):
+        'TODO compute pPET'
+        collisionPoints = []
+        crossingZones = []
+
+        # first test if there is a collision (test if movement is parallel to sides of vehicle)
+        # test if vehicle aligned with y axis, otherwise, compute slope
+        
+
+        # compute approximate time of arrival
 
 class PrototypePredictionParameters(PredictionParameters):
     def __init__(self, prototypes, nPredictedTrajectories, pointSimilarityDistance, minSimilarity, lcssMetric = 'cityblock', minFeatureTime = 10, constantSpeed = False, useFeatures = True):