Mercurial Hosting > traffic-intelligence
diff trafficintelligence/events.py @ 1252:fe35473acee3
adding method to compute PET using polygon for the outline of a vehicle (bird eye view of the vehicle)
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 22 Mar 2024 14:33:25 -0400 |
parents | 0e5d37b0b9ff |
children | 56d0195d043e |
line wrap: on
line diff
--- a/trafficintelligence/events.py Fri Mar 15 17:05:54 2024 -0400 +++ b/trafficintelligence/events.py Fri Mar 22 14:33:25 2024 -0400 @@ -277,8 +277,9 @@ self.addIndicator(indicators.SeverityIndicator(Interaction.indicatorNames[9], pPETs, mostSevereIsMax=False)) # TODO add probability of collision, and probability of successful evasive action - def computePET(self, collisionDistanceThreshold): - pet, t1, t2= moving.MovingObject.computePET(self.roadUser1, self.roadUser2, collisionDistanceThreshold) + def computePET(self, collisionDistanceThreshold, computePetWithBoundingPoly): + 'Warning: when computing PET from interactions, there could be PETs between objects that do not coexist and therefore are not considered interactions' + pet, t1, t2= moving.MovingObject.computePET(self.roadUser1, self.roadUser2, collisionDistanceThreshold, computePetWithBoundingPoly) if pet is not None: self.addIndicator(indicators.SeverityIndicator(Interaction.indicatorNames[10], {min(t1, t2): pet}, mostSevereIsMax = False)) @@ -325,14 +326,14 @@ else: return None -def computeIndicators(interactions, computeMotionPrediction, computePET, predictionParameters, collisionDistanceThreshold, timeHorizon, computeCZ = False, debug = False, timeInterval = None): +def computeIndicators(interactions, computeMotionPrediction, computePET, predictionParameters, collisionDistanceThreshold, computePetWithBoundingPoly, timeHorizon, computeCZ = False, debug = False, timeInterval = None): for inter in interactions: print('processing interaction {}'.format(inter.getNum())) # logging.debug('processing interaction {}'.format(inter.getNum())) inter.computeIndicators() if computeMotionPrediction: inter.computeCrossingsCollisions(predictionParameters, collisionDistanceThreshold, timeHorizon, computeCZ, debug, timeInterval) if computePET: - inter.computePET(collisionDistanceThreshold) + inter.computePET(collisionDistanceThreshold, computePetWithBoundingPoly) return interactions def aggregateSafetyPoints(interactions, pointType = 'collision'):