# HG changeset patch # User Nicolas Saunier # Date 1682566592 14400 # Node ID 2064e52019db3ff54d708e3b0be4e4edcaf1e91b # Parent a07e455baaa65527aa48486c5b5f9ba1c38f353b work on TTC for BEV diff -r a07e455baaa6 -r 2064e52019db trafficintelligence/moving.py --- a/trafficintelligence/moving.py Wed Apr 26 18:33:46 2023 -0400 +++ b/trafficintelligence/moving.py Wed Apr 26 23:36:32 2023 -0400 @@ -720,7 +720,7 @@ return self.__len__() == 0 def __getitem__(self, i): - if isinstance(i, int) or issubdtype(i, npinteger): + if isinstance(i, int):# or issubdtype(i, npinteger): return Point(self.positions[0][i], self.positions[1][i]) elif isinstance(i, slice): return Trajectory([self.positions[0][i],self.positions[1][i]]) diff -r a07e455baaa6 -r 2064e52019db trafficintelligence/prediction.py --- 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):