Mercurial Hosting > traffic-intelligence
comparison python/prediction.py @ 602:480c8edf177e
condition to make the minTTC is zero not 1 -need to refine-
author | Mohamed Gomaa |
---|---|
date | Thu, 02 May 2013 11:37:24 -0400 |
parents | 414b2e7cd873 |
children |
comparison
equal
deleted
inserted
replaced
601:e1f3b789c632 | 602:480c8edf177e |
---|---|
202 minDist= distance.min() | 202 minDist= distance.min() |
203 t += 1 | 203 t += 1 |
204 Index=np.unravel_index(distance.argmin(), distance.shape) | 204 Index=np.unravel_index(distance.argmin(), distance.shape) |
205 involvedPosition1= p1[Index[0]] | 205 involvedPosition1= p1[Index[0]] |
206 involvedPosition2= p2[Index[1]] | 206 involvedPosition2= p2[Index[1]] |
207 t=[0 if t==1 else t][0] # condition to make the minimum value equal zero (Need to refine) | |
207 return t, involvedPosition1, involvedPosition2 | 208 return t, involvedPosition1, involvedPosition2 |
208 else: | 209 else: |
209 t = 1 | 210 t = 1 |
210 p1 = predictedTrajectory1.predictPosition(t) | 211 p1 = predictedTrajectory1.predictPosition(t) |
211 p2 = predictedTrajectory2.predictPosition(t) | 212 p2 = predictedTrajectory2.predictPosition(t) |
212 while t <= timeHorizon and (p1-p2).norm2() > collisionDistanceThreshold: | 213 while t <= timeHorizon and (p1-p2).norm2() > collisionDistanceThreshold: |
213 p1 = predictedTrajectory1.predictPosition(t) | 214 p1 = predictedTrajectory1.predictPosition(t) |
214 p2 = predictedTrajectory2.predictPosition(t) | 215 p2 = predictedTrajectory2.predictPosition(t) |
215 t += 1 | 216 t += 1 |
217 t=[0 if t==1 else t][0] # condition to make the minimum value equal zero (Need to refine) | |
216 return t, p1, p2 | 218 return t, p1, p2 |
217 | 219 |
218 def computeCrossingsCollisionsAtInstant(currentInstant, obj1, obj2, predictionParameters, collisionDistanceThreshold, timeHorizon, computeCZ = False, debug = False, asWholeVehicle=False): | 220 def computeCrossingsCollisionsAtInstant(currentInstant, obj1, obj2, predictionParameters, collisionDistanceThreshold, timeHorizon, computeCZ = False, debug = False, asWholeVehicle=False): |
219 '''returns the lists of collision points and crossing zones | 221 '''returns the lists of collision points and crossing zones |
220 Check: Predicting all the points together, as if they represent the whole vehicle''' # Done | 222 Check: Predicting all the points together, as if they represent the whole vehicle''' # Done |