Mercurial Hosting > traffic-intelligence
comparison python/events.py @ 357:e5fe0e6d48a1
corrected bug computing TTC (resp. pPET) if there is no collision point (resp. crossing zone)
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Thu, 11 Jul 2013 00:07:47 -0400 |
parents | 2f39c4ed0b62 |
children | c41ff9f3c263 |
comparison
equal
deleted
inserted
replaced
356:15fac9c45feb | 357:e5fe0e6d48a1 |
---|---|
116 commonTimeInterval = timeInterval | 116 commonTimeInterval = timeInterval |
117 else: | 117 else: |
118 commonTimeInterval = self.timeInterval | 118 commonTimeInterval = self.timeInterval |
119 for i in list(commonTimeInterval)[:-1]: # do not look at the 1 last position/velocities, often with errors | 119 for i in list(commonTimeInterval)[:-1]: # do not look at the 1 last position/velocities, often with errors |
120 self.collisionPoints[i], self.crossingZones[i] = prediction.computeCrossingsCollisionsAtInstant(i, self.roadUser1, self.roadUser2, predictionParameters, collisionDistanceThreshold, timeHorizon, computeCZ, debug) | 120 self.collisionPoints[i], self.crossingZones[i] = prediction.computeCrossingsCollisionsAtInstant(i, self.roadUser1, self.roadUser2, predictionParameters, collisionDistanceThreshold, timeHorizon, computeCZ, debug) |
121 TTCs[i] = prediction.computeExpectedIndicator(self.collisionPoints[i]) | 121 if len(self.collisionPoints[i]) > 0: |
122 TTCs[i] = prediction.computeExpectedIndicator(self.collisionPoints[i]) | |
122 # add probability of collision, and probability of successful evasive action | 123 # add probability of collision, and probability of successful evasive action |
123 self.addIndicator(indicators.SeverityIndicator('TTC', TTCs)) | 124 self.addIndicator(indicators.SeverityIndicator('TTC', TTCs)) |
124 | 125 |
125 if computeCZ: | 126 if computeCZ: |
126 pPETs = {} | 127 pPETs = {} |
127 for i in list(commonTimeInterval)[:-1]: | 128 for i in list(commonTimeInterval)[:-1]: |
128 pPETs[i] = prediction.computeExpectedIndicator(self.crossingZones[i]) | 129 if len(self.crossingZones[i]) > 0: |
129 self.addIndicator(indicators.SeverityIndicator('pPET', pPETs)) | 130 pPETs[i] = prediction.computeExpectedIndicator(self.crossingZones[i]) |
131 self.addIndicator(indicators.SeverityIndicator('pPET', pPETs)) | |
130 | 132 |
131 def addVideoFilename(self,videoFilename): | 133 def addVideoFilename(self,videoFilename): |
132 self.videoFilename= videoFilename | 134 self.videoFilename= videoFilename |
133 | 135 |
134 def addInteractionType(self,interactionType): | 136 def addInteractionType(self,interactionType): |